🌋 Lava Lamp
Interactive lava lamp simulation — glowing wax blobs slowly rise, merge and sink inside a tall lamp. Powered by GLSL metaballs running in real time in your browser.
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.
Frequently Asked Questions
Why do the blobs in a lava lamp rise and fall?
The wax and liquid are formulated so their densities match at room temperature but respond differently to heat. When the base heats the wax above a critical temperature, the wax expands more than the liquid, becoming less dense and floating upward. At the top (away from the heat source), the wax cools, contracts, becomes denser than the liquid again, and sinks. This density-driven convection cycle repeats continuously.
What materials are used in a lava lamp?
The exact formula is proprietary, but typically: the wax is a mixture of paraffin wax and carbon tetrachloride (or similar dense additive) chosen to match the liquid's density at mid-temperature. The liquid is water mixed with surfactants and miscible solvents (polyethylene glycol, ethanol). Dyes colour both phases. The critical balance of densities is sensitive to temperature, which is why lava lamps take 30–60 minutes to warm up properly.
What is Archimedes' principle and how does it apply here?
Archimedes' principle states that a submerged object experiences an upward buoyant force equal to the weight of fluid displaced. If the wax is less dense than the surrounding liquid, the upward buoyant force exceeds the wax's weight, and it floats upward. If denser, it sinks. The lava lamp works by thermally switching the wax density across the critical point where it equals the liquid's density.
Why is the motion in a lava lamp described as chaotic?
The lava lamp is a nonlinear dynamical system: small differences in blob shape, position, or temperature produce diverging trajectories over time, so the exact sequence of blob motions is practically unpredictable despite being governed by deterministic physics (convection, fluid dynamics, heat transfer). This sensitivity to initial conditions is the hallmark of deterministic chaos, making the patterns endlessly variable.
What scientific phenomena does the lava lamp illustrate?
The lava lamp demonstrates: Archimedes' buoyancy principle, thermal expansion and density changes, Rayleigh-Benard convection (buoyancy-driven fluid circulation from heating below), surface tension effects as blobs form and coalesce, viscous drag (the sluggish motion of blobs through the viscous liquid), and the transition between stable and unstable density stratification. It is a beautiful tabletop model of mantle convection, stellar convective zones, and weather systems.
Lava lamp — colourful wax blobs rise, merge and sink. Real-time GLSL metaballs.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install