diff --git a/utilities/random.glsl b/utilities/random.glsl index e1e1b00..d5c1542 100644 --- a/utilities/random.glsl +++ b/utilities/random.glsl @@ -3,3 +3,9 @@ float random(vec2 st) { vec2(12.9898,78.233)))* 43758.5453123); } + +float noise(float x) { + float i = floor(x); + float f = fract(x); + return mix(rand(i), rand(i + 1.0), smoothstep(0.,1.,f)); +} diff --git a/weird/ikeda3.glsl b/weird/ikeda3.glsl new file mode 100644 index 0000000..ef4cdf7 --- /dev/null +++ b/weird/ikeda3.glsl @@ -0,0 +1,40 @@ +#ifdef GL_ES +precision mediump float; +#endif + +uniform vec2 u_resolution; +uniform float u_time; +uniform vec2 u_mouse; + +float random(in float x) { + return fract(sin(x)*1e6); +} + +float randcol(float x, float f, float t) { + return step(0.75,random(floor(x*f)-floor(t))); +} + +void main() { + vec2 st = gl_FragCoord.xy/u_resolution.xy; + st.x *= u_resolution.x/u_resolution.y; + + float cols = 64.; + float freq = random(floor(u_time))+abs(atan(u_time)*.1); + float t = 40.*u_time*(1.-freq); + + if (gl_FragCoord.y < u_mouse.y && st.y < 0.9) { + gl_FragColor = vec4(1.); + return; + } + + if (fract(st.y*cols*.5) < .5) t *= -1.; + + freq += random(floor(st.y*20.)); + + float offset = .025; + vec3 color = vec3(randcol(st.x, freq*100.+random(freq), t+offset), + randcol(st.x, freq*100., t), + randcol(st.x, freq*100.+random(freq), t-offset)); + + gl_FragColor = vec4(1.-color,1.); +}