gl-pic-fluid
gl-pic-fluid copied to clipboard
Realtime, interactive 3D GPU PIC/FLIP fluid simulation
gl-pic-fluid
Realtime 3D particle-in-cell fluid simulation
Based on Robert Bridson's Fluid Simulation for Computer Graphics, 2nd ed.
Implements NVidia's "Screen Space Fluid Rendering for Games".
Requirements
- OpenGL >= 4.3
- cmake >= 3.10
- C++ compiler for version >= 17
Building
git submodule update --init --recursivemkdir buildcd buildcmake ..- Use generated build system
Running
cd buildbin/fluid
Controls:
- Left click and drag to interact with fluid
- Right click and drag to rotate the view
space- play/pauses- stepr- resetf- toggle screen space fluid renderingp- toggle particle visibility (for viewing grid)- PIC/FLIP blending controls
home- set FLIP 0.9end- set FLIP 0.0 (PIC)page up- increase FLIPpage down- decrease FLIP
- Grid visualization controls
g- toggle grid visualization1- cell type2- velocity3- divergence4- pressure solver A coefficients5- pressure
Known Bugs
- There is a lingering boundary condition bug which causes fluid to stick to positive direction walls.
- The stickiness is patched in the pressure update shader, but a bias in the fluid pressures remains.
- If fluid gathers in the +XYZ corner of the cube, it can cause the simulation to explode. I expect that this is related to or is a result of the previous bug.
- Press
rto restart the simulation if this happens
- Press
Development
- Simulation code is split across
src/Fluid.hppand*.cs.glslshaders inshader/ - Make sure to list new source files in CMakeLists.txt!