Visualizations
497 / 500

497 · Nature

Lava Island

A volcanic island erupts at dusk, and every lava flow cools into new land.

Lava is a thin flow on a heightfield moved by a cellular Bingham-fluid model: between each cell and its eight neighbors it only moves when thicker than a critical depth set by its yield strength, and the flux follows the Bingham formula with a viscosity that climbs exponentially as it cools, so flows slow, thicken and stall on their own. Heat travels with the lava, radiates away fastest from thin sheets and is quenched by the sea in clouds of steam. Below the solidus a cell's lava turns into rock and joins the terrain, so each flow builds the ground the next one runs over, lava deltas push the coast outward, and old rock slowly turns green again. The block is drawn per pixel with an orthographic voxel-space raycast, with glowing Voronoi cracks in the crust, bloom, steam clouds and a summit ash plume lit from below.

Try it. Click the island to open a new vent. Up and Down change the eruption rate, T toggles a 4x time-lapse and R grows a fresh island. Left alone, the summit keeps erupting and new flank vents open now and then.

  • Bingham-fluid cellular automaton
  • Temperature-dependent viscosity
  • Orthographic voxel-space raycasting
  • Voronoi crack texture
  • Bloom and sprite plumes

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a lava flow simulation on a volcanic island with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple, seen from above:
- Make a canvas that fills the window and is sharp on high-DPI screens. Keep a 128 by 128 grid of ground heights shaped like a volcano: a noisy cone rising out of a sea at height zero.
- Give every cell a lava thickness and a temperature (1 is fresh, about 0.45 is solid). A vent at the summit adds hot lava every frame.
- Each step, lava flows toward each lower neighbor only if it is thicker than a critical depth (yield strength divided by slope), at a rate proportional to thickness cubed times slope over viscosity. Make viscosity and yield strength grow exponentially as it cools, limit how much a cell gives away per step, and carry heat with the lava.
- Cool the lava every step, faster when thin and much faster in the sea. Below the solid temperature, add the lava to the ground and clear it, so flows build new land.
- Draw with ImageData scaled up: hillshaded green land, blue sea, and lava from dark red to yellow-white by temperature.

Once that works, make it beautiful:
- Turn new rock black and let it slowly turn green with age.
- Draw the island in isometric view: for each screen column, march through the heightfield from front to back and fill pixels above a running y-buffer.
- Add steam puffs where lava meets water, a soft glow around hot lava, and click to open new vents.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as lava tubes that keep flows hot, a long time-lapse, or a crust texture with glowing cracks.
PreviousChord OrbifoldTymoczko's geometry of chords: a twisted prism and a Mobius strip you can hear. NextFire and RegrowthA watercolor forest that burns and regrows into a power law, untuned.

Related visualizations

  • Basalt ColumnsNature Cooling lava cracks into columns that drift toward hexagons, on an isometric causeway.
  • Lava LampGenerative art Glowing blobs that merge and split like a lava lamp.
  • Voxel Diorama3D A floating voxel island with baked AO, sun shadows and a waterfall. Click to build.
  • Falling SandSimulation Sand, water, fire, lava and plants that all react with each other.
  • Glowing SurfFluids Moonlit waves break on a beach and the plankton in them flash electric blue.
  • BonfireFluids A campfire whose flames are a fluid simulation colored by blackbody physics.
  • Convection CellsFluids Water heated from below boils into mushroom plumes and rolling convection cells.
  • Volumetric CloudsNature Raymarched cumulus with silver linings, light shafts and drifting shadows.
  • Drying MudSimulation Wet clay dries and cracks into a lakebed of curling plates, primaries first.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs