Droste / log-spiral

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

Droste / log-spiral — 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)

// ── 03 · Droste / log-spiral ────────────────────────────────────────────────
// Slide: zoom section closer. The image contains a smaller, ROTATED copy of
// itself — the "tunnel that turns as it descends." Same log-polar trick, sheared.
// ShaderKit: single pass. Live-edit candidate: flip the sign of uTwist and the
// spiral pitch inverts — great "it's just a number" moment.
// ───────────────────────────────────────────────────────────────────────────

#define PI 3.14159265359
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 uv = (2.0*fragCoord - iResolution.xy)/iResolution.y;

    // to log-polar (complex log): (angle, log radius)
    float r = length(uv);
    float a = atan(uv.y, uv.x);
    vec2 lp = vec2(a, log(r));

    // Droste shear: rotate log-polar space so each loop is also a rotation.
    float uTwist = 0.28;                       // flip sign -> spiral reverses
    lp *= mat2(1.0, uTwist, 0.0, 1.0);

    // tile the spiral + scroll inward
    float period = 1.0;
    float depth = lp.y/period - iTime*0.15;
    vec2 cell = vec2(lp.x/(2.0*PI), fract(depth));

    // procedural rings/tiles inside one cell
    float g = 0.5 + 0.5*sin(cell.x*PI*2.0*5.0);
    float h = smoothstep(0.45,0.5,abs(cell.y-0.5));
    float v = mix(g, 1.0-h, 0.5);
    v = 0.3/(abs(v-0.5)+0.12);

    vec3 col = pal(depth*0.5 + cell.x) * v;
    col *= smoothstep(1.7, 0.15, r);
    fragColor = vec4(pow(col, vec3(0.9)), 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