Real-Time Visual Simulation of Smoke on the GPU
by Muhammad Karim
General Configurations:
   # Development Platform: Windows 7 x64, Visual Studio IDE, Debug+Release build
   # Development Platform: Linux x64, Code::Blocks IDE, Debug+Release build
   # Used OpenFrameworks library v0.061
   # CPU: Intel Core2Duo 2.24 GHz
   # Graphics Hardware: ATI Mobility Radeon HD 3470 (OpenGL 2.1/GLSL 1.20)
-
Abstract:
This is a project implementing a numerical smoke simulation technique for computer graphics applications.
This project particularly implements the work done by [Fedkiw et al. 2001] applicable in real-time rendering on the GPU.
This method utilizes physical characteristics specific to smoke in order to design a numerical method that is fast and
efficient in relatively coarse grids typically used in computer graphics applications. The simulation uses the incompressible,
inviscid Navier-Stokes equations for fluid flow with the difference that the viscosity term is left out which is more appropriate
for gas modeling in most practical situations and less computationally intensive for real-time applications.
I have used Semi-Lagrangian advection technique described in [Stam 1999] which ensures that fluid grid advection steps are
unconditionally stable at each time step. I have added two types of automatically calculated forces based on the velocity field
and smoke properties (namely quantity and temperature). One is a buoyant force calculated from the velocity field,
and the other one is a force computed by using the vorticity confinement technique described in [Fedkiw et al. 2001]
to add back the small scale rolling features in smoke. Finally in each time step a projection step on the velocity field is
applied to ensure that the field is divergence free, which is based on the Helmholtz-Hodge Decomposition theorem.
This step requires a good Poisson solver to compute the pressure field and I have used Jacobi iterations which is simpler to
implement on the GPU and very fast over several iterations to convergence. I also considered some basic boundary conditions
on the edges of the 3D grid to ensure the simulation is correctly computed within the confines of the defined grid.
-
Volume Rendering:
I have used the half-angle slicing algorithm [Kniss 2003] for rendering which is a nice volume rendering technique that generates soft shadows.
The slicing algorithm is implemented in a vertex program which is described in the book [Engel et al.]. The book also had an intuitive
description of the half-angle slicing technique. And I have also found the GPU Gems article [Harris] extremely helpful in the early
stages of implementation.
-
Results
This image compares a state in the smoke simulation without and with self-shadowing (using the half-angle slicing technique)
Images from higher resolution 128x128x128 grid (non-interactive), notice the vortices are more apparant in high-res grids.
A 2D slice showing the swirly effect of adding vorticity confined forces.
-
References:
Fedkiw, R., Stam, J., And Jensen, H. 2001. Visual simulation of smoke. In Proc. of ACM SIGGRAPH 2001, 15-22.
Stam, J. 1999. Stable fluids. In Proc. of SIGGRAPH 99, 121-128.
Kniss, J., S. Premo e, C. Hansen, P. Shirley, and A. McPherson. 2003. "A Model for Volume Lighting and Modeling." IEEE Transactions on Visualization and Computer Graphics 9(2), pp. 150-162.
Engel et. al. Real-time Volume Graphics - Ch-3.5.
Harris, Mark. Fast Fluid Dynamics Simulation on the GPU - GPU Gems. Link to nVidia Website
-
Acknowledgements:
I would like to thank my advisor Dr. Joe Kniss for his supervision and regular feedback in engineering the solution.
-
Resources:
MS Exam Presentation Slides
Project, Exe & Source Code (Windows)  [As of Apr 09, 2010]
** Source Code Sample **