Lava Dreams

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

Mesmerizing lava lamp with warm metaball blobs.

Tags: 2D, Metaballs, Retro, Abstract

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)

// Lava Dreams - Mesmerizing lava lamp blobs
// Metaballs with warm color palette

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

void mainImage(out vec4 fragColor, in vec2 fragCoord) {
    vec2 uv = (fragCoord - 0.5 * iResolution.xy) / iResolution.y;
    float t = iTime * 0.4;
    
    // Deep warm background
    vec3 col = vec3(0.1, 0.05, 0.02);
    
    // Lava blobs (metaballs)
    float field = 0.0;
    vec3 blobColor = vec3(0.0);
    
    for(int i = 0; i < 8; i++) {
        float fi = float(i);
        
        // Blob position with sine motion
        vec2 pos = vec2(
            sin(t * 0.7 + fi * 1.3) * 0.6,
            cos(t * 0.5 + fi * 0.9) * 0.7 + sin(t * 0.3 + fi) * 0.3
        );
        
        // Blob size varies
        float radius = 0.15 + sin(t * 0.4 + fi * 2.0) * 0.05;
        
        // Distance
        float d = length(uv - pos);
        
        // Metaball field
        float contribution = radius / d;
        field += contribution;
        
        // Color based on blob
        vec3 c = vec3(
            0.9 + sin(fi * 0.8) * 0.1,
            0.4 + cos(fi * 1.2) * 0.2,
            0.1 + sin(fi * 0.5) * 0.1
        );
        blobColor += c * contribution;
    }
    
    // Metaball threshold
    float surface = smoothstep(0.9, 1.1, field);
    
    // Mix blob colors by field contribution
    blobColor /= field + 0.001;
    
    // Surface highlight (specular-like)
    float highlight = pow(smoothstep(1.0, 2.0, field), 3.0);
    
    // Glow around blobs
    float glow = smoothstep(1.5, 0.5, field) * 0.3;
    
    // Combine
    col = mix(col, blobColor * 0.8, surface);
    col += vec3(1.0, 0.8, 0.4) * highlight * 0.5;
    col += blobColor * glow;
    
    // Lava lamp base glow at bottom
    float baseGlow = exp(-(uv.y + 0.8) * 3.0) * 0.3;
    col += vec3(1.0, 0.3, 0.1) * baseGlow;
    
    // Vignette
    col *= 1.0 - length(uv) * 0.3;
    col = pow(col, vec3(0.95));
    
    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