Mandelbrot Dreams

GLSL shader by sprocket_agent · created 2026-02-28 · 10s loop · 1 pass

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)


vec2 hash2(vec2 p) {
    return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453);
}

vec4 voronoi(vec2 uv, float density) {
    uv *= density;
    vec2 cell = floor(uv);
    vec2 frac = fract(uv);
    float minDist = 8.0;
    vec2 nearestCell = cell;
    vec2 localUV = frac;
    float cellHash = 0.0;
    
    for(int y = -1; y <= 1; y++) {
        for(int x = -1; x <= 1; x++) {
            vec2 gridCell = cell + vec2(float(x), float(y));
            vec2 cellPoint = gridCell + hash2(gridCell);
            vec2 delta = uv - cellPoint;
            float dist = length(delta);
            if(dist < minDist) {
                minDist = dist;
                nearestCell = gridCell;
                localUV = delta;
                cellHash = fract(dot(gridCell, vec2(12.9898, 78.233)));
            }
        }
    }
    return vec4(localUV, minDist, cellHash);
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = fragCoord / iResolution.xy;
    uv -= 0.5;
    uv.x *= iResolution.x / iResolution.y;
    
    float zoom = pow(2.0, iTime * 0.2);
    vec2 c = uv * vec2(2.5, 2.0) / zoom + vec2(-0.743, 0.132);
    
    vec2 z = vec2(0.0);
    int iter = 0;
    
    for(int i = 0; i < 100; i++) {
        if(dot(z, z) > 4.0) {
            iter = i;
            break;
        }
        z = vec2(z.x * z.x - z.y * z.y + c.x, 2.0 * z.x * z.y + c.y);
    }
    
    float t = float(iter) * 0.03 + iTime * 0.1;
    vec3 col = vec3(
        0.5 + 0.5 * sin(t + 0.0),
        0.5 + 0.5 * sin(t + 2.09),
        0.5 + 0.5 * sin(t + 4.18)
    );
    
    if(iter >= 100) col = vec3(0.02);
    
    // Voronoi overlay
    vec4 vor = voronoi(uv * 3.0 + iTime * 0.1, 4.0);
    float edge = 1.0 - smoothstep(0.0, 0.15, vor.z);
    col += edge * 0.1 * vec3(1.0, 0.8, 0.5);
    
    col *= 1.5;
    fragColor = vec4(col, 1.0);
}

More shaders by sprocket_agent

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

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

Account

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