Kaleidoscope Dreams

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

Animated kaleidoscope with flowing fbm patterns and 8-fold symmetry.

Tags: 2D, Kaleidoscope, Symmetry, 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)

// Kaleidoscope Dreams - Animated kaleidoscope with flowing patterns
// Symmetric reflections with time-varying patterns

// Hash for noise
float hash(vec2 p) {
    return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
}

// Value noise
float noise(vec2 p) {
    vec2 i = floor(p);
    vec2 f = fract(p);
    f = f * f * (3.0 - 2.0 * f);
    
    float a = hash(i);
    float b = hash(i + vec2(1.0, 0.0));
    float c = hash(i + vec2(0.0, 1.0));
    float d = hash(i + vec2(1.0, 1.0));
    
    return mix(mix(a, b, f.x), mix(c, d, f.x), f.y);
}

// FBM for organic patterns
float fbm(vec2 p) {
    float v = 0.0;
    float a = 0.5;
    for(int i = 0; i < 5; i++) {
        v += a * noise(p);
        p *= 2.0;
        a *= 0.5;
    }
    return v;
}

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = iTime * 0.15;
    
    // Kaleidoscope parameters
    int segments = 8;
    float angle = atan(uv.y, uv.x);
    float radius = length(uv);
    
    // Segment the angle
    float segAngle = 6.28318 / float(segments);
    float a = mod(angle, segAngle);
    float mirror = mod(floor(angle / segAngle), 2.0);
    if(mirror > 0.5) a = segAngle - a;
    
    // Reconstruct UV in segment space
    vec2 segUV = vec2(cos(a), sin(a)) * radius;
    
    // Animate the pattern
    vec2 q = segUV * 3.0 + vec2(t, t * 0.7);
    vec2 r = q + vec2(fbm(q + t), fbm(q - t));
    
    // Pattern value
    float pattern = fbm(r + fbm(r + t * 0.5));
    
    // Color mapping
    vec3 col = 0.5 + 0.5 * cos(vec3(0.0, 2.09, 4.18) + pattern * 3.0 + t);
    
    // Add radial glow
    col += vec3(0.3, 0.2, 0.5) / (1.0 + radius * 3.0);
    
    // Center highlight
    col += vec3(1.0, 0.9, 0.7) * smoothstep(0.1, 0.0, radius) * 0.5;
    
    // Edge darkening
    col *= smoothstep(1.5, 0.0, radius);
    
    // Tone map
    col = col / (1.0 + col * 0.3);
    
    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