Particle-Based Fluid Simulation

Опубликовано: 19 Февраль 2026
на канале: John Turner
654
13

A 3D particle-based fluid simulation with 100,000 bodies. Each particle pair is connected by a spring that either contracts or expands based on their distance. Particles have a softening radius that dictates their maximum interaction distance. The resulting fluid is compressible and is more analogous to a heavy gas than a liquid, though several dynamics are ignored in this simulation.

Written in HLSL.

The boundary conditions are a set of simple clamps and reflections about 5 planes that form an infinitely tall box with a slanted floor. Gravity is handled outside of the particle-particle interaction kernel in a function that can be expanded to include arbitrary vector forces acting on the entire system or subsets of the system.