Graphics Reference
In-Depth Information
the density ρ of particles and the resulting force is the negative gradient of P :
Dt =0 ,
D u
Dt =
−∇
P + g + f ext ,
(4.1)
where g gravity and f ext accounts for external forces such as user interactions. The
terms D Dt and D Dt account for the transport of density and velocity. There is never
any density added nor removed, it is only transported and held by the particles
leading to D Dt = 0. Energy added to the velocity—like gravity—needs to be
conserved as well, resulting in equation (4.1). Next we define the incompressibility
constraint P and how to compute the density of particles ρ .
4.3.1 Pressure Constraint
To keep the fluid from compressing and the particles from inter-penetrating, we
penalize high density: P = [Desbrun and Cani 96], where k is a stiffness
parameter that makes the particles repulse one another more strongly (but can
also make the simulation unstable if too large). Hence, by minimizing the density,
the particles will move in the direction that reduces density the most and thereby
avoid each other. At the same time, gravity and boundary conditions, like the
walls, will act to keep the particles from simply flying away.
Keeping the particles from inter-penetrating is crucial in particle-based liquid
simulations. To give strict response to the particles that are close to colliding,
we can make the density nonlinear leading to the pressure constraint [Becker and
Teschner 07]: P = k ρ 0
γ
,where γ is an integer (5 in our case). Dividing by the
initial density ρ 0 comes in handy for stability; it becomes easier to control the
magnitude of the force through the parameter k and thereby keep the simulation
stable.
Setting the initial ρ 0 can be tricky. It should be a proportional evaluation of
ρ at an initial rest configuration, i.e., with a uniform distribution of particles. In
practice, however, we can set it manually. We approximate ρ by performing a
convolution, which we pre-compute on a texture by rasterizing, or splatting the
kernels of each particle.
4.4 Splatting
To evaluate the density of particles smoothly, we perform a convolution: the den-
sity is the weighted average of the surrounding discrete samples, in this case the
particles. The weight is given by a kernel function, which falls off exponentially
with distance, as shown in Figure 4.1. Instead of sampling the nearby particles,
Search WWH ::




Custom Search