Bird Flock — the audio-reactive murmuration
The Bird Flock scene simulates a murmuration: the spectacular natural phenomenon where thousands of starlings fly together in fluid, undulating formations. 2,500 simulated birds follow the classic rules of the Boids algorithm — and your music disturbs and amplifies their behaviors.
The Boids algorithm
Each bird is governed by three simple rules which together produce complex emergent behaviors:
Separation — each bird moves away from neighbors that are too close, to avoid collisions. Alignment — each bird steers toward the average direction of its neighbors. Cohesion — each bird moves toward the center of mass of its neighbors to stay in the group. These three simple forces are enough to create the graceful undulations of a real murmuration.
Musical reactivity
Music disrupts this system in several ways. Bass increases the cohesion force: the flock compresses and densifies during beats, like a school of fish tightening in the face of a predator. Treble increases the separation force: the flock stretches and frays, birds scattering momentarily before regrouping. Mids modify the overall flight speed.
Bird colors vary according to their instantaneous speed: slow birds near the group stay cool blue, while fast birds on the periphery turn bright cyan and white.
Technology
3D Boids simulation for BOID_N = 2,500 agents. Each frame: separation (r < SEP_DIST), alignment and cohesion (r < COH_DIST) forces computed via optimized double loop. Velocities are normalized and clamped (MIN_SPD, MAX_SPD). Positions are sent to GPU via DynamicDrawUsage BufferGeometry. HSL vertex colors based on speed. Additive blending for the luminous effect.