Game Development Reference
In-Depth Information
( h
), equivalent to the one used for viscosity in [Muller et al. 03]. A more-
accurate equation for interpolating a Laplacian is proposed by [Colin et al. 06],
but it is significantly more complex to evaluate and therefore not employed by our
implementation.
r
6.3 An Algorithm for SPH Simulation
Given a set of fluid particles, the SPH algorithm that solves the SPH equations
yields particle positions ([ x i ] 0 , [ x i ] 1 , [ x i ] 2 ,... ) for consecutive time steps
( t 0 ,t 1 ,t 2 ,... ). In the remainder of this chapter, we will use the brackets with
superscript notation [ A ] 0 to denote the value of an attribute A at a certain time
t 0 . Starting out with positions
[ x i ] 0
{
:1
i
n
}
, Equation (6.2) is used to
[ ρ i ] 0 :1
calculate densities
. This corresponds to Step 1 in Figure 6.1.
From the definitions of the SPH equations in Section 6.2, it follows that all
densities have to be known before any forces are calculated for corresponding
time steps, as both Equations (6.6) and (6.7) depend on all the particles' densi-
ties. Calculation of
{
i
n
}
[ f i
] 0
therefore takes place after Step 1 and
involves the densities and positions of particles, while
{
:1
i
n
}
[ f i
] 0 :1
also
involves velocities. Both components of f i can be established at the same time,
corresponding to Step 2 in Figure 6.1. Through a i = f m i , we implicitly establish
[ a i ] 0 as well. Step 3 corresponds to integration of [ a i ] 0
{
i
n
}
into [ v i ] 1 and [ v i ] 1
into
x i , v i , at t 0
Step 1
ρ i , at t 0
t n := t n+1
Step 2
f i , f i , a i , at t 0
p v
Step 3
x i , v i , at t 1
Figure 6.1. The states of the SPH algorithm, represented by boxes. The arrows denote the
steps of the algorithm to get from one state to another.