Feature Library

Breakable world

0.56 GPU · 1.07 CPU ms
A still of the Breakable world demo
Still
The live demo starts when it’s in view.Click to blast or strike · 1 2 3 pick impact, blast or ram · W A S D drive the ram box · V support view · drag to orbit

Walls that take ragged holes, buildings that come down, and rubble that stays.

What it costs a frame

0.56 ms
1.07 ms
GPU
0.56 ms
CPU, median
1.07 ms
CPU, 95th pct
1.46 ms
Draw calls
121
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.41–0.64, CPU 1.06–1.10 ms). What ran: Measured from the first frame, when the brick house is brought down whole (four blasts, a collapse, rubble, debris and dust); then a blast every 0.7 s round the block until three buildings have come down (collapses, rubble heaps, debris and dust), then resetting: five buildings, about 200 panes, 30 props, trees and rocks, a 2048 shadow map. At rest nothing is drawn. 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.561.071.46
apple · Apple A19 Proin a browser tab · 16 November 20261.850.403.02

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. Walls a player blows or drives through, with the hole cut in the mesh and in the collision
  2. Buildings that come down when enough of their walls are gone, leaving a heap you can walk over
  3. Windows that smash and doors blown in by a blast nearby
  4. Rocks, lamp posts, fences, crates and trees that break, topple or fall when pushed hard enough
  5. One place every source of damage reports to, so sound, effects and a server hang off one answer
  6. A debris field that costs a few draws however much has fallen

Pitfalls, in brief

  1. Whole geometry swapped for rubble in one frame (a heap laid as a building comes down, a wall redrawn with its hole) shows as a chunk appearing from nowhere.
  2. On a weaker GPU (harness tier medium or low) the demo draws a 1024 shadow map at low, keeps fewer debris pieces and dust puffs, and covers a collapse with fewer, larger puffs.
  3. A hole standing on the floor (a door, a breach through the floor) touches the face’s outline, and earcut will not take a hole that touches its outer ring: cut it into the outline as a notch (wallFace does), and leave the floor edge out of its lining.
  4. Holes on one wall must never overlap or touch, or the triangulation folds: merge every hole that comes within MERGE_GAP (0.15 m) of another, and of any door or window, until nothing more meets.
  5. Keep holes clear of the corners’ inner faces (CORNER, 0.12 m), and remember the inner face is shorter than the outer at an outside corner (mitred): a hole clamped to the outer face alone sticks through the inner face’s end.
13 more in brief
  1. Report a ram every step the body moves, and let a breach happen once: a blow inside a hole already there must leave the state unchanged (breachWall returns the same object), or each step cuts a new seed and the lining shimmers.
  2. Measure the support at waist height on the ground storey only.
  3. The vertex fold makes every instance run every vertex of its batch: keep only pieces of about one size and count in a batch (here chunks and shards; slabs and beams; mounds).
  4. An instanced mesh first drawn with no instances may never draw later ones (three r185 to r187): keep it hidden while empty, and draw every batch once with one instance during the warm-up so its pipeline and its shadow pass are built before the first collapse.
  5. Three hands a material’s positionNode to the shadow pass, so folded pieces cast no shadow of their neighbours; a custom shadow material must do the same or every instance casts its whole batch.
  6. A building that is falling is not a building any more: redraw it with the report that felled it before you start its fall (or it comes down without the hole that brought it down), then take it out of the takers (its state says fallen) and out of picking at once, and lay the heap and its ramp halfway down, not at the end, or a body walks into thin air for a second.
  7. Rams break through or are stopped; they never wear a wall or rock down.
  8. Panes and trunks take a blast falling straight from its centre; walls, stone and props take it whole within half the radius.
  9. Every random choice (a hole’s teeth, a heap’s pieces, a pane’s strength) comes from a key or a seed, never Math.random, so a server, a replay and every client cut the same holes and lay the same rubble.
  10. Broken edges (rimStrips) belong to the building: put them in an instanced mesh that is its child, so they lean and crumple with it, and lay them all again when its holes change; holes merge, so edges added piece by piece would be left floating where an old outline was.
  11. Give each puff a seed of its own and draw its ragged edge and shade from that, not from its place in the pool: puffs die out of order, and a seed by slot made every later puff turn and change shade each time one went.
  12. Dust sprites are turned to the camera with its right and up vectors as uniforms: update them on every frame the camera moves, not only when the dust does, or the puffs turn edge-on as you orbit.
  13. Rebuild a building’s geometry only when its harm changes (drainChanged), and on the same material: the new geometry reuses the pipeline, so a hole costs no compile.
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 driving playground showcase. Fully custom code.

Earcut (Mapbox), as three.js’s ShapeUtils.triangulateShape: the wall faces are triangulated with their holes through three; no code copied

FNV-1a (Fowler, Noll, Vo) and the MurmurHash3 finaliser (Austin Appleby): public-domain integer hashes behind the seeded holes, rubble and pane strengths

destructiondamagebreachwall holescollapserubbledebrisdusttriangulationearcutinstancingvertex foldtslsupport rulematerialsblastimpactramtopplefellingpure coreseededwebgpu

Near it in the frame