Lava Lamp 3D WebGL — Raymarched Metaball Simulation
About This Simulation
Lava Lamp 3D renders six independent metaball spheres entirely on your GPU using SDF raymarching. Each blob follows its own sine-wave rise and fall, with a small secondary wobble and a gently pulsing radius, so no two blobs ever move in lockstep. Wherever two blobs drift close together, a smooth-union blend fuses their surfaces into a single rounded neck rather than a hard intersection — the same technique that fuses Crystal Cave's crystal spires, tuned here for a wetter, gooier merge. A pool of wax rests permanently at the base, echoing the reservoir at the bottom of a real lava lamp. The two colours washing through the fluid are not an arbitrary rainbow — they are drawn directly from ASMR Sanctuary's own five theme palettes (Midnight, Forest, Ocean, Ember, Dawn), auto-cycling slowly between them unless you pin one with the palette buttons. A soft screen-space vignette and centre highlight suggest the curved glass tube without the cost of raymarching an actual transparent surface.
Technique
SDF Metaball Raymarching
Blending
Smooth Union (6 Blobs)
Colour
Live Theme-Palette Cycling
Motion
Independent Phase-Shifted Sine
Frequently Asked Questions
What is a raymarched metaball?
A metaball is a sphere defined purely by a signed-distance function rather than a polygon mesh. When two metaball spheres drift close together, blending their distance functions with a smooth-union operation makes their surfaces merge into one continuous blob with a soft, organic seam — exactly how two real wax blobs fuse inside a lava lamp instead of just overlapping like solid billiard balls.
How do the blobs rise and sink without simulating real fluid physics?
Each of the six blobs follows its own sine wave for height, with a different phase offset and frequency, plus a smaller secondary sine wave for gentle horizontal wobble and a slight pulsing radius. There is no heat, density or buoyancy calculation happening — it is a set of six independently timed oscillations, smooth-blended together, tuned to feel like the slow, viscous rise-and-fall of heated wax without the cost of an actual fluid solver.
How does the colour pair cycle through the site's own theme palette?
Rather than a generic rainbow gradient, the two wax colours are drawn directly from ASMR Sanctuary's five real theme accent pairs — Midnight, Forest, Ocean, Ember and Dawn — the same tokens used across the whole site. In Auto mode the shader slowly interpolates from one theme's accent pair to the next roughly every twenty seconds; pin a specific palette with the buttons to hold one pair steady instead.
What does smooth union do in the shader?
Smooth union (opSmoothUnion) blends two SDF surfaces with a soft chamfer instead of a hard intersection, controlled by a blend radius k. Where two blobs approach each other their surfaces merge into a single rounded neck rather than intersecting with a visible seam — the same technique used in Crystal Cave to fuse crystal spires, applied here with a wider blend radius for a wetter, gooier look.
What creates the glass tube look?
There is no explicit glass geometry in the raymarch — instead a screen-space vignette darkens the edges of the frame in an oval shape approximating a cylindrical tube, and a soft vertical highlight band runs down the centre to suggest light refracting through curved glass. Combined with a Fresnel rim glow on the wax itself, the illusion reads as a glass vessel without the extra raymarching cost of a real transparent surface.
What is the difference between Auto and the named palette buttons?
Auto continuously drifts between all five theme colour pairs in sequence, never fully settling. Clicking Midnight, Forest, Ocean, Ember or Dawn pins the fluid to that single pair permanently until you choose another — useful if you find one palette especially soothing and want it to stay put rather than keep shifting.
What sound pairs best with the Lava Lamp?
Deep Om (136.1 Hz) or Space Drone from the Sound Mixer suit the slow, weightless drift of the blobs particularly well. Crystal Singing Bowl also works nicely if you prefer a brighter, more resonant backdrop while watching the wax rise and fall.
Does the Lava Lamp work offline?
Yes. ASMR Sanctuary is a Progressive Web App. After your first visit the Service Worker caches the page and all assets, so the lava lamp simulation runs fully offline with no internet connection required.
My device is struggling — any performance tips?
Shrink the browser window or zoom in to lower the canvas resolution — raymarching cost scales directly with pixel count. Lowering the Speed slider does not reduce GPU load since all six blobs are still evaluated every frame, but pausing stops the render loop entirely, which is the most effective way to save battery if needed.
What is the Fresnel rim glow doing on the wax?
The Fresnel term — based on how directly the surface faces the camera — brightens the edges of each blob where the viewing angle is most glancing, the same effect that makes real wax and glass appear to glow brighter at their silhouette. It is layered on top of the diffuse and specular lighting to give the blobs a soft, luminous edge rather than a flat, matte look.