aboutsummaryrefslogtreecommitdiff
path: root/assets/shaders/SquareTunnel.frag.glsl
blob: 1298a03ad90bf70d120e0f692c0e9d29e67f8c2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifdef GL_ES
precision highp float;
#endif

uniform vec2 u_resolution;
uniform float u_time;
uniform float u_speed;
uniform sampler2D u_tex0;

void main(void)
{
    vec2 p = -1.0 + 2.0 * gl_FragCoord.xy / u_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 = 0.5*u_time*u_speed + 0.5/r;
    uv.y = 1.0*atan(p.y,p.x)/3.1416;

    vec3 col =  texture2D(u_tex0,uv).xyz;

    gl_FragColor = vec4(col*r*r*r,1.0);
}