Shoal
Looking up through open water at a school of jacks circling beneath the sun, then travelling, drifting apart and closing ranks again while light shafts fall through the swell.
GPU Schooling Simulation · 2026
How it is made
Each fish only reacts to the fish around it - keeping its distance, matching their heading, closing gaps - so the milling ring, the turns and the splits are emergent. Neighbours are found by bitonic-sorting the school on the GPU by the Morton code of each fish's cell every few frames, which puts neighbours in space next to each other in memory; state lives in that sorted order and carries each fish's identity. Fear is passed fish to fish, so a scare travels across the school as a wave of darting, rolling fish whose silver flanks catch the sun, and only a few informed fish know where the school is heading. The light follows the physics: a periodic wave heightfield refracts the sun, a refracted grid traced separately for red, green and blue gives colour-fringed caustics from the change in its area, and those caustics are projected down through the volume as the god rays, darkened beneath the school by its own shadow map. Seen from below, the surface refracts the sky through the same waves near the sun and mirrors the water beyond the critical angle; every path is absorbed per channel, and the light drifts on its own from midday through golden hour to dusk. A tuna makes the occasional pass through the school, marine snow sparkles in the shafts, and depth of field, bloom and filmic tone mapping finish the frame.
Techniques: GPU boids · Bitonic sort · Morton-order neighbours · Fear propagation · Spectral caustics from refraction · Volumetric light shafts · Surface refraction and total internal reflection · Spectral absorption · Bloom and filmic grade
This interactive WebGL sketch requires JavaScript.