Graphics Reference
In-Depth Information
Set substep time τ =0.
Set flag finished to false.
While finished is false:
Evaluate u ( x ).
Find the maximum substep size Δ τ = C Δ x/ (
u ( x )
+ ).
( is a small number like 10 37
used to guard against divide-
by-zero.)
If τ τ ≥
Δ t :
Set Δ τ t
τ and finished to true.
Else if τ +2Δ τ
Δ t :
1
Set Δ τ =
2 t
τ )
Update x with RK3 for substep size Δ τ , reusing the evaluated
u ( x ).
Update τ
τ τ .
Figure 10.1. Pseudocode for substepping particle advection, loosely restricting a
particle x to travel no more than C Δ x per substep.
fluid. In these cases, however, it might also be critical to add new particles
at those boundaries when the velocity field is pulling new fluid into the
problem—we'll address this seeding problem in the next section.
10.2 Secondary Particles
Our first sortie is using particles to track secondary fields, such as smoke
concentration. In fact, we already suggested running particles through the
velocity field as a post-process for more detailed smoke rendering; now
we're going to go further and use particles directly in the simulation. We'll
stick with the smoke concentration example to begin with.
We will assume each particle, in addition to its position x p ,hasasmoke
concentration s p . This value should represent the concentration of smoke
in the volume associated with the particle—more on this in a moment. At
it simplest, s p could be a constant for all particles, but as it can be useful
to have smoke steadily dissipate—which can be emulated by reducing each
s p just as we scaled back grid values—it makes sense to track this per
particle. At the moment a particle is created, it will take a default initial
value S ;once s p has been reduced to below some threshold, the particle
can be deleted. For extra variability, the initial S itself could be modulated
by an animated volume texture in the emission region.
Search WWH ::




Custom Search