Graphics Reference
In-Depth Information
in the PDE, much like viscosity:
DT
Dt
= k T ∇·∇
T,
Ds
Dt
= k s ∇·∇
s.
Here k T and k s are non-negative diffusion constants. These could be dis-
cretized with finite differences in the obvious way, for example for temper-
ature:
T new
i,j,k = T i,j,k tk T
T i +1 ,j,k + T i,j +1 ,k + T i,j,k +1
6 T i,j,k + T i− 1 ,j,k + T i,j− 1 ,k + T i,j,k− 1
Δ x 2
×
.
The same boundary conditions used in advection provide values of T (or s )
at non-fluid points. However, this update is only stable and free of spurious
oscillations if
Δ x 2
6 k T
Δ t
.
If this condition cannot be met (or is so far from being met that breaking
up the time step into several smaller substeps that do satisfy the condition
is too slow), another simple option is to run a Gaussian blur on the variable.
In fact, apart from boundary conditions, the exact solution to the so-called
heat equation
∂T
∂t
= k T ∇·∇
T
(5.1)
over a time Δ t is a convolution with the following Gaussian filter, which in
this context is called the heat kernel :
(4 πk T Δ t ) 3 / 2 e x 2
1
G ( x )=
4 k T Δ t .
The convolution can be evaluated eciently dimension-by-dimension ex-
ploiting the separability of the Gaussian filter; see any reference on image
processing for details.
Finally, before moving on, it should be noted that although this ap-
proach can work well for fairly diffuse situations, the grid resolution limits
its ability to handle sharply defined smoke contours. In this case the par-
ticle methods discussed later, in Chapter 10, are preferable. Even if smoke
concentration is tracked on a grid for the simulation, it still may be prefer-
able to use particles for rendering—running millions of particles through
the grid velocity field can provide finer details than really are resolved in
the simulation itself!
Search WWH ::




Custom Search