A practical guide to simulating fluids, sand, and ice on the GPU.
Smooth Particle Hydrodynamics (SPH) is a way to simulate fluids by modeling them as a collection of particles that push and pull on their neighbors. If you've seen a flocking simulation, the idea is similar: each particle follows simple local rules, and complex behavior emerges from their collective interactions.
This series builds intuition for SPH step by step. We start with the basic idea of particles influencing their neighbors, layer on forces like pressure and viscosity, move the computation to the GPU with WebGPU, and then extend the system to simulate materials beyond water.
How particles estimate density and exert pressure and viscosity forces on their neighbors.
Spatial hashing, WebGPU compute shaders, and scaling to tens of thousands of particles.
Springs, friction, and temperature to simulate sand, ice, and elastic materials.
A full interactive sandbox combining all the pieces. Choose materials, place emitters, and paint forces.