Real-time fluid simulation using Smoothed Particle Hydrodynamics (SPH) — the same numerical method used in NASA astrophysics simulations and Hollywood VFX to compute realistic fluid dynamics.
Each particle carries pressure, density, and velocity. Interactions with nearby particles approximate the Navier-Stokes equations, producing viscosity, pressure gradients, and surface tension behaviour.
Click or drag on the fluid to push it. Use the sliders to change gravity, viscosity, and particle count. Try increasing particle emission from the top to simulate a waterfall.
SPH was originally developed in 1977 by Lucy and Gingold to simulate galaxy collisions in astrophysics. The same method now runs in real-time on modern GPUs to simulate water in video games.