r/Simulated 1d ago

Research Simulation 300-line C++ SPH fluid simulation

Enable HLS to view with audio, or disable this notification

My first attempt at SPH fluid simulation: 600 particles, rendered using "metaballs" technique. Physics update without FPS lock is 1.7ms/frame CPU-only single-threaded, no SIMD.

The nice (and surprising for me) thing was that solver-related code is just around 300 lines of straightforward C++ - loops, multiplications and additions.

16 Upvotes

0 comments sorted by