0%

Sph Water Simulation

This repository is a course project of Physically-Based Simulation in Computer Graphics, ETH Zurich, Fall 2020.

The project is a collaborative work from Ge Cao, Xiao Wu, Mingyang Song.

The demo video is available at Youtube.

Features:

  • Particle-based fluid simulation with SPH method
  • Iterative SESPH
  • Coupling liquid simulation with rigid body (the wheel)
  • Dambreak scene & Waterwheel scene
  • Particles import & export in ply and cfg format
  • Multiple ways of visualization using OVITO, OpenGL/GLUT and blender
  • Surface reconstruction using splashsurf
  • Multithreading for accelerating simulation using OpenMP
  • Rendered with GPU accelerated ray-tracing using Cycles

Install & Run

The installation has only been tested on Ubuntu for now. The project is built with CMake. Before installation, please make sure CMake is installed. The project also depends on OpenGL/GLUT, please use the following command to install dependencies.

1
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev libx11-dev libxi-dev

To build the project, run the following command in the project folder.

1
2
3
4
mkdir build
cd build
cmake ..
make

Then, type ./SphWaterSimulation to run the simulation.

Render

For further rendering, we use splashsurf to reconstruct the liquid surface, and use blender to render the scene. When importing sequence of .obj files into blender, please refer to plugin stop motion obj for blender.

To install relevant packages, please refer to scripts/install_utilities.sh

After installation, use python3 ./scripts/construct_surface.py to construct liquid surface.

We also upload our blender file to Google Drive for future reference Link.

Config

The config file is SphWaterSimulation/constants.h. To disable visualization, change variable IF_VISUALIZE to false. To disable rigid body(the wheel), change kUseRigidBody to false.