commit 0bf035e7bb920ff569085d5508c182ac89724102 Author: Anish Lakhwara Date: Fri Apr 24 16:07:47 2020 +1000 initial diff --git a/fence/art-of-code-example.frag b/fence/art-of-code-example.frag new file mode 100644 index 0000000..22f0c7e --- /dev/null +++ b/fence/art-of-code-example.frag @@ -0,0 +1,18 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +void main() { + vec3 color = vec3(0); + vec2 st = (gl_FragCoord.xy-.5*u_resolution.xy)/u_resolution.y; + + float m = smoothstep(0.05, 0.0, abs(st.x)); + color += m; + + gl_FragColor = vec4(color,1.0); +} + diff --git a/fence/example.frag b/fence/example.frag new file mode 100644 index 0000000..69e5582 --- /dev/null +++ b/fence/example.frag @@ -0,0 +1,28 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +// Plot a line on Y using a value between 0.0-1.0 +float plot(vec2 st, float pct){ + return smoothstep( pct-0.02, pct, st.y) - + smoothstep( pct, pct+0.02, st.y); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution; + + float y = st.x; + + vec3 color = vec3(y); + + // Plot a line + float pct = plot(st,y); + color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0); + + gl_FragColor = vec4(color,1.0); +} + diff --git a/fence/kynd functions.png b/fence/kynd functions.png new file mode 100644 index 0000000..52d1d0f Binary files /dev/null and b/fence/kynd functions.png differ diff --git a/fence/mod_with_number_first.frag b/fence/mod_with_number_first.frag new file mode 100644 index 0000000..aa75589 --- /dev/null +++ b/fence/mod_with_number_first.frag @@ -0,0 +1,28 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +// Plot a line on Y using a value between 0.0-1.0 +float plot(vec2 st, float pct){ + return smoothstep( pct-0.02, pct, st.y) - + smoothstep( pct, pct+0.02, st.y); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution; + + float y = mod(13.5, st.x); + + vec3 color = vec3(y); + + // Plot a line + float pct = plot(st,y); + color = (1.0-pct)*color+pct*vec3(0.0,1.0,0.0); + + gl_FragColor = vec4(color,1.0); +} + diff --git a/fence/scratch.frag b/fence/scratch.frag new file mode 100644 index 0000000..0b9f0ee --- /dev/null +++ b/fence/scratch.frag @@ -0,0 +1,19 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +void main() { + vec3 color = vec3(0); + vec2 st = (gl_FragCoord.xy-.5*u_resolution.xy)/u_resolution.y; + st *= u_time; + + float m = .5 - abs(sin(st.x)); + color += m; + + gl_FragColor = vec4(color,1.0); +} + diff --git a/simplest.frag b/simplest.frag new file mode 100644 index 0000000..aaa04e1 --- /dev/null +++ b/simplest.frag @@ -0,0 +1,15 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform vec2 u_mouse; +uniform float u_time; + +void main() { + // make a vector that puts all x and y values between 0.0 - 1.0 so we can use it as a color + vec2 st = gl_FragCoord.xy/u_resolution; + // use time to change the blue hue of the screen + gl_FragColor = vec4(st.x,st.y,abs(sin(u_time)),1.0); +} +