Graphics Reference
In-Depth Information
selected time step, making sure to clamp within the grid boundaries. The density is then bilinearly inter-
polated from nearby values and this interpolated value is used as the density of the position.
The velocity update
The change of the velocity over time is given by Equation 8.41 and is due to external forces ( f ),
diffusion of the velocities, and self-advection.
@u
2 u
@t ¼ f þ mr
ð
u
r
Þ
u
(8.41)
The velocity is kept in an array of vectors. The first term, f , adds in external forces from the user or
environment. The second term allows for the diffusion of the velocity, and the third term allows the
velocity to be carried along by the velocity field.
These equations are implemented by the sequence: add force, advect, diffuse, and project. The pro-
jection step is to adjust the density so that mass is preserved.
The simulation
The simulation is conducted by updating the contributions from density forces and external forces, then
stepping the velocity field a step in time, taking the density field a step in time, then drawing the
density.
8.2.4 Particle-based approaches including smoothed particle hydrodynamics
As previously noted, particle-based approaches have the advantage of being intuitive, easy to program,
and fast to execute—at the expense of accuracy. However, for computer graphics and animation, accu-
racy is a common sacrifice. The basic idea is to model the fluid by a mass of particles. A simple particle
system can be used, but the rigid nature of standard particles means that a massive amount of particles
has to be used in order to create the impression of a fluid. In cases of modeling a gas or a spray of liquid
this can be effective, but in cases where it is useful to represent a liquid's surface (e.g., for display) this
approach is problematic.
In order to give a better impression of a cohesive fluid, spherical implicit surfaces, often referred to
as metaballs (see Chapter 12.1 ), can be used in place of rigid particles. Because metaballs allow for the
reconstruction of smooth intersections between particles, this approach can produce a gooey-like
appearance similar to crunchy peanut butter. Metaballs have the ability to generate organic, blobby
shapes but fall short of being able to model liquids effectively. While this is an improvement
over rigid particles, is still takes a very large number of particles to produce a smooth surface. In addi-
tion, metaballs lack any physical characteristics that make them suitable for effectively representing
liquids.
For a more principled approach and one that produces a smoother surface, smooth particle hydro-
dynamics (SPH), developed for astrophysics, does a better and faster job of rendering a liquid
from a collection of particles. SPH can be viewed as an extension of the metaball approach
( Figure 8.21 ). The SPH particle is similar to that in a typical particle system and is represented by
its position and velocity. An SPH particle, similar to an implicit surface particle, has a density function
that contributes to a field value over its area of influence. The difference is that each SPH particle has a
mass and density and each SPH particle also carries and distributes its mass over an area. The SPH
particle has a kernel function that plays the role of a metaball's density function. The main difference
 
Search WWH ::




Custom Search