Files
glsl_playground/weird/ikeda3.glsl

41 lines
951 B
GLSL

#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.);
}