Tuesday, March 1, 2011

CUDA Smoke Simulation

The main differences in a fluid solver for smoke compared to water are as follows:

  • Decrease in viscosity
  • Addition of density, mass and temperature factors
  • Buoyancy based on the additional factors
Obviously buoyancy is related to water as well, but since the water I rendered was on a fixed plane in 2D this factor was not necessary. Buoyancy will be needed for smoke movement affecting its position along the Y-axis. GPU Gems (Chpt. 38)  refers to the buoyancy force as follows: 

where k is the mass factor and d is the smoke density - s  a constant time scale factor and T the temperature compared to To the ambient temperature.

I plan to implement this function in my current CUDA kernel by adding the value at each fragment to the velocity grid in the Y-direction. This should simulate the effect of gravity based on the weight of the smoke.

No comments:

Post a Comment