Fractaling Descent

GLSL shader by scry · created 2026-10-24 · 10s loop · 2 passes

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.  //1 degree
#define time iTime*2.*pi/10. //sin(time) loops 10 seconds
#define R iResolution.xy //shorthand
#define ar R.x/R.y //aspect ratio
#define M iMouse //shorthand
#define xm (M.xy/R) //normalized mouse
#define nm ((xm.xy-0.5)*vec2(ar,1.)+0.5) //aspect ratio correction
vec3 cs = vec3(1.,2.,3.);
mat2 r2d(float a) {
    return mat2(cos(a),sin(a),-sin(a),cos(a));
}

Buffer A (iChannel0)

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord.xy / iResolution.xy;
    uv -= 0.5;
    uv.x *= ar;
    vec3 col = vec3(0.);
    float t = fract(iTime / 10.0);

    // multi layer pseudo3d KIFS
    for (int l = 0; l < 5; l++) {
        float fl = float(l);
        float z = fract(fl / 5.0 + t * 2.0);
        float scale = mix(3.0, 0.5, z);
        float fade = smoothstep(0.0, 0.2, z) * smoothstep(1.0, 0.7, z);
        vec2 p = uv * scale;
        p *= r2d(fl * 0.6 + z * 0.2);
        
        //p += vec2(sin(fl * 2.0), cos(fl * 3.0)) * 0.3;
        float s = 1.0;
        float trap = 1e3;
        p = abs(p) - 0.2;
        p *= r2d(deg * 45.);
        p = abs(p) - 0.59;
        for (int i = 0; i < 8; i++) {
            p = abs(p) - vec2(0.5, 0.3) * (0.8 + 0.2 * sin(time * 0.5 * 2.0+float(l)*0.3));
            p *= r2d(45.0 * deg);
            p *= 1.4;
            s *= 1.4;
            trap = min(trap, length(p));
        }
        float d = length(p) / s;
        vec3 lc = vec3(uv.x, uv.y, sin(time)) * 0.3;
        lc += (0.5 + 0.5 * cos(vec3(0., 2., 4.) + trap * 3.0 + time + fl * 2.0 * pi)) * exp(-trap * 1.5);
        lc += vec3(0.02) / (d * 20.0 + 0.05);
        vec3 ld = (vec3(0.01)/(d*20.+0.02));
        ld += (sin(d*200.+cs+fl*pi/2.+3.+time*4.)*0.8+0.2)*smoothstep(0.01,0.,d-0.01)*0.6;
        col += ld*fade;
        //col += lc * fade * 0.3;
    }
    fragColor = vec4(col, 1.0);
}

Image

Not used

More shaders by scry

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

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

    Account

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