Files
glsl_playground/weird/ikeda.glsl
2017-06-08 22:33:38 -04:00

35 lines
823 B
GLSL

#ifdef GL_ES
precision mediump float;
#endif
uniform vec2 u_resolution;
uniform float u_time;
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 = 8.;
float freq = random(floor(u_time))+abs(atan(u_time)*0.1);
float t = 40.*u_time*(1.0-freq);
if (fract(st.y*cols*.5) < .5) t *= -1.0;
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.);
}