mirror of
https://github.com/bvanroll/shaders.git
synced 2025-08-29 03:52:47 +00:00
finished at the 8th card "high priestess" for today
This commit is contained in:
23
learning/PixelSpirit/branch.frag
Normal file
23
learning/PixelSpirit/branch.frag
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
float dev = .25;
|
||||
// the card itself has another way to do this, instead of 1.0-st.x+st.y it uses .5+(st.x-st.y)*.5
|
||||
// which i like more
|
||||
color += step(.45, (1.0-st.x+st.y)*.5)-step(.55, (1.0-st.x+st.y)*.5);
|
||||
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
21
learning/PixelSpirit/death.frag
Normal file
21
learning/PixelSpirit/death.frag
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
// simple enough, basically adding together both coors and dividing by 2 (aka multing by .5)
|
||||
color += step(.5,(st.x+st.y)*.5);
|
||||
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
25
learning/PixelSpirit/high_priestess.frag
Normal file
25
learning/PixelSpirit/high_priestess.frag
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
float stroke(in float x_coor, float s, float width){
|
||||
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
|
||||
return clamp(d, 0.,1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
vec2 centre = vec2(.5);
|
||||
// this was my original solution, going to look over the stroke version on the card now
|
||||
//color += step(.25, distance(centre, st))-step(.27, distance(centre, st));
|
||||
color += stroke(length(st-.5)*2.,.5,.05);
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
18
learning/PixelSpirit/justice.frag
Normal file
18
learning/PixelSpirit/justice.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
color += step(.5, st.x);
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
20
learning/PixelSpirit/strength.frag
Normal file
20
learning/PixelSpirit/strength.frag
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
float deviation = .25;
|
||||
//idk why but i've never considered using cos or sin on anything else then u_time, but this is really interesting and something i definetly overlooked
|
||||
color += step(.5+(cos(st.y*PI)*deviation),st.x);
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
34
learning/PixelSpirit/temperance.frag
Normal file
34
learning/PixelSpirit/temperance.frag
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
float squigly_line(in float midpoint, in float deviation, in vec2 st) {
|
||||
return step(midpoint+(cos(st.y*PI)*deviation),st.x)-step(midpoint+deviation+(cos(st.y*PI)*deviation),st.x);
|
||||
}
|
||||
|
||||
float stroke(in float x_coor, float s, float width){
|
||||
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
|
||||
return clamp(d, 0.,1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
float dev = .1;
|
||||
// stagger for .3 .5 and .7, since we don't want any chance of deviation overlap
|
||||
//color += squigly_line(.3, dev, st) + squigly_line(.5,dev,st)+squigly_line(.7,dev,st);
|
||||
|
||||
// after finishing the high priestess decided to come back to this one and try using the stroke function again.
|
||||
float c = cos(st.y*PI)*dev;
|
||||
color += stroke(st.x,.35+c,.1)+stroke(st.x,.5+c,.1)+stroke(st.x,.65+c,.1);;
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
24
learning/PixelSpirit/the_hanged_man.frag
Normal file
24
learning/PixelSpirit/the_hanged_man.frag
Normal file
@@ -0,0 +1,24 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
float stroke(in float x_coor, float s, float width){
|
||||
float d = step(s,x_coor+width*.5)-step(s,x_coor-width*.5);
|
||||
return clamp(d, 0.,1.);
|
||||
}
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
color += stroke((st.x+st.y)*.5, .5, .1)+stroke(.5+(st.x-st.y)*.5,.5,.1);
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
18
learning/PixelSpirit/the_wall.frag
Normal file
18
learning/PixelSpirit/the_wall.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
|
||||
color += step(.45, st.x)-step(.55, st.x);
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
18
learning/PixelSpirit/void.frag
Normal file
18
learning/PixelSpirit/void.frag
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifdef GL_ES
|
||||
precision mediump float;
|
||||
#endif
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
||||
#define PI 3.14159265359
|
||||
|
||||
void main() {
|
||||
vec2 st = gl_FragCoord.xy/u_resolution;
|
||||
vec3 color = vec3(0.0,0.0,0.0);
|
||||
float alpha = 1.0;
|
||||
|
||||
|
||||
|
||||
gl_FragColor = vec4(color, alpha);
|
||||
}
|
Reference in New Issue
Block a user