Tunnel

glint · Examples · Tutorials · Gallery

Old-school texture tunnel through the built-in noise texture, steered by the mouse.

Audio-reactive: it moves with music from a microphone, line-in or a file.

Tunnel: an audio-reactive GLSL shader

An example in glint, a free live shader editor in the browser: the GLSL code floats over the running picture and recompiles as you type.

The code

One pass, in GLSL.

fragment shader

#version 300 es
precision highp float;

uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
uniform vec3 spectrum;
uniform sampler2D noise;

in vec2 v_texcoord;
out vec4 fragColor;

void main() {
    vec2 p = (gl_FragCoord.xy - 0.5 * resolution) / resolution.y;
    p -= (mouse - 0.5) * 0.4;
    float r = length(p);
    float a = atan(p.y, p.x) / 6.28318;
    vec2 uv = vec2(a * 2.0 + time * 0.05, 0.3 / r + time * 0.4);
    float n = texture(noise, uv).r * 0.6 + texture(noise, uv * 4.0).g * 0.4;
    vec3 col = mix(vec3(0.05, 0.1, 0.3), vec3(1.0, 0.5, 0.2), n);
    col += step(0.97, fract(uv.y * 4.0)) * vec3(0.4, 0.8, 1.0) * (1.0 + spectrum.x * 4.0);
    col *= smoothstep(0.0, 0.6, r);          // fog in the distance
    fragColor = vec4(col, 1.0);
}

More Starters examples

Lit mesh · Webcam kaleidoscope · Shadertoy style · Plasma · Mandelbrot & Julia · Reaction–diffusion · Game of Life · Instanced cubes