Skip to content

Instantly share code, notes, and snippets.

@ifree
Created November 5, 2012 11:06
Show Gist options
  • Save ifree/4016664 to your computer and use it in GitHub Desktop.
Save ifree/4016664 to your computer and use it in GitHub Desktop.
#glsl cave
#ifdef GL_ES
precision highp float;
#endif
uniform vec2 resolution;
uniform float time;
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform sampler2D tex3;
void main(void)
{
vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / resolution.xy;
vec2 uv;
float r = pow( pow(p.x*p.x,16.0) + pow(p.y*p.y,16.0), 1.0/32.0 );
uv.x = .5*time + 0.5/r;
uv.y = 2.0*atan(p.y,p.x)/3.1416+2.5;
vec3 col0 = texture2D(tex0,uv).xyz;
vec3 col1 = texture2D(tex1,uv).xyz;
vec3 col2 = texture2D(tex2,uv).xyz;
vec3 col3 = texture2D(tex3,uv).xyz;
vec3 col = vec3(0);
col += (step (4.0,uv.y) + step(uv.y,1.0)) * col0;
col += step (1.0,uv.y) * step(uv.y,2.0) * col1;
col += step (2.0,uv.y) * step(uv.y,3.0) * col2;
col += step (3.0,uv.y) * step(uv.y,4.0) * col3;
gl_FragColor = vec4(col*r*r*r,1.0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment