Demo entry 6786028

tunnel experiment

   

Submitted by anonymous on Mar 23, 2019 at 14:07
Language: GLSL. Code size: 996 Bytes.

/* sy2002's first shader toy experiment
   done on 23rd of March 2019
   inspired by the "GPU Technology Conference 2014.
                    Shadertoy: Do You Know What a Fragment Shader Can Do?" presentation
*/

void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
    // normalized pixel coordinates (from 0 to 1)
    vec2 uv = fragCoord.xy/iResolution.xy;

    // center screen
    vec2 p = uv - 0.5;
    
    // transform to polar coordinates (radius, angle)
    float r = length(p);
    float a = atan(p.x, p.y);
    
    // first row is frequency data (48Khz/4 in 512 texels, meaning 23 Hz per texel)
    float fft  = texelFetch(iChannel1, ivec2(30, 0), 0 ).x; 
   
    // get tunnel texture using polar coordinates and animate (time, bass of sound)
    vec3 tex = texture(iChannel0, vec2(1.0 / r + iTime, a + fft)).xyz;

    // darken the center of the tunnel
    vec3 c = tex.xyz * r * 2.0;
    
    // output to screen
    fragColor = vec4(c, 1.0);
}

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).