Position Based Fluids simulation and surface reconstruction for the CS284A final project.
- Position Based Fluids (PBF) solver with an interactive OpenGL/NanoGUI viewer.
- Optional CUDA path for faster simulation and large particle counts.
- Marching cubes surface extraction for mesh reconstruction.
- Headless mode with particle cache output for offline rendering.
Quick start (see docs/BUILDING.md for details):
- Initialize submodules:
git submodule update --init --recursive - Configure and build:
mkdir build && cd buildcmake ..cmake --build . --config Release
CUDA build (optional):
cmake -DBUILD_CUDA=ON -DCMAKE_CUDA_FLAGS="-arch=sm_60" ..
Requirements:
- CMake 3.9+
- C++17 toolchain
- OpenGL
- CUDA 10.2 (optional, for
fluidsimCuda)
Executables are placed in the repo root after building.
CPU viewer:
./fluidsim -f scene/fluid.json
Headless CPU run with particle cache output:
./fluidsim -n -s 5 -p output/frames -f scene/fluid_large.json
CUDA run (headless):
./fluidsimCuda -s 5 -p output/frames -f scene/fluid_large.json
Common options for fluidsim:
-f <path>scene JSON (seescene/)-r <path>project root (must containshaders/Default.vert)-a <int>sphere latitude segments-o <int>sphere longitude segments-p <path>output particle folder-i <path>input particle folder (replay)-ndisable window (headless)-s <int>duration in seconds (headless mode)
Options for fluidsimCuda:
-f <path>scene JSON-r <path>project root-p <path>output particle folder-s <int>duration in seconds
Note: the CUDA path currently supports plane collisions only.
Scene configurations live in scene/ (for example scene/fluid.json,
scene/fluid_million.json). Use -f to switch between them.
docs/BUILDING.mdfor build notesdocs/PROPOSAL.md,docs/MILESTONE.md,docs/FINAL.mdfor project writeups