Sugar clouds

GLSL shader by merrypranxter · created 2026-02-12 · 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)

// --- 1. THE DEFINES (STRUCTURE + FUN) ---
#define SPEED iTime * 0.8
#define MYCELIUM_DENSITY 8.5 // THE HARD LATTICE
#define CANDY_FLOW 3.5       // THE SOFT GOO
#define GLOW_STRENGTH 0.5  // NEON VEINS

// --- 2. THE MATH ENGINE (THE HYBRID) ---

mat2 rot(float a) { return mat2(cos(a), -sin(a), sin(a), cos(a)); }

// UNICORN PALETTE (KEPT THE FUN)
vec3 unicorn_palette(float t) {
    vec3 a = vec3(0.5, 0.5, 0.5);
    vec3 b = vec3(0.5, 0.5, 0.5);
    vec3 c = vec3(1.0, 1.0, 1.0);
    vec3 d = vec3(0.0, 0.33, 0.67);
    return a + b * cos(6.28318 * (c * t + d + iTime * 0.1));
}

// THE MYCELIUM STRUCTURE (THE "GET GOOD" VEINS)
float get_mycelium(vec2 p) {
    float d = 0.0;
    float scale = 1.0;
    
    // FRACTAL GROWTH LOOP
    for(float i = 0.0; i < 4.0; i++) {
        p *= rot(iTime * 0.05 + i); // ROTATE SLOWLY
        p = abs(p) - 0.5 * scale;   // FOLD SPACE
        d = max(d, abs(sin(p.x * MYCELIUM_DENSITY * scale) * cos(p.y * MYCELIUM_DENSITY * scale)));
        scale *= 0.8; // GET SMALLER
    }
    return 1.0 - d; // INVERT SO VEINS ARE BRIGHT
}

// THE FLOWMAP (UNICORN GUTS)
float get_flow(vec2 p) {
    float d = 0.0;
    p *= 3.0;
    for(float i = 1.0; i < 3.0; i++) {
        p.x += 0.5 * sin(p.y * i + SPEED);
        p.y += 0.5 * cos(p.x * i + SPEED);
        d += sin(p.x + p.y);
    }
    return d;
}

// --- 3. THE RENDERER (CANDY CATHEDRAL) ---

void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
    // 1. NORMALIZE
    vec2 uv = (fragCoord * 2.0 - iResolution.xy) / iResolution.y;
    vec2 uv0 = uv;
    
    // 2. GENERATE THE FLOW (BACKGROUND)
    float flow = get_flow(uv);
    vec3 bg_col = unicorn_palette(flow * 0.5 + length(uv));
    
    // 3. GENERATE THE MYCELIUM (FOREGROUND STRUCTURE)
    // We warp the mycelium WITH the flow so they connect!
    vec2 struct_uv = uv + flow * 0.1; 
    float structure = get_mycelium(struct_uv);
    
    // 4. THE "HYSTERESIS" GLOW (NEON EDGES)
    // Make the veins glow hot pink/white
    float vein = GLOW_STRENGTH / (abs(structure - 0.95) + 0.001);
    
    // 5. COMBINE (SOFT + HARD)
    vec3 col = bg_col * 0.5; // DIM THE BACKGROUND
    col += vein * unicorn_palette(structure + iTime); // LIGHT UP THE VEINS
    
    // 6. SPARKLE OVERLAY (BECAUSE YOU LIKE IT)
    float sparkle = fract(sin(dot(uv, vec2(12.9898, 78.233))) * 43758.5453);
    if (sparkle > 0.98) col += 1.0; // DIAMOND DUST

    // 7. POLISH
    col = pow(col, vec3(0.8)); // CRUNCHY GAMMA
    col *= smoothstep(1.5, 0.5, length(uv0)); // VIGNETTE

    fragColor = vec4(clamp(col, 0.0, 1.0), 1.0);
}

Image

Not used

More shaders by merrypranxter

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

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

Account

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