SPH Modeling

This above video is a quick demo of an SPH simulation I worked on for a couple days! If you're not familiar with SPH, it's basically a technique for simulating water in a fast and efficient way, often for realtime purposes. It's gotten a lot of usage in video games and movies as a result.

How Does It Work?

SPH is a type of Lagrangian method - basically, it tries to directly simulate the particles, rather than taking a more "macro" view of the simulation. It's fairly simple, really: we calculate the density at every particle in the simulation, and doing some pretty simple math on that we calculate the force on each particle. It's very similar to the concept of sampling in Artificial Intelligence.

My Code

I basically wanted to write SPH from scratch, to show how simple the overall algorithm is. I wrote it in C++, and used OpenGL to generate visuals! I then use Python and OpenCV to create the video. Github here.