Experiment #06 · November 2026

Murmuration

At dusk, thousands of starlings wheel above a lake before settling for the night. The flock swells, folds, tears apart and closes again, with no leader and no plan. Come closer: you are the falcon.

Move your mouse across the sky: the birds flee the falcon. Click, and it dives at them.Touch the sky: the falcon dives at the flock.

The idea

In autumn and winter, starlings gather in the evening above their roost, a reed bed or a copse, sometimes by the tens of thousands. Before settling, they fly together for long minutes: this is a murmuration. No bird leads it.

Each starling only watches its nearest neighbours, six or seven according to measurements made in Rome in 2008, and matches its flight to theirs: same heading, same speed, close but not touching. From these local rules comes the shape of the whole, folding and unfolding tens of metres away from any single bird.

When a falcon attacks, the nearest birds swerve sharply and their neighbours copy them: a dark wave sweeps through the flock, from bird to bird. This is probably why murmurations exist: among thousands, each bird is less likely to be caught.

How it works

The birds aren’t compared one by one, which would mean hundreds of millions of pairs every frame. The sky is cut into a grid of 4-metre cells: each bird signs into its cell, then each occupied cell works out, just once, the heading, speed and centre of its birds and of its six neighbouring cells. A second, finer grid measures density every 1.5 metres: each bird slides down its slope, away from crowded spots.

On top of that come a slow, swirling air current, density waves rippling through the flock, and two invisible points drifting across the sky, each pulling half of the birds: the flock splits, stretches and joins up again. The falcon is a ray from the eye through the pointer; a bird it touches panics, and its panic spreads to its neighbours.

The whole flock is drawn in a single call to the graphics card, along with its reflection in the lake. Each bird is a small twelve-vertex mesh: its heading and wingbeat are worked out by the graphics card from its velocity.

Rendering
WebGL 2, no library
Birds
14,000 (7,000 on mobile)
Grids
24,000 cells of 4 m, 570,000 of 1.5 m
Simulation
three passes per frame

Based on the Murmuration demo for LittleJS, Frank Force’s engine (MIT licence). The sky, the lake and the falcon are ours.

← All experiments