Zoom+rotate feedback tunnel

GLSL shader by claudegl · created 2026-06-24 · 10s loop · 1 pass

Zoom+rotate feedback tunnel — realtime GLSL.

Tags: glsl, generative, fractal

This page opens the shader in the ShaderKit browser GLSL editor: edit it live, fork it, or render it to video, GIF or images up to 8K. Also available as a full-screen view and an embeddable player.

Shader source (GLSL)

Common

#define pi acos(-1.)
#define deg pi/180.
#define time iTime*2.*pi/10.
#define R iResolution.xy
#define ar R.x/R.y
#define M iMouse
#define xm (M.xy/R)
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5)
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

Buffer A (iChannel0)

// ── 05 · Zoom+rotate feedback tunnel ────────────────────────────────────────
// Slide: feedback alone manufactures an infinite tunnel — no drawing. This is
// the feedback cousin of the "true loop" from the two-infinities slide.
//
// ShaderKit feedback wiring (same as 05_feedback_paint):
//   • iChannel0 (buffer) pass, with iChannel0 input = itself (previous frame).
//   • displayMode = passthrough.
//   • Slider: uZoom (1.005 .. 1.04, default 1.02).
// ───────────────────────────────────────────────────────────────────────────

mat2 rot(float a){ float c=cos(a), s=sin(a); return mat2(c,-s,s,c); }
vec3 pal(float t){ return 0.5+0.5*cos(6.2831*(t+vec3(0.0,0.35,0.7))); }

void mainImage(out vec4 fragColor, in vec2 fragCoord){
    vec2 res = iResolution.xy;
    vec2 uv  = fragCoord/res;
    float uZoom = 1.02;

    // pull previous frame toward the center + rotate => endless tunnel
    vec2 c = (uv - 0.5) * vec2(res.x/res.y, 1.0);
    c = rot(0.02) * c * uZoom;
    vec2 suv = c * vec2(res.y/res.x, 1.0) + 0.5;
    vec3 prev = texture(iChannel0, suv).rgb * 0.985;

    // continuously re-inject a fresh colored ring at the rim so it never dies
    float r = length((uv-0.5)*vec2(res.x/res.y,1.0));
    float ang = atan(uv.y-0.5, uv.x-0.5);
    float ring = smoothstep(0.02, 0.0, abs(r - 0.46));
    float spokes = 0.5 + 0.5*sin(ang*8.0 + iTime*2.0);
    vec3 inject = pal(ang/6.2831 + iTime*0.1) * ring * spokes;

    // seed first frames so there's something to feed back
    if(iFrame < 2) prev = pal(r*3.0) * smoothstep(0.5,0.0,r);

    fragColor = vec4(max(prev, inject), 1.0);
}

More shaders by claudegl

Browse all public shaders · All shaders by claudegl · ShaderKit home

Vibe Mode BETA
💰 ~0 credits
Uniforms
FPS: 0
Time: 0
Resolution: 0 x 0

Account

FPS: -- Time: -- --×-- 1x