Skip to content

About

A reproduction of Jos Stam's Stable Fluids (SIGGRAPH 1999) paper.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SF_Reproduction — 3D Stable Fluids Simulation

A 3D fluid simulation reproducing Jos Stam's Stable Fluids (SIGGRAPH 1999) paper.
Built with ImGui + OpenGL 3.3, featuring volume ray-marching and full simulation pipeline under both periodic and fixed boundary conditions.

Release

Compiled executable files for windows at here.

Reference Paper

reference/stam-stable_fluids.pdf

Simulation Pipeline

Each timestep follows the paper's order:

AddForce (buoyancy) 
→ Advect (semi-Lagrangian, MAC grid)
→ Diffuse (implicit viscosity, Jacobi iteration)
→ Project (pressure Poisson: FFT for periodic, Jacobi for fixed BC)
→ Advect density through divergence-free velocity

Features

  • MAC staggered grid: velocity on faces, density/pressure at cell centers
  • Semi-Lagrangian advection: trilinear backtracing
  • Periodic BC: spectral Poisson solver via 3D FFT (self-implemented radix-2 Cooley-Tukey)
  • Fixed BC: Jacobi iteration Poisson solver (replacing FISHPAK from the paper)
  • Volume rendering: GPU ray-marching, rainbow density colormap, dual-light shading
  • Interaction: left-click injects force + smoke, right-drag orbits camera, WASD to move
  • Full UI controls: grid resolution, timestep, viscosity, buoyancy, dissipation, diffusion, etc.

Build

Requires CMake + OpenGL 3.3 + glfw3.

cd build
cmake .. -G "MinGW Makefiles"
mingw32-make
./SF_Reproduction.exe

For better performance, build in Release mode:

cmake .. -DCMAKE_BUILD_TYPE=Release -G "MinGW Makefiles"
mingw32-make

Controls

Input Action
Left-click drag Inject smoke force
Right-click drag Rotate camera
WASD Move
Scroll Zoom
UI panel Tune all parameters

Acknowledgements

  • Jos Stam, Real-Time Fluid Dynamics for Games, SIGGRAPH 1999
  • This project was developed with assistance from DeepSeek V4

About

A reproduction of Jos Stam's Stable Fluids (SIGGRAPH 1999) paper.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages