Simulating Smoke

Philipp Krähenbühl and Dang-Trinh Huynh-Ngoc

In this project, we implemented a simulation system for smoke. The smoke is rendered in a (2D or 3D) discretized grid. Each cell in the grid has a density value representing the smoke density at that cell. The GUI allows the user to place density over the grid by mouse clicks. The grid is associated with a velocity field which transports the density from cells to cells. The velocity field evolves over time according to physical laws in fluid dynamics (Navier-Stokes equations [1,2]). Each iteration evolves the velocity field by a small time step using Euler method. The system also has temperature, which makes hot air rises. We implemented both a 2D version and a 3D version.

Rendering

In 2D we render the density field using GL_QUADS's connecting 4 adjacent points in our simulation. Since the resolution in 2d can be pretty high, we get really nice results with this approach. The 3D rendering consists of two steps. Like [2] suggests we first calculate the amount of light coming into a voxel as L = L_0 e^{\sum_{v \in \mathrm{voxels on path to light source}}{\rho_v C_{exp}_v}}. [2] suggests using Bresenhams line drawing algorithm to trace the ray's back to the light source. Since Bresenhams might miss some of the smoke voxels we decided to use a slightly moddified version, which gives us all the voxels on the path to the light source and in addition gives us access to Cexp. The ground shadow is calculated using the L/L0 values of the boundries of our simulation and projecting those values onto the ground plane (y=0).

Videos

2D

The grid size of all following videos is 200x200. The following video shows the velocity field of the fluid.

The next one uses Monotonic Cubic Interpolation.

The next one uses Linear Interpolation.

3D

The grid size of all following videos is 80x80x80. The following video uses Monotonic Cubic Interpolation.

The following uses Linear Interpolation.

The next one uses Linear Interpolation, together with random noises (representing random wind in real life) injected into the velocity field.

Overall, linear interpolation mixes the fluid better than monotonic cubic interpolation, but it also makes the fluid more blurry. Random noise makes the fluid look more real.

References:
1 - Jos Stam: Stable Fluids. SIGGRAPH 1999: 121-128
2- Ronald Fedkiw, Jos Stam, Henrik Wann Jensen: Visual simulation of smoke. SIGGRAPH 2001: 15-22