Feature Library

Baked GPU crowd

1.07 GPU · 0.71 CPU ms
A still of the Baked GPU crowd demo
Still
The live demo starts when it’s in view.Click the plaza to call the crowd over · drag to orbit

Thousands of animated figures for the price of a few draws.

What it costs a frame

1.07 ms
0.71 ms
GPU
1.07 ms
CPU, median
0.71 ms
CPU, 95th pct
0.90 ms
Draw calls
6
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.88–1.29, CPU 0.71–0.88 ms). What ran: Measured with 4,000 figures in the bake, two kinds (near and far), shadows on: they wander, and every 6 s the crowd is called to a point or scattered, so clips switch and cross-fade throughout. 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.070.710.90
apple · Apple A19 Proin a browser tab · 16 November 20267.572.343.28
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20267.931.942.33

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. Crowds in a stadium, a square or a festival
  2. Herds, flocks on the ground and other far animals
  3. Background people in an architectural walkthrough
  4. Armies, queues and audiences in a strategy game or a simulation
  5. Far versions of characters that are posed live up close
  6. Many copies of an animated machine or prop

Pitfalls, in brief

  1. Without WebGPU, pass textures: CrowdBatch.needsTextures(renderer) (after renderer.init()): three’s WebGL2 backend cannot read the two storage buffers at computed indices in the vertex stage (the figures simply do not draw, with no error), so the bones and records go into float DataTextures instead.
  2. Blending two baked phases blends matrices, not rotations: a limb that turns far between bins shrinks a little in between.
  3. A cross-fade blends two whole poses the same way: keep it short (0.25 s) so the in-between never shows.
  4. Never an instance count of 0 (three r185 WebGPU: a draw first made empty never draws later instances).
  5. The batch’s meshes are never frustum culled (their bounds would be one figure’s at the origin): cull the figures yourself before place, and keep the batch out of your own bounds checks.
5 more in brief
  1. Build the shaders ahead: batch.compile(renderer, camera, scene) shows every kind for one compile in the renderer’s one queue.
  2. Moving clips play at speed / cycle so the feet stay planted: give each moving clip the distance one cycle carries the body (cycle), or figures moon-walk at any speed but the one the clip was made at.
  3. What a bake leaves out: anything that is not the clip, such as heads that turn to look, feet fitted to uneven ground (tilt the whole body with tilt instead), and reactions.
  4. Every bake in one batch needs the same number of bins; bakes with fewer bones are padded to the widest with identity matrices (no vertex may be weighted to a padding bone).
  5. The bake reads the bones’ world matrices: a pose function must set every bone it moves in every clip (a bone left turned by the clip before is baked turned).
10 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.

Jarzynski and Olano, Hash Functions for GPU Rendering (2020): The PCG hash the demo uses for its figures’ colours and wandering.

crowdinstancingskinningvertex animationanimation bakingbone matricesstorage bufferscross-fadelevel of detailcompileAsynctslwebgputhree.jsno dependencies

Near it in the frame