About this simulation
Watch real convection physics play out in a classic lava lamp — rendered entirely in your browser with a GLSL metaball shader running on the GPU. Wax blobs cycle endlessly: heated at the base they expand, become less dense than the surrounding liquid, and float upward; near the cool top they contract, grow denser, and sink back down. The smooth, organic merging you see is produced by metaball mathematics — each blob contributes an inverse-square potential field, and wherever the combined field exceeds the threshold the surface blooms into existence, automatically fusing nearby blobs into one.
🔬 What it shows
The simulation models thermal convection and buoyancy-driven flow. Each blob traces a sinusoidal path with randomised period (4 – 9 s), amplitude, and horizontal sway. When Heat is ON the effective flow speed jumps 2.5×, mimicking the faster cycling a real lamp shows after warm-up. The GLSL fragment shader evaluates the metafield sum every pixel in real time.
🎮 How to use
Use Blob count (3 – 12) to add or remove wax blobs. Flow speed stretches the time scale so you can study slow, meditative movement or frenetic churning. Blob size scales every blob's radius uniformly — crank it up to force dramatic merges. Toggle Colour theme among Red/Orange, Blue/Cyan, Green, and Purple. Hit Heat to simulate the lamp running hot.
💡 Did you know?
The lava lamp was invented by British accountant Edward Craven Walker in 1963. The secret is a careful density match: the wax and water-based liquid are engineered to have nearly identical densities at room temperature, so even a small temperature change at the base tips the balance and launches the blobs upward. Real lamps take 45 – 60 minutes to reach steady cycling.
Frequently asked questions
Why do the blobs rise and fall without stopping?
It is a continuous convection loop. Heat from the base warms the wax, which expands and becomes slightly less dense than the surrounding liquid. Buoyancy pushes it up. At the cooler top the wax loses heat, contracts, becomes denser again, and gravity pulls it back down — and the cycle repeats indefinitely as long as the heat source remains on.
What are metaballs and how do they make blobs merge?
Each blob is a point in space with an invisible potential field that falls off as 1/distance². The GLSL shader sums the contributions of every active blob at each pixel. Where the total field value exceeds a threshold of 1.0, the pixel is drawn as wax; where it falls below, it is transparent liquid. When two blobs come close their combined field easily exceeds the threshold between them, creating a seamless neck that grows into a full merge — exactly the organic pooling you see in a real lamp.
What does the Heat button do?
Toggling Heat ON multiplies the effective flow speed by 2.5×, simulating the lamp running at high temperature. In real lamps, extra heat lowers the wax density further and shortens each convection cycle. You will see the blobs cycling much faster and the warm base glow brightening. Toggle it back off to return to the gentle default pace.
How do I get the most dramatic blob merges?
Set Blob count to 10 – 12, increase Blob size to around 1.5 – 2.0, and slow Flow speed to 0.3 – 0.5. The larger radii mean blob fields overlap more easily, and the slower speed gives them time to drift together before separating. You can also turn Heat ON briefly to cluster blobs at the top and then switch it off to watch them slowly descend and coalesce.
Is this simulation accurate to real lava lamp physics?
It captures the essential physics qualitatively: thermal convection drives the vertical cycling, and metaball field mathematics correctly models the smooth surface tension-like merging. The periods, amplitudes, and radii are tuned by hand rather than derived from fluid-dynamics equations, so the timing is an artistic approximation. A fully accurate model would require solving the Navier–Stokes equations with temperature-dependent viscosity — far beyond a real-time browser renderer.