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
GPU
1.32 ms
CPU
1.09 ms
02468101216.7 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.
apple · Apple A19 Proin a browser tab · 16 November 2026
10.7
0.12
0.32
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 2026
9.31
1.03
1.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
A torch, a campfire’s ember or a lightning strike setting a game’s plants alight
A wildfire running through a wood, crown to crown, with the wind
What is left after a fire: ash, charred heaps, stumps and logs, dead standing trees
Rain and downpours putting fires out, plant by plant
A map-scale fire model feeding the plants near the player, and the plants reporting back
Burning crowns drawn as a fluid near the camera and as cheap flames far off
Warm firelight on the ground, trunks and smoke without a light object per fire
Pitfalls, in brief
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.
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.
Never use Math.random for the fire: pass a seeded random.
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.
Work the fires’ light out per vertex on anything large or dense on screen.
13 more in brief
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.
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.
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.
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.
Keep the char’s glowing front thin and its embers a deep orange.
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.
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.
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.
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.
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.
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.
A lightning strike must not strobe: one soft brightening of the sky that fades, and none at all under reduced motion.
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.