For my term paper at Federal University of Juiz de Fora (UFJF) I implemented the SPH (Smoothed-Particle Hydrodynamics) method to create fluid simulations. The implementation was written in C++ and was integrated into the Unity engine as a plugin (using C#).
The project allows the user to define the SPH system constants and to create animations in two or three dimensions, in real time. The fluid is represented by the Lagrangian form, and each particle is represented by a sphere.
There are different particle rendering options and some of them may be useful for analyzing fluid behavior, such as “density coloring” and “speed coloring”, which cause the particles to assume different colors according to the values of their physical properties.
Frames of a Dam Break simulation generated on Unity, using the “density coloring”.
Frames of a three-dimensional simulation generated on Unity using particle “speed coloring”.
Screenshot of a simulation where the user can rotate the entire scenario of the simulation.
More details about the project (including information about how the SPH method works, how the project was implemented and how it was integrated into Unity) are available in the monograph that can be accessed through this link.