Feature Library

Plants that burn and leave remains

1.32 GPU · 1.09 CPU ms
A still of the Plants that burn and leave remains demo
Still
The live demo starts when it’s in view.Hold the pointer on a plant to touch the torch to it · call lightning · drag in Look, or right-drag, to turn the view

Plants that catch, burn and leave something behind, one at a time by a stable key.

What it costs a frame

1.32 ms
1.09 ms
GPU
1.32 ms
CPU, median
1.09 ms
CPU, 95th pct
2.03 ms
Draw calls
18
Compute passes
1
Weight
Moderate

Measured 15 November 2026 on RTX 4060 Laptop, 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept (rounds ranged GPU 1.32–1.32, CPU 0.53–1.09 ms). What ran: Measured from a lightning strike on frame one: the upwind tree of the copse catches in its crown, with a 2.2 m/s wind and the crown run on, stepped a 60th of a second a frame (so the uncapped run burns as at 60 Hz). By the measured frames the fire has run into the neighbouring crowns: the nearest as the fluid box (36 × 46 × 36 cells, 56 ray steps), the rest with flame licks, embers, glows and smoke, the warm light of eight fires on every material, and the fire stepped on the CPU four times a second. The preview is posed: the copse ablaze in the crowns, held still. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
RTX 4060 Laptop · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool1.321.092.03
apple · Apple A19 Proin a browser tab · 16 November 202610.70.120.32
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20269.311.031.81

Bars against one 16.7 ms frame. A browser-tab run is timed in a visible tab without the tool’s scripted input, so read it as close, not exact.

What it needs

Renders with
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
three.js 0.187.0No other packages

What it’s for

  1. A torch, a campfire’s ember or a lightning strike setting a game’s plants alight
  2. A wildfire running through a wood, crown to crown, with the wind
  3. What is left after a fire: ash, charred heaps, stumps and logs, dead standing trees
  4. Rain and downpours putting fires out, plant by plant
  5. A map-scale fire model feeding the plants near the player, and the plants reporting back
  6. Burning crowns drawn as a fluid near the camera and as cheap flames far off
  7. Warm firelight on the ground, trunks and smoke without a light object per fire

Pitfalls, in brief

  1. Step the fire a few times a second, not every frame (TICK, 0.25 s): its phases, catching, spread and rain are all coarse, and a step touches every burning plant and asks the host for what is near.
  2. Key every plant by something stable (its chunk and placement, not its index in a rebuilt list): what a fire left must find the same plant again after the world is rebuilt or streamed back in, and a spent plant must never catch again.
  3. Never use Math.random for the fire: pass a seeded random.
  4. Write a plant’s look to its row only when the fire’s step shows it, and send only the rows written (BurnRows.flush): a copse is hundreds of plants, and their rows change four times a second at most.
  5. Work the fires’ light out per vertex on anything large or dense on screen.
13 more in brief
  1. Leaves take their burn’s noise from the vertex stage too (burnNoise into burnSurface’s coarse): a leaf card is a few pixels to a few hundred, and four noises per pixel of a burning crown, with overdraw, were most of its cost.
  2. Light the flames where the char is creeping, on the plant’s own stems and leaves (edgePoint), not at random in a fixed shape round it: flames placed in a ball round a bush or at a flower’s head look like candle flames stamped on the plant.
  3. Split each flame into smaller tongues anchored where they were lit, growing upward and leaning with the wind: a whole lick that flies up off the plant reads as a sprite.
  4. A WGSL function cannot take a parameter called from (a reserved word), nor several other plain words; the CPU interpreter in the tests accepts them, so a name that passes there can still fail on the GPU.
  5. Keep the char’s glowing front thin and its embers a deep orange.
  6. A plant’s draw may use eight vertex buffers: four for the vertex (put the leaf flag in the colour’s fourth channel), the instance matrix, the row, the fall row, and one more.
  7. A box of fluid fed by whole crown ellipsoids reads as a soft glowing ball: give it tongues (a feed and detail noise stretched upward, more contrast, a later start to the glow and a thinner hot core) so flames lick up out of the crown, and hand a falling crown to the licks, since the box does not turn with the tree.
  8. The fluid costs by how much of the screen its box covers: one box, on the biggest fire near the camera, smaller than a showcase’s, the rest with licks.
  9. Swap a felled tree for its stump and log only once its crown’s flames are out, under a puff of sparks and ash, and lay the log along the fallen trunk’s axis (remainsOf does), or the branches vanishing mid-fire reads as a pop.
  10. An instanced mesh first drawn with no instances may never draw later ones (three r185 to r187): keep each remains batch hidden while empty, and show each once during the warm-up (showAll) so its pipeline is built before the first remains appear.
  11. Wetness is the ground’s, not only the rain: it rises fast with the rain and dries slowly after, so a fire just put out does not flare again the moment the rain stops.
  12. A lightning strike must not strobe: one soft brightening of the sky that fades, and none at all under reduced motion.
  13. A sky drawn first with depth writes off shades every pixel (about a sixth of the frame on an Intel Iris Xe): draw it after the ground and plants and the depth test skips what they cover.
18 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac, and in the garden walk showcase. Fully custom code.

Tommy Ettinger, mulberry32 (public domain): The seeded random numbers the fire, the copse and the particles are drawn with (`seeded` in plant-fire.ts).

Glenn Fowler, Landon Curt Noll and Kiem-Phong Vo, FNV-1a (public domain): The key hash behind each piece’s own turn and shape (`keyNoise` in remains.ts), with a final multiply–xorshift mix.

Mark Jarzynski and Marc Olano, Hash Functions for GPU Rendering (2020): The PCG hash the char’s noise is built on (`pcg` in char-front.ts), the same bits on the CPU and the GPU.

Jos Stam, Stable Fluids (1999): The fluid crowns step the stable-fluids scheme (fire-volume.ts, from the library’s fluid-fire). The algorithm, not code.

firewildfirecpu twinchar frontvegetationfoliagetreesbushesflowersburningcharemberssmokeashremainsfellingrainwindcrown firestate machineseededdeterministicinstancinginstance rows

Near it in the frame