xingor行歌®
ABOUT ME ↗︎
xingor 行歌BACK TO WORK ×
02 / REALTIME 3D / FLOCKING SIMULATION

Fish swarm simulation.

FISH SWARM / BOIDS · 2026

VISIT PROJECT ↗︎
FISH SWARM — FLOCKING SIMULATION / 2026 · 1080P
PROJECT
Fish swarm simulation.
TECH
  • Three.js
  • TSL
  • WebGPU

A school that thinks as one.

A school of fish looks like chaos, but it obeys three small rules: keep your distance, match your neighbours' heading, and steer toward the centre. The brief was to run that flocking behaviour across thousands of fish — every one of them an individual decision, every frame — while keeping the whole underwater scene alive in a browser at full frame rate.

The entire swarm lives on the GPU. Each fish is an instanced particle whose separation, alignment and cohesion are evaluated in WebGPU compute passes, and the pointer joins the simulation directly: sweeping through the school scatters it, and a click fires a shockwave that ripples outward through the flock before it re-forms. No JavaScript ever touches a single fish between frames.

The underwater look is where TSL earns its keep — volumetric light shafts falling from the surface, caustics shifting across the school, depth-graded fog that swallows the far water, and glints that catch the sun only when a fish banks the right way. The video you are watching is the scene running live, not a render.

NEXT PROJECTRubber duck particle physics.↗︎