Presets
Playback
Parameters
Camera
Layers
Quality
Model check
The science
What is modelled
A swarm of fireflies drifting over a moonlit meadow. Each insect flies as a boid (separation, alignment, cohesion, wander, a soft boundary and a flight-height band over the terrain) and carries a flash clock. Fireflies that see a neighbour's flash nudge their own timing, the mechanism behind the synchronous chorus of some species. The glow you see is attenuated by distance and by the brightness of the sky, so the same swarm looks very different in a dark valley and under suburban sky glow. Fireflies are drawn about three times larger than real (about 12 mm).
Equations
- Phase oscillator (Kuramoto form):
dφi/dt = ωi + (K/ni) Σj sin(φj − φi), sum over the ni neighbours inside the perception radius,ωi = 2π/Ti; a flash starts when φ passes 2π. Order parameterr = |⟨eiφ⟩|. - Mean-field theory for a Gaussian spread σ of frequencies: critical coupling
Kc = 2/(π g(0)) = 2σ√(2/π); above it, r solves1 = K ∫ cos²θ g(K r sinθ) dθover −π/2..π/2 (blue line in graph 1, valid for all-to-all coupling). - Flash waveform
I(t) = I0 (e−t/τd − e−t/τr) / wmaxwith τr = 40 ms, τd = 180 ms (round illustrative values for the luciferin-luciferase rise and decay); peak att = τrτd ln(τd/τr) / (τd − τr). - Illuminance at the eye:
E = I/d². Visibility threshold:Eth = E0 (1 + B/B0)with sky luminance B, E0 = 10−7 lx, B0 = 10−4 cd/m². Apparent brightnessa = clamp(log10(E/Eth)/2, 0, 1); detection rangedmax = √(I/Eth)(graph 2).
Checks run in the page
- A 1500-oscillator all-to-all Kuramoto run at K = 2.5 Kc gives the order parameter predicted by the self-consistent mean-field equation.
- The flash waveform peak time, peak value and area match their closed forms.
- Detection range from bisection equals √(I/Eth); illuminance falls 4 times from 10 m to 20 m.
- Over 40 s of the real update step the boids never exceed the speed limit, stay inside the meadow boundary and inside the flight-height band.
Honest simplifications
Real fireflies of a species flash in a species-specific pattern and reset their clock by pulses rather than by a smooth sine coupling; the threshold law is a Weber-type simplification (a real eye adapts over minutes and the threshold depends on flash duration and colour); intensities and time constants are round illustrative numbers, not measurements of one species; there is no atmospheric extinction, no occlusion by grass and the swarm density is far higher than in most meadows. The coupling acts between neighbours within the perception radius, so the swarm synchronises in clusters first; the mean-field line only applies to all-to-all coupling.
What to try
- Set K to 0, then 0.7, then 1.6 and watch the order parameter and the phase histogram: random, clustering, one sharp peak.
- Widen the spread of periods to 0.3: the swarm cannot lock any more (K stays below Kc).
- Slide the sky luminance up: the detection range collapses from hundreds of metres to a few metres and distant fireflies fade.
- Use the Pond camera to see reeds and reflections, and the Swarm close-up to see the Blender-modelled beetles.