Feature Library

Swarm that writes words

1.42 GPU · 0.10 CPU ms
A still of the Swarm that writes words demo
Still
The live demo starts when it’s in view.Click to form the word or scatter it · the pointer parts the flock · Enter toggles

Birds, butterflies, fireflies, drones or darts that flock freely on the GPU, then each fly to their own point of a word or a shape, hold it and let go again.

What it costs a frame

1.42 ms
0.10 ms
GPU
1.42 ms
CPU, median
0.10 ms
CPU, 95th pct
0.16 ms
Draw calls
0
Weight
Moderate

Measured 11 November 2026 on 13th Gen Intel(R) Core(TM) i9-13900H, Chrome 157, 1920×1080 at 1×. 600 frames × 3 rounds, median kept. What ran: Measured at the default 2,000 birds over the sky: one compute pass (every agent against every other, through workgroup memory) and one instanced draw, timed with timestamp queries. The bench cycles itself through flocking, forming the word and letting go. Phones: tiers are being measured next.

On every machine it was measured on
MachineGPU msCPU msCPU p95
unknown GPU · 13th Gen Intel(R) Core(TM) i9-13900Hreference · measuring tool1.420.100.16
apple · Apple A19 Proin a browser tab · 16 November 20266.200.180.24
Intel Arc 140V (Xe2-LPG) · Intel Core Ultra 7 258Vin a browser tab · 15 November 20261.440.210.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
WebGPU or WebGLWebGPU where there is one, WebGL2 where there is not.
Your browser
Runs hereNo WebGPU needed
Depends on
NothingNo other packages

What it’s for

  1. Hero and splash text
  2. Loading and welcome screens
  3. Announcing a score or a result
  4. Logos that assemble
  5. Ambient background life

Pitfalls, in brief

  1. Every agent looks at every other: the cost grows with the square of the count.
  2. Read one buffer and write the other (ping-pong): stepping in place lets some agents see their neighbours’ new places and others the old ones.
  3. formTo reads the agents back once (a frame or two late) to pair them with targets.
  4. Draw into an opaque target: fireflies are added light, and added light over a transparent canvas is undefined.
  5. The uniforms are written to the queue in step(): step once per submit, or the second write wins for both.
3 more in brief
  1. Text is drawn to a canvas, so wait for document.fonts.ready before the first textPoints, or the word comes out in a fallback font.
  2. Under reduced motion, slow them, calm the wander and release without a burst.
  3. Without WebGPU, createSwarmGL (swarm-gl.ts) flies the same flock on WebGL2: it needs float colour targets (EXT_color_buffer_float) and returns null without them.
8 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.

Craig Reynolds, “Flocks, Herds, and Schools” (1987): Separation, alignment and cohesion: the boids rules the flock follows.

Mark Jarzynski and Marc Olano, “Hash Functions for GPU Rendering” (2020): The PCG hash behind the wander and the sky’s stars.

boidsflockingcomputeraw webgpuwgslinstancingtext to pointsworkgroup memoryglslwebgl2 fallback

Near it in the frame