This code was written for the semester project of the Physically Based Simulation course in 2015 at ETHZ. The goal was to implement a basic SPH fluid simulator in C++11. Ideas for the implementation are taken from the following papers:
- [1] Weakly compressible SPH for free surface flows
- [2] Predictive-Corrective Incompressible SPH
- [3] Boundary Handling handling and adaptive time-stepping for PCISPH
- [4] Versatile Rigid-Fluid Coupling for Incompressible SPH
- [5] Versatile Surface Tension and Adhesion for SPH Fluids
- [6] Reconstructing Surfaces of Particle-Based Fluids Using Anisotropic Kernels
The following features have been implemented:
- Interactive GUI with basic OpenGL visualization
- JSON based scene description
- Wavefront OBJ support
- Index-sorted uniform grid for neighbour search
- WCSPH [1] and PCISPH [2] solvers
- PCISPH with adaptive time-stepping [3]
- Boundaries using boundary particles [3], [4]
- Create boundary particles for boxes, spheres and arbitrary meshes
- Surface tension forces [5]
- Fluid mesh generation using marching cubes
- Isotropic kernel
- Anisotropic kernel (only works partially yet) [6]
- Cache system to cache particles and meshes
- Render application using either OpenGL visualization or SmallLuxGPU4
a few other videos are here:
The code was tested only on OSX and Linux, but should be easy to get to work on Windows as well. To compile the project on OSX/Linux use the following procedure:
git clone --recursive https://github.com/westlicht/pbsproject.git
cd pbsproject
mkdir build
cd build
cmake ..
make -j8
Now you can start the viewer using:
./viewer ../scenes/bowl.json
Part of the framework was derived from the Nori codebase written by Wenzel Jakob. In addition, the following libraries have been used: