/real-time-sph

Real-Time SPH!

Primary LanguageC++MIT LicenseMIT

Check out the demo video!

Implementation of real-time smoothed-particle hydrodynamics (SPH) with screen-space rendering for my 6.837 (computer graphics) final project (from 2017). Uses a pipeline similar to Zhang, but for the GPU. SPH physics is based on Pirovano, uniform grid collision detection on Le Grand and screen-space rendering on Green.

Requires a CUDA-enabled GPU with compute capability 2.0 or higher and OpenGL 4.2 or higher. Currently only builds on Linux with cmake. Requires glm 0.9.9-a2. Only tested with CUDA 9.0, though it might work with older versions. Simulates 3000 particles at about 300 fps on a NVIDIA GeForce GT 750M.

More information provided in the writeup.

Usage:

  • Escape quits the program.
  • Mouse moves the camera direction.
  • WASD/Shift/Space moves the camera position.
  • E frees the mouse from the window.
  • Period ('.') pauses/unpauses the simulation.
  • Comma (',') pauses/unpauses the box rotation.
  • V makes the box rotate quickly.
  • B makes the box rotate slowly.
  • G resets the box rotation velocity.
  • Z changes the smoothing mode.
  • X shows the depth map.
  • C disables rendering.
  • R and T changes the Z threshold for particle rendering.