Graphics Reference
In-Depth Information
We now need a way to determine the smoke concentration on the sim-
ulation grid from the particle data, for use in the buoyancy law or density
calculation. The simplest thing is to sum, at each grid point, the particle
values modulated by a kernel function k that only gives weight to nearby
particles, normalized by a weight value W which we'll discuss in a moment:
s i,j,k =
p
k ( x p
x i,j,k )
s p
.
(10.1)
W
Note the convention in this chapter is to always use p for particle indices
and reserve i , j ,and k for grid indices: thus s i,j,k is unambiguously the
smoke concentration at grid point ( i, j, k ) which is at position x i,j,k .Also
note that in practice it makes much more sense to order the computation
as a loop over particles, each contributing to the nearby grid points:
Reset all grid s i,j,k
values to zero.
Loop over particle index p :
Loop over grid indices i , j , k where k ( x p
x i,j,k ) might be non-zero:
x i,j,k ) /W to s i,j,k
The kernel function k should be adapted to the grid spacing, just as in
rendering—if its support is less than Δ x then some particles between grid
points may momentarily vanish from the grid (not contribute to any grid
points), but if the support is too much larger than Δ x , the method becomes
inecient and we'll have blurred away a lot of the desirable sharpness
of particle methods. The simplest choice that makes sense is to use the
trilinear hat function:
k ( x, y, z )= h x
Δ x
Add s p k ( x p
h y
Δ x
h z
Δ x
1
r
:0
r
1 ,
with
h ( r )=
1+ r
:
1
r
0 ,
0: t er ise .
Smoother results can be achieved using higher-order B-splines, for example,
though it should be emphasized that the grid values s i,j,k are not going
to be rendered so this is probably overkill. Speaking of rendering, it's
virtually certain that memory and time constraints dictate that the number
of simulation smoke particles will be much less than that required for a high-
quality render—though they provide useful data for the renderer, they will
have to be augmented with many extra rendering particles in the rendering
stage.
Search WWH ::




Custom Search