Feature Library

Ring-buffer effects: streaks, smoke, flame, marks, spills and lightning

0.82 GPU · 0.30 CPU ms
A still of the Ring-buffer effects: streaks, smoke, flame, marks, spills and lightning demo
Still
The live demo starts when it’s in view.Pick an effect (keys 1 to 6) · click or tap the floor or the wall · move through low smoke · drag to orbit

Five effects that each live in a fixed ring of instance slots and never allocate in play.

What it costs a frame

0.82 ms
0.30 ms
GPU
0.82 ms
CPU, median
0.30 ms
CPU, 95th pct
0.47 ms
Draw calls
11
Weight
Moderate

Measured 13 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 0.82–1.03, CPU 0.21–0.48 ms). What ran: Measured with the show reel at a busy pace: an effect fired every 0.35 s in turn (streaks with forks, a smoke column, a flame stream and its burning spill, marks, a spreading spill, a lightning bolt), so all five rings and the bolts draw at once. About 100 to 300 puffs, 150 to 250 flame gobs and 60 streaks are alive at a time. 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 tool0.820.300.47
apple · Apple A19 Proin a browser tab · 16 November 20261.800.080.14
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20265.050.911.37

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
WebGPUNeeds WebGPU: current Chrome and Edge, Safari 26+, Firefox 141+ on Windows.
Your browser
Checking…Looking for WebGPU
Depends on
three.js 0.187.0No other packages

What it’s for

  1. Sparks, beams and arcs between two points
  2. Smoke columns, dust and exhaust that meet the ground softly
  3. A burner or flame jet that lands where it is aimed
  4. Marks that stay: scorch, paint, prints, skids, soot
  5. Pools that spread across a floor
  6. Lightning in a storm, or on cue
  7. Effects that must never hitch a frame

Pitfalls, in brief

  1. Write instances between frames and call update(dt) before the render: the slots written since the last update upload then, as one range or two where the ring wrapped.
  2. The ring never grows: when it is full, the newest write takes the oldest slot, alive or not.
  3. Every draw is hidden while nothing in it is alive, and compileAsync skips hidden objects: call warm(renderer, camera, scene) (RingEffects) at load, or the first puff or spark builds its pipeline then, a visible stall.
  4. A batch first drawn with no instances is not a draw: instanceCount never goes below 1 (an empty slot is all zeros and draws nothing), and warm gives the spills one instance for the compile.
  5. TSL varyings must be worked out where every kind reaches them: a varying that shares a node first read inside one kind’s branch (the fork’s) read 0 for every other kind, and arcs, beams and wakes never faded.
7 more in brief
  1. A dead puff or gob collapses to its centre in the vertex stage.
  2. Soft edges fade by height over the ground under each puff (floorAt, asked as it is born and where its drift will end), not by the depth buffer: a multisampled depth cannot be handed to a material.
  3. A moving streak only fades once its head lands: one aimed kilometres off would hang in the sky.
  4. A flame gob is let go at the end of its life, not where it hits: give it the life gobLanding (or your own trace of gobAt) says it meets something in.
  5. Decals: setLimit changes how many stay and clears them.
  6. The lightning light reaches what takes point lights; give it one light kept in the scene (intensity 0 when out), as adding a light later rebuilds every lit material.
  7. Color.set() already converts an sRGB colour to linear: converting it again (convertSRGBToLinear) darkens it.
12 pitfalls in full, the hook-up guide, the module source and its tests come with the part.

Where it comes from

From HaTac. Fully custom code.

Ken Perlin, improved noise (2002): The arcs’ wander, the smoke’s edges, the flames’ tongues, the marks’ shapes and the spills’ shores read three.js’s MaterialX noise nodes (mx_noise_float, mx_fractal_noise_float, mx_cell_noise_float): imported from three, not copied.

PCG random (Melissa O’Neill): Each mark’s seed is three’s TSL hash node of its slot, a PCG hash: imported from three, not copied.

Chris Wellons, hash-prospector (lowbias32): The strike hash’s finishing steps are his lowbias32 constants (public domain), after MurmurHash3’s multipliers (Austin Appleby, public domain).

ring bufferinstancingno allocationvfxstreakslightningsmokesoft particlesflamedecalsliquidclosed formtslthree.jsadditiverests when idle

Near it in the frame