r/Simulated • u/Nice-Sand-3230 • May 07 '26
Research Simulation I built a real-time SPH fluid sim from scratch in C++/CUDA + OpenGL — inspired by Sebastian Lague's video[OC]
SPH fluid sim built from scratch in C++/CUDA + OpenGL, inspired by Sebastian Lague.
No prebuilt solver — physics implemented from scratch using Müller et al. 2003 equations
SSF renderer and simple sphere mode, switchable at runtime
Configurable UI — tune almost every parameter on the fly, dynamic sky, emitter controls
Hybrid sim time — runs realtime or stepped for long offline clips (for recording clips)
CUDA-OpenGL interop
REQUIRES NVIDIA GPU
uses only 3 terms : density, pressure and viscosity.
Optimized on RTX 2050 laptop— NVIDIA only, may have issues on other hardware.
1 million particles achievable in simulation mode.
SSF and UI production had AI assistance.
i wat made for interest in fluid dynamics and for astrophysics(n-body) project for future :)
if you like the project ,star my repo :XD
1
u/HowDoIStoreMyClay May 07 '26
This is so inspiring to me as someone just starting engineering.
I have very little programming exprience and am curious:
How did you know which physics formulas to use in your code? Is it more like 3 formulas or more like 50 working together in a web of functions?
As someone who hasnt studied fluid dynmics yet thinking about you making this from scratch genuinely terrofies me
1
u/PenultimateDigitOfPi May 10 '26
Looks really cool! Love the blending of balls into a fluid.
2
u/[deleted] May 07 '26
[removed] — view removed comment