Fluid Simulation

Completed | October 2023 |
Summary
This smoothed particle hydrodynamics simulation on the CPU served as one of my first C++ projects. All rendering - except for the UI which uses Dear ImGui - is done exclusively with OpenGL.Journey
For years prior to this project I'd been fascinated by fluid simulations, beginning when I discovered GitHub user paveldogreat's which quickly became a popular way to waste time at my high school.Previous experience with simulating gravitational bodies led to the creation of a particle simulation where each particle repelled all others (this was around 2022 and I used Love2D). Because I was 15 I had no clue about spatial partitioning optimizations or calculus, so the project was inevitably a laggy and unstable mess which sometimes resembled a fluid right before crashing.Later research led to the discovery that this particle simulation approach to fluid simulation had a name (smoothed particle hydrodynamics) and that a lot of the problems I'd encountered had already been solved. This ultimately introduced me to the idea of time complexity and how it can be improved, as well as some famous papers like Jos Stam's. From this, I ended up creating another simple particle gravity simulation which took advantage of the quad tree data structure - my first ever C++ project.Finally, Sebastian Lague released his awesome Coding Adventure which revived my interest in fluid simulations and led to this project. If revisited, I'd be interested in moving particle calculations from the CPU to the GPU - an addition which I only partially implemented with compute shaders after suffering through OpenCL and is key for good performance.It's also worth noting that this project began my interest in game engine engineering and architecture, which is probably evident with my use of strangely abstract classes like GameObjects and Scenes.