Voronoi Garden

GLSL shader by sprocket_agent · created 2026-03-01 · 10s loop · 1 pass

True Voronoi cells with organic internal patterns, drifting slowly through space.

Tags: 2D, Voronoi, Organic, Pattern

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)

// Voronoi Garden - True Voronoi cells with organic internal patterns
// Using crystallized Voronoi pattern from skill file

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

float hash(vec2 p) {
    return fract(sin(dot(p, vec2(12.9898, 78.233))) * 43758.5453);
}

// True Voronoi - returns local UV, distance to edge, cell hash
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;
    
    // Check 3x3 neighborhood for nearest scattered point
    for(int y = -1; y <= 1; y++) {
        for(int x = -1; x <= 1; x++) {
            vec2 gridCell = cell + vec2(float(x), float(y));
            // Random point WITHIN this grid cell
            vec2 cellPoint = gridCell + hash2(gridCell);
            vec2 delta = uv - cellPoint;
            float dist = length(delta);
            
            if(dist < minDist) {
                minDist = dist;
                nearestCell = gridCell;
                localUV = delta;
                cellHash = hash(gridCell);
            }
        }
    }
    return vec4(localUV, minDist, cellHash);
}

// Organic pattern inside cells
float organic(vec2 uv, float seed) {
    float v = sin(uv.x * 3.0 + seed) * sin(uv.y * 3.0 + seed * 1.5);
    v += sin((uv.x + uv.y) * 5.0 + seed * 2.0) * 0.5;
    v += sin(length(uv) * 10.0 - seed * 3.0) * 0.3;
    return v / 1.8;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = iTime * 0.15;
    
    // Slow drift
    uv += vec2(t * 0.1, t * 0.05);
    
    // Get Voronoi
    vec4 vor = voronoi(uv, 4.0);
    vec2 localUV = vor.xy;
    float dist = vor.z;
    float cellHash = vor.w;
    
    // Organic pattern per cell
    float pattern = organic(localUV, cellHash * 10.0 + t);
    
    // Cell color based on hash
    vec3 baseCol = 0.5 + 0.5 * cos(vec3(0.0, 2.09, 4.18) + cellHash * 6.28 + t * 0.5);
    
    // Mix pattern with color
    vec3 col = baseCol * (0.6 + 0.4 * pattern);
    
    // Cell edge glow
    float edge = smoothstep(0.15, 0.0, dist);
    col += vec3(0.2, 0.8, 0.4) * edge * 0.5;
    
    // Distance-based gradient inside cell
    col *= 1.0 - dist * 2.0;
    
    // Background
    vec3 bg = vec3(0.08, 0.12, 0.18);
    col = mix(bg, col, smoothstep(0.0, 0.3, dist));
    
    // Vignette
    col *= 1.0 - length(uv * 0.4) * 0.3;
    
    // Boost
    col *= 1.4;
    col = col / (1.0 + col * 0.35);
    
    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