# Modeling and Rendering Viscous Liquids

**ABSTRACT** We present a particle-based algorithm for modeling highly viscous liquids. Using a numerical time-integration of particle acceleration and velocity, we apply external forces to particles and use a convenient organization, the adhesion matrix, to represent forces between different types of liquids and objects. Viscosity is handled by performing a momentum exchange between particle pairs such that momentum is conserved. Volume is maintained by iteratively adjusting particle positions after each time step. We use a two-tiered approach to time stepping that allows particle positions to be updated many times per frame while expensive operations, such as calculating viscosity and adhesion, are done only a few times per frame. The liquid is rendered using an implicit surface polygonization algorithm, and we present an implicit function that convolves the liquid surface with a Gaussian function, yielding a smooth liquid skin.

**0**Bookmarks

**·**

**68**Views

- Chinese Journal of Computers 07/2010; 33(7):1286-1294.
- SourceAvailable from: ocean.kisti.re.kr[Show abstract] [Hide abstract]

**ABSTRACT:**This paper presents a multi-phase fluid simulation that realistically represents small scale details. We achieve this by creating escaped particles based on physical methods. Escaped particles are the remained particles after correcting levelset. Generation of escaped particles in this paper differs from previous works; this fluid simulation is extended by adding lift force and drag force to positive escaped particles. And negative escaped particles represent droplet or splash effect; when they are merged into the negative levelset value, they affect the nodes' velocity (two-way coupling). This simulation that uses positive and negative escaped particles deals with detailed fluid motions dynamically in small scale.Journal of Korea Multimedia Society. 01/2009; 12(3). - SourceAvailable from: onlinelibrary.wiley.com[Show abstract] [Hide abstract]

**ABSTRACT:**We present a new method to create realistic paint simulation, utilizing the characteristics of paint, such as fluidity, diffusion, and absorption. We treat the painting elements separately as pigment, binder, solvent, and paper. Adopting smoothed-particle hydrodynamics including a consideration of viscoelastic movement, we simulate the fluid motion of the paint and the solvent. To handle the diffusion of the pigment in the solvent, we utilize the mass transfer method. Following Fick's law, the concentration of pigment changes and each pigment particle is diffused to the neighborhood accordingly. As time elapses, the binder and the solvent are absorbed, and for the most part, the pigment remains on the paper. The Lucas–Washburn equation determines the distance of absorption. The examples show that our approach can effectively generate various types of painting. Copyright © 2013 John Wiley & Sons, Ltd.Computer Animation and Virtual Worlds 05/2013; 24(3-4). · 0.44 Impact Factor

Page 1

Modeling and Rendering Viscous Liquids

Kevin Steele, David Cline, Parris K. Egbert, and Jonathan Dinerstein

Brigham Young University

3366 TMCB, Provo, Utah 84602, USA

Tel. 1(801)422-4029Fax. 1(801)422-0169

email: steele@rivit.cs.byu.edu, cline@rivit.cs.byu.edu, egbert@cs.byu.edu

We present a particle-based algorithm for modeling highly viscous liquids. Using a numerical time-integration of particle

acceleration and velocity, we apply external forces to particles and use a convenient organization, the adhesion matrix, to

represent forces between different types of liquids and objects. Viscosity is handled by performing a momentum exchange

between particle pairs such that momentum is conserved. Volume is maintained by iteratively adjusting particle positions after

each time step. We use a two-tiered approach to time stepping that allows particle positions to be updated many times per

frame while expensive operations, such as calculating viscosity and adhesion, are done only a few times per frame. The liquid

is rendered using an implicit surface polygonization algorithm, and we present an implicit function that convolves the liquid

surface with a Gaussian function, yielding a smooth liquid skin.

Keywords: computer animation, physically-based animation, fluid modeling

Introduction

Many early attempts to animate fluids in computer graphics have used a Lagrangian description of motion [1, 2, 3]. Lagrangian motion

focuses on individual particles and their properties such as position, velocity, and acceleration, and the influence particles have on one

another [4]. In contrast, much of the recent fluid animation research has used an Eulerian description of motion [4] in which groups of

particles participate in flow fields, and the flow properties are observed or specified at fixed spatial points in a Cartesian grid [5, 6, 7, 8],

usually by employing the Navier-Stokes equations for incompressible fluids. The Eulerian model has the advantage of being able to

accurately model liquids of lower viscosity. However it has a bounded simulation space due to the discrete nature of the flow sampling. In

contrast, the Lagrangian model has an unbounded simulation space (the particles are free to go anywhere), and may more easily simulate

non-Newtonian effects such as the stringiness exhibited by honey or the bounciness of egg white.

The purpose of this paper is to show that modeling and animating highly viscous liquids such as oil, liquid soap or honey can be done

efficientlyusingaLagrangianmodel, andbyovercomingtheproblemsof numericalinstabilityandvolumelossitcanyieldvisuallyaccurate

results and convincing behavior (see figure 1). In this paper we model large collections of liquid molecules as single particles, and compute

the interaction between particles in such a way as to behaviorally simulate an amount of liquid that a human might realistically interact

with. We employ particle systems to directly model the body of the liquid; individual particles represent a fixed region of liquid and are

given initial locations and velocities. A time-stepped simulation is then run and each particle’s position and velocity are updated according

to an Euler-step solution to the set of differential equations governing Newtonian motion.

Though simple, explicit Euler step integration tends to exhibit numerical instability. Another method for accurately computing particle

movement that guarantees stability for large time steps is implicit integration [9, 10]. Unfortunately, standard solutions to implicit integra-

tion require solving large, sparce matrices, where the sparseness is related to the particle neighborhood. In our system a typical particle

neighborhood may include sixty or more particles. We therefore use an explicit numerical solution to compute particle movement, and we

employ dampening strategies to reduce numerical instability.

Theliquid’sviscosityismodeledusingavelocitysmoothingmethodthatconservesmomentum. Thislocalsmoothingalsohelpsmaintain

numerical stability of our explicit integration scheme. We model multiple liquids interacting in the same simulation simply by assigning

to each particle a material type and then varying its interaction behavior with other particles based on their types. Liquids of different

1

Page 2

Figure 1: A spherical drop of simulated honey falls onto a suspended ball.

viscosities not only exhibit differing flow rates, but also behave differently when in contact with objects in their environment. To efficiently

accommodate the varying properties of different liquids, we define an adhesion matrix, a matrix of functions that control liquid behavior.

The adhesion matrix contains a row and column entry for each type of liquid and solid object in the simulation environment. Each matrix

cell contains a function that determines how velocities are modified when the materials in that cell’s row and column come into contact.

When using particles to model fluids in a CFD simulation, volume preservation is a continuing problem. We present a method to preserve

volume in our liquid simulation, and we optimize both the velocity computation and the volume preservation using adaptive timesteps.

To render the particle system we use a traditional implicit surface rendering method to generate surface triangles that can then be

rasterized or raytraced, and we present an implicit function that utilizes particle locality to define a smooth skin around the system. The

function is convolved to effectively eliminate local surface features produced from individual particles while still maintaining the larger

surface features of the liquid.

Collisions with objects in the simulation environment are detected and handled by embedding object particles in the surfaces of environ-

ment objects. Liquid particles respond to forces originating from collisions with object particles, so the same framework used to modify

liquid particle velocities can be used to resolve collisions of the liquid with scene objects. Additionally, interactions and collisions with

moving objects happen automatically without the need for handling special cases.

Particles are stored in a 3D spatial partitioning grid, and grid cells are indexed by location and stored in a hash table, permitting an

unbounded partitioning, near constant-time lookup for grid cells and constant time lookup for individual particles. Since all operations on

particle locations and velocities depend only on local particle neighbors, each iteration of the simulation takes O(n) time for a system of n

particles.

Related Work

The goal of accurately describing the behavior of liquid is not new. In the early 1800’s, Navier and Stokes jointly developed a set of

equations using conservation of momentum and mass that accurately describe fluid flow (see, for example [11]). Over the past two decades,

several approaches have been devised to graphically simulate fluid flow. The work that has been done can coarsely be divided into three

approaches. The first is a strictly surface-based approach where a parametric surface is used to model the surface of a liquid. The second

is a Lagrangian description of motion in which particles are used to represent the fluid. The third is an Eulerian approach in which the

Navier-Stokes equations are approximated or simulated to produce fluid flow.

Some of the early attempts at simulating fluid flow used parametric functions to approximate fluid surfaces. Schachter [12] used this

approach to model cresting waves. Fournier and Reeves [13] and Peachey [14] expanded this technique into a more general method for

modeling waves and surf. Kass and Miller [15] computed a height field for a fluid surface using 2D shallow water equations. Chen and

Lobo [5] extended their approach to include a contribution from the Navier-Stokes equations to the elevation of the height field.

Reeves introduced the idea of particle systems for the simulation of fluid [16]. This system provided particles with positions and

velocities, and then tracked the movement of those particles through time. Miller and Pearce [1] extended the particle system idea by

adding viscosity. They did this by attaching viscous springs to the particles to provide for inter-particle relationships. Terzopoulos, Platt

and Fleischer [2] used particles in a molecular dynamics approach to simulate object melting. Desbrun and Gascuel [17] introduced a

system to simulate soft objects using a particle system to define large-scale motion. They employed an isosurface defined by the particles to

determine contact forces and local deformations. Later, drawing on formalisms from physics literature, Desbrun and Gascuel [17] extended

Smoothed Particle Hydrodynamics (SPH) to simulate deformable bodies. Stora, et. al., [18] simulated lava flow using smoothed particles

2

Page 3

with a temperature-based viscosity. More recently, Tasdizen, et al. [19] used SPH to simulate realistic liquid flow, and Muller, Charypar

and Gross [20] use SPH to achieve interactive flow for a few thousand fluid particles.

In an attempt to model fluid flow in a more physically accurate manner, researchers have developed techniques to approximate or simulate

the Navier-Stokes equations. These techniques often give more accurate physical results, but have other problems such as burdensome

computation times or mass dissipation. Foster and Metaxas [7] use a finite-difference approximation to the Navier-Stokes equations to

determine gross liquid transport, then use local velocities to simulate finer fluid detail. They later refined their technique to simulate hot

gases [21]. Stam produced a numerically stable version using a semi-Lagrangian method instead of finite differences [8]. This technique

guaranteed stable results at relatively large time steps, but did not accurately handle dissipation. Fedkiw, Stam, and Jensen [22] extend this

technique to accurately model vorticities and interactions between smoke and moving objects. Foster and Fedkiw [6] use a semi-Lagrangian

method derived from Stam’s technique to solve for liquid motion using the Navier-Stokes equations. To prevent the mass dissipation typical

of this method, they use a level-set surface in conjunction with inertialess particles. This level set allows liquid movement but preserves

visual continuity of the liquid’s mass. Enright, Marschner and Fedkiw [23] refined the surface tracking of Foster and Metaxis, allowing

finer liquid details to be modeled. Carlson et al. [24] use the incompressible Navier-Stokes equations to simulate effects such as melting of

wax and the flow of highly viscous fluids.

We approach the problem of liquid animation from a Lagrangian description of motion. Our method differs from earlier particle-based

models [1, 18, 2] by providing more flexibility in the inter-particle forces controlling the animation, allowing us to simulate a wider variety

of viscous liquids. We also utilize a more aggressive density preservation model, enhancing the visual continuity of the animation.

Viscous Liquid Model

We use a particle system to model and animate liquid motion throughout the simulation. Each particle of the system represents a globule,

or a finitely small volume of liquid. The particle data structure contains the necessary data to accurately track the liquid through time

and space; it stores the location of the globule, its velocity, size, mass, and other data to facilitate rendering, such as its color properties,

proximity to the liquid surface, and surface normal. The entire system is stored in an array of particle structures.

Within the constraints of the simulation, the liquid is free to occupy any position in space independent of its containing data structure.

This is less restrictive than the Eulerian motion model where the liquid must stay within the predefined bounds of the sampled flow fields.

To accomplish this, we subdivide Cartesian space into fixed-sized cells indexed by their corner location. Only cells containing particles are

allocated in memory, and once a cell no longer contains particles it is deallocated. Cells are stored in a hash table and keyed by hashing

their corner locations with an array mapping function as in [25]:

hash key = 541i + 79j + 31k mod table size.

Hashing cell locations permits very fast, near constant-time lookup. This is critical since many computations on individual particles

involve accessing a list of particle neighbors. Hence a single iteration through the array of particles is an O(n) operation even when a list

of particle neighbors is fetched for each particle.

Liquid Motion

We begin with a simple particle transport model and apply viscosity and friction. For any particle, the instantaneous force applied is the

sum of all forces from neighboring particles plus the gravitational force:

F(p) =

?

f(pi) + g.

We start the simulation at time t0and successively apply forces at regular intervals of δt, where δt is the duration of one frame divided

by the number of substeps per frame. New velocities are computed from the applied forces and particle locations are subsequently updated

from the new velocities.

When a particle is processed in the simulation, forces are applied to the particle’s velocity and the particle is moved. We separate these

forces into three types: adhesion forces that attract particles to each other and to other objects, viscosity forces that limit shear movement

of particles in the liquid, and friction forces that dampen movement of particles in contact with objects in the environment. Each force type

is derived separately and applied in succession.

3

Page 4

Figure 2: Examples of adhesion functions used in our system. The function domains are specified in particle radius units so that a simulation

can be run with larger or smaller numbers of particles by just changing the standard particle radius. Generally, we define adhesion

functions with a support of 4 particle radii.

The size of the timestep δt greatly influences the accuracy of the simulation. Unfortunately, increasing the number of substeps per frame

so that the simulation is stable and accurate can be inefficient. Stora et al. [18] found that some simulations needed as many as 64 substeps

per displayed frame to maintain stability. Our experiments showed similar results.

One approach that has been taken to alleviate this computational burden is to use adaptive time steps for each particle in the simulation.

We tried this, but were only able to achieve a two-fold speedup over the naive approach. We found that a better approach for simulations

of viscous fluids was to separate operations that had to be performed every time a particle moved from those that did not. Thus, instead of

dozens of substeps per frame, we only use a few, 2 to 8 typically, but within each substep the particle positions are updated iteratively and

a collision model is applied to keep the particles properly separated. This simple innovation increased the speed of our simulations by four

to ten times.

The Adhesion Matrix

The adhesion force is an inter-particle force that attracts or repels other particles or objects in the environment. Since a liquid will flow

differently when in contact with different materials and when mixed with other liquids, the inter-particle force function may be different

for each unique type of particle pair. To organize and represent these forces we define a matrix of functions, the adhesion matrix, whose

cells contain the functions governing the adhesion of particle pair types. For example, an oil particle in the vicinity of steel particle would

receive an adhesion force Fsteel−oil(distance from steel).

Entries in the adhesion matrix include liquid types as well as materials with which liquids will interact. The shapes of the adhesion

functions in the adhesion matrix in large part determine the behavior of a simulated liquid. The force functions are user-definable in

our system; we use piecewise-linear functions. We found that defining complex functions with many sample points did not work better

than using simple ones with only a few sample points; only the overall shapes of the functions mattered. In addition, the results of our

simulations were similar whether the adhesion functions tapered off to zero or not. Noting this fact, we were able to reduce the support of

the adhesion functions, decreasing computation.

Although we experimented with a number of different adhesion functions, our animations only use three function types. The first

function type mimics a Leonard-Jones potential (repulsion at close distance and attraction at a greater distance) with the repulsion force

capped at about 10 times the maximum attractive force to help prevent numerical instability. This function type was used as the adhesive

force between particles of the same or similar fluids. The other two types of functions were either purely attractive or purely repulsive.

Attractive functions were used to make liquids cling to solid objects, and repulsive functions were useful when we wanted different fluid

types to repel each other or not mix. Figure 2 shows some functions from a typical adhesion matrix.

Viscosity Forces

As the viscosity of a liquid increases, the momenta of a liquid’s constituent particles increasingly tend toward that of their neighborhood

average. We model the viscosity of the liquid in a similar way. The resistance to shear particle movement due to viscosity, which we call

4

Page 5

the viscous force, is applied to a particle indirectly through an algorithmic momentum exchange between particles. Given a particle p, and

a viscosity constant v, which we define to be the percentage of momentum that a particle will exchange with its neighbors in one second,

the momentum exchange can be calculated. The momentum exchange proceeds by scaling the difference in momentum between the two

particles by a normalizing factor and a weighting function k, then adding the result Pexchto p’s momentum Ppand subtracting it from pn’s

momentum Ppn. Note that since the same amount of momentum is being exchanged between any two particles, the total momentum of the

system is conserved.

Pexch=vk(dpn)(Pp− Ppn)δt

2?n

Pp = Pp+ Pexch,

i=0k(di)

,

Ppn = Ppn− Pexch.

The normalizing factor in the equation is half of the viscosity constant divided by the total weight of the weighting function k, and diis

the distance from the particle being processed. This weighting function gives the user more flexibility in deciding how much momentum is

exchanged between two particles based on their separation distance. Similar to the adhesion functions, we found that subtle differences in

the weighting function did not significantly affect fluid behavior, but increasing the support of the weighting function increased the stiffness

of the material being simulated. In our simulations, we used a piece-wise approximation of a gaussian function for k with a support of

between 4 and 6 particle radii.

Once the forces have been accumulated and applied to each particle’s velocity vector, the particles are translated in an Euler-step fashion

for a numerical time-integration of its acceleration and velocity. Two problems commonly encountered with this type of simulation are

that Euler step integration is often numerically unstable, and when particles represent piecewise masses of a larger substance, the volume

of the substance does not remain constant. In our system the first problem is avoided by application of the viscous force computation. By

averaging each particle’s neighborhood velocity, the numerical instability of the timestep-integration is mitigated.

Friction and Interpenetration Prevention

Friction is only applied to particles that are in contact with scene objects. Rather than use the standard friction model for solid objects

with separate coefficients for static and kinetic friction forces, we use a simplified model more suitable for liquids. Each particle that is on

the surface of the liquid and that is in contact with an object will have its velocity dampened by a factor specific to that object type. To

avoid confusion with conventional friction coefficients, we refer to this term as the friction factor. The friction factor f is defined to be

the percentage of velocity dampening a particle experiences per second. If the current simulation iteration has 1/δt substep intervals per

second, then the velocity vt+δtwill be dampened each substep by

ˆ vt+δt= fδtvt+δt.

In practice, defining the friction as the percentage of velocity dampening per second required inconveniently small numbers, so we

instead define it as the percentage of velocity dampening per 1/30 of a second.

Inter-penetration prevention is essential to maintaining stability in the simulation and to help in the final volume preservation process. To

correct for particle inter-penetration, the particle system is again iteratively traversed and particles that are inter-penetrating are separated

to their contact distance. Figure 3 summarizes our complete liquid dynamics algorithm.

Volume Preservation

Volume preservation is perhaps the most difficult problem to solve. We assume a constant volume, and we take an iterative approach to

maintain the correct density at each particle location. First, a desired density for single particles is established. Then the particle positions

are adjusted after each substep of the simulation to correct for differences between the current liquid density and the desired density. This

process is performed iteratively after each sub-timestep until the density is within a specified tolerance of the desired density. Correcting to

within 2% of the desired density can be done with less than three density corrections per sub-timestep on average, totaling approximately

15% of the total simulation time. Additional accuracy can be achieved at a higher computational cost, however, if the density error threshold

is set too stringently, some instability in the system can result. Also, we note here that the volume correction procedure only corrects our

measure of density, not the actual volume enclosed by a rendered isosurface.

5

Page 6

For each animation frame (such as 1/30 second)...

For each sub-timestep

For each particle

Calculate adhesion, viscosity and gravity forces

Do for a pre-specified number of iterations...

Accelerate particles based on calculated forces

Translate particles

Apply friction forces

Prevent particle inter-penetration

Apply iterative density correction

Figure 3: Liquid dynamics algorithm.

During the initialization phase of a simulation, liquid particles are arranged in a regular three-dimensional lattice. The “desired density”,

ρ0, is determined by this configuration of particles, and is defined to be the sum of a density smoothing kernel, ω [18], evaluated at the

distance from a particle p to its 26 hypothetical neighbors in the lattice structure.

ρ0 =

26

?

i=1

ω(di).

The kernel support for ω must only include the 26 neighbors of p from the initial configuration. If p has a radius r, then the support of ω

must be in the range 2r√3 ≤ ωsupport ≤ 4r. During simulation time, a particle may not have exactly 26 neighbors within the support of

ω, so the density at each particle location is defined by:

ρ =

?n

26

n

i=1ω(di)

?n

if n ≥ 26

if n < 26

i=1ω(di)

ρ0

if n = 0

where n is the number of neighbors within the support of ω that the particle has. All of our examples use linear ramp functions for ω, (i.e.

ω(0) = 1, ω(kernel support) = 0). We experimented with other functions, but found many to produce unstable results. Gaussian-like

functions with low-derivative parts were particularly ill suited as density kernels.

To correct the density error after each timestep, we find the derivative of the local liquid density at each particle with respect to moving

the particle’s neighbors away from the particle by one unit. Note that this derivative is constant for a ramp function. The local density

derivative is found by summing the derivative of ω evaluated at the distances from the particle to the neighboring particles:

ρ?=

n

?

i=1

ω?(di).

After computing the density derivative, we calculate a correction vector ∆v for each neighbor:

∆v = c(ρ − ρ0)

pn− p

?pn− p?.

C is a constant called the “elastic coefficient” that determines the rate at which the density error is corrected. It is usually set between 0.1

and 0.5. To synchronize the update of the particle positions, we accumulate the correction by adding ∆v to a temporary vector associated

with pn and subtracting it from a temporary vector associated with p. After all the liquid particles have been processed in this way, we

add the accumulated correction vectors to the particle positions. This move partially corrects the fluid density. Since the density error of

the liquid may not be corrected in a single pass, several correction passes are made through the system until the density error is within the

predetermined tolerance.

Object-Liquid Interaction

Inadditiontorealisticliquidmotion, wewantthemodeledliquidtointeractwithobjectsinitsenvironment, suchasflowingfromacontainer

into or around other objects. Rather than representing environmental objects with polygonal or parametric surfaces and computing liquid

6

Page 7

interactions with them, we convert our objects into object particles of between one and two times the size of those representing the liquid

and make them part of the same particle system. The liquid particles interact with object particles using the same fluid dynamics framework

that governs the intra-liquid particle interactions. Using particle-based objects does incur some memory overhead. We found this overhead

to be acceptable, however, since in most of our simulations fluid particles significantly outnumbered object particles. This was so because

particles must be used to represent the entire volume of a fluid, but are only used to represent the surfaces of objects that interact with the

fluid. Figure 4 shows a cup comprised of object particles pouring a group of liquid particles.

Figure 4: (Left) A ”particalized” cup with liquid particles. (Middle) The same cup rendered using its original polygons and a translucent

isosurface covering the liquid particles. (Right) The cup and isosurface raytraced in a scene.

During simulation run-time, adhesion and friction forces between liquid particles and object particles are computed, and liquid particles

are checked against object particles for inter-penetration errors. However, object particles are not used to determine viscous forces or to

correct density errors since these phenomena are strictly liquid-related characteristics.

Objects moving in the environment are easily accommodated using this method. The object particles representing an independently

moving object are given their own time-dependent transformation. This transformation is applied during each sub-timestep to determine

new object particle positions before those particles are used to compute liquid particle viscosity forces, friction forces, and inter-penetration

errors.

Rendering

Once the liquid’s form and motion have been modeled, it is ready to be rendered. Prior to rendering, some supporting data need to be

determined. The particles closest to the surface of the liquid must be identified, surface normals need to be derived at those surface

particles, and surface particles acting as isosurface rendering seed points must be isolated.

We use a method similar to Stora, et. al. [18] to identify which liquid particles are closest to the surface of the liquid. Considering each

particle in the system separately, we surround a particle p with a sampling sphere of radius r. The particle p and the other particles pn

found within the sampling sphere are used to compute the centroid c of the spherical region. The vector p−c determines the normal N to a

bisecting plane passing through p, and we label the hemisphere containing c the “centroid side” of p and the other hemisphere the “normal

side” of p. Our method differs from that of Stora, et. al. in that we allow some flexibility in determining how close to the liquid surface the

surface particles are by extending the centroid side of p by a user-defined angle θ about p. A neighbor particle pn is defined to be on the

normal side of the bisecting plane if

(pn− p)

?pn− p?•

N

?N?≥ sin(θ),

and it is on the centroid side of the bisecting plane otherwise. Note that p is always considered to be on the centroid side to avoid having

to handle a special case of divide-by-zero. Given the number of normal-side particles nn, the number of centroid-side particles nc, and a

user-specified ratio threshold for determining surface particles ts, if nn/nc ≤ ts, then p is defined to be a surface particle. The normal at a

surface particle is simply the normalized vector N, and will be used to find the rendered surface normal later. We found convenient ranges

of tsto be between .3 and .7, and we use a θ of 10 degrees.

We generate the liquid surface using an efficient implicit surface polygonization algorithm and store the generated triangles to be ras-

terized or raytraced. As the liquid is moved through its environment by external forces, it may separate into distinct regions, or separate

regions may be combined into one. These independent regions must be identified and polygonalized separately. Regions are identified by

comparing distances between particles. Any two particles whose separation distance is within an inter-region threshold are considered to

be in the same region. Since we store particles in a regular grid, finding all neighbors to a particle that are within a fixed distance is a

constant-time operation. Segmenting the particle system into regions then becomes an O(n) operation.

Once the particle system has been segmented into mutually exclusive regions, each region can be converted to a surface for rendering.

We define a field function whose root will determine the surface to be generated. The function domain includes all points in the simulation

7

Page 8

Substeps MovesTime

LiquidObjectper per per

particlesparticles framesubstepframe

Paint drops6822141046 2.5 s.

Honey drop 9198396648 4.0 s.

Fan 64296878693 65 s.

Table 1: Computation time for different simulations.

environment, and the range is related to the distance from the liquid surface. The surface defined by the function loosely interpolates the

surface particles in the simulation. With this implicit function we use a piecewise-linear continuation method of polygonizing implicit

surfaces [26] to generate the triangles of the liquid surface.

Thefieldfunctionusesthelocationoftheparticlestodefinewhereasuitablesurfaceshouldbe. Wewantthesurfacetoroughlyinterpolate

the surface particles of the system and follow the contours of the region being rendered without exhibiting artifacts from individual particle

contributions.

The process we use to define the surface begins with a spherical convolution kernel whose radius r is at least the size of a particle

diameter. The kernel will be used to sample a portion of the particle system to determine how much liquid is within the kernel’s boundary.

If the kernel is completely outside the system, no particles contribute to the function value and the function is clamped to a constant whose

value is approximately the radius of the kernel. Likewise, the function is clamped to the negative of the radius if the kernel is completely

within the system. This clamping restriction is sufficient as long as the tessellation rate is smaller than the kernel diameter. To sample the

system with this kernel, we accumulate volume contributions from each particle within the kernel, weighted by the convolution function.

Using this process we can formally define an implicit function that determines the liquid surface. Let x be a sample point near the

boundary of the system, p a set of n particles in the system each having volume vithat are within distance r of point x, and let σ = 2.5.

The implicit function f defining the distance to the surface of the system is the sum of the volume of each particle within the kernel’s radius

scaled by the Gaussian function of the distance of p from x, all subtracted from a constant, λ:

f(x) = λ −

n

?

i=0

vie

−(?x−pi?)2

2σ2

.

λ is either calculated as one half the summation above, assuming the kernel is completely interior to the liquid, or it can be user-defined.

f(x) yields a monotonic distance to the surface and is positive if x is exterior to the liquid and negative if x is interior to the liquid. Note

that the distance is not in world space, but its monotonicity is all that is required by the implicit surface polygonization algorithm to generate

an isosurface.

After generating triangles representing the isosurface, we derive their vertex normals from the normals attached to surface particles. We

use a weighted average of the surface particle normals found within a sampling kernel surrounding each vertex. Again a Gaussian filter is

used, though we have noted good results from triangular filters as well. This method of normal derivation is superior to simply averaging

the triangle’s planar normals at each vertex, since a much smaller kernel can be used to average the surface particle normals than what must

be used in planar normal averaging to achieve the same degree of noise elimination.

Results

We ranthe implementation of our particle systemliquid simulationon 2Gigaherz Pentium 4with 1GB RAM.Table 1 shows thealgorithm’s

performance using various numbers of particles in several simulations. We are able to achieve a wide range of viscous liquid behavior by

adjusting the viscosity and adhesion functions for each liquid and the friction properties for objects in the scene with which liquids interact.

Figure 1 shows a spherical drop of honey falling onto a ball suspended several inches above the floor. We created a stringiness effect

underneath the ball by raising the adhesion force between the honey particles and the ball’s object particles to be greater than the gravita-

tional force. In this way, individual particles may slide across the surface of the ball to the bottom where the adhesion force between honey

particles is strong enough to pull them from the ball’s surface. Figure 5 illustrates the mixing capability of our system. Three separate

paints are allowed to mix as their liquid particles diffuse into the same region. The surface color at the generated triangle vertices is set

to the weighted average of neighboring particle colors. Finally, figure 6 illustrates a highly viscous liquid interacting with moving objects.

8

Page 9

Figure 5: Three different droplets of paint drop in succession onto a suspended gray ball. The colors begin to mix as particles from each

original paint droplet diffuse into the regions of the neighboring droplets.

Figure 6: A high viscosity gel hits the moving blades of a fan. Moving objects are easily incorporated into the simulation because all objects

are converted to particles prior to simulation time.

A sticky green gel falls onto the rotating blades of a fan. The animations cited in this paper along with others can be viewed online at:

http://rivit.cs.byu.edu/fluids/fluids.html.

Conclusion

We apply a Lagrangian motion model to a particle system to simulate viscous liquid flow in an unbounded simulation environment.

Interactions between individual particles are handled by applying adhesion forces, which are organized into an adhesion matrix. We

simulate liquid viscosity by exchanging momentum between pairs of particles, conserving momentum in the system and stabilizing the

errors accumulated by Euler timestep integration. Time stepping is done efficiently using a two-tiered approach that separates costly

operations from updating the liquid particle positions. We provide for interactions between multiple types of liquids and objects by

applying different forces to particle interactions based on their material type.

Rendering the liquids is accomplished by using a standard implicit surface polygonization algorithm, and we define an implicit function

to generate surface triangles that roughly interpolate the outermost particles on the liquid surface.

References

[1] G Miller and A Pearce. Globular dynamics: a connected particle system for animating viscous fluids. Computers & Graphics,

13(3):305–309, 1989.

[2] D Terzopoulos, J Platt, and K Fleischer. Heating and melting deformable models (from goop to glop). In Proceedings of Graphics

Interface, pages 219–226, 1989.

[3] D Tonnesen. Modeling liquids and solids using thermal particles. In Proceedings of Graphics Interface, pages 255–262, 1991.

[4] M C Potter, D C Wiggert, and M Hondzo. Mechanics of Fluids 2nd edition. Prentice Hall, 1997.

9

Page 10

[5] J Chen and N Lobo. Toward interactive-rate simulation of fluids with moving obstacles using Navier-Stokes equations. Graphical

Models and Image Processing, 57(2):107–116, 1995.

[6] N Foster and R Fedkiw. Practical animation of liquids. In Proceedings of ACM SIGGRAPH, pages 23–30, 2001.

[7] N Foster and D Metaxas. Realistic animation of liquids. Graphical Models and Image Processing, 58(5):471–483, 1996.

[8] J Stam. Stable fluids. In Proceedings of ACM SIGGRAPH, pages 121–128, 1999.

[9] D Baraff and A Witkin. Large steps in cloth simulation. In Proceedings of ACM SIGGRAPH, pages 43–54, 1998.

[10] M Desbrun, P Schroder, and A Barr. Interactive animation of structured deformable objects. In Proceedings of Graphics Interface,

pages 1–8, 1999.

[11] M Abbot and D Basco. Computational Fluid Dynamics — An Introduction for Engineers. Longman, 1989.

[12] B Schachter. Long crested wave models. Computer Graphics and Image Processing, 12:187–201, 1980.

[13] A Fournier and W T Reeves. A simple model of ocean waves. Computer Graphics, 20(4):75–84, 1986.

[14] D Peachey. Modeling waves and surf. Computer Graphics, 20(4):65–74, 1986.

[15] M Kass and G Miller. Rapid, stable fluid dynamics for computer graphics. Computer Graphics, 24(4):49–57, 1990.

[16] W T Reeves. Particle systems — a technique for modeling a class of fuzzy objects. Computer Graphics, 17(3):359–376, 1983.

[17] M Desbrun and M P Gascuel. Smoothed particles: a new paradigm for animating highly deformable bodies. In Proceedings of

Eurographics workshop on animation and simulation, pages 61–76, 1996.

[18] D Stora, P O Agliati, M P Cani, F Neyret, and J D Gascuel. Animating lava flows. In Proceedings of Graphics Interface, pages

203–210, 1999.

[19] Tasdizen, Bigler, Lefohn, and Whitaker. Particle based simulation of fluids. In Proceedings of Eurographics, pages 401–410, 2003.

[20] M Muller, D Charypar, and M Gross. Procedural modeling & animation: particle-based fluid simulation for interactive applications.

In Proceedings of ACM SIGGRAPH/Eurographics Symposium on Computer Animation, pages 154–159, 2003.

[21] N Foster and D Metaxas. Modeling the motion of hot turbulent gas. In Proceedings of ACM SIGGRAPH, pages 181–188, 1997.

[22] R Fedkiw, J Stam, and H W Jensen. Visual simulation of smoke. In Proceedings of ACM SIGGRAPH, pages 15–22, 2001.

[23] D Enright, S Marschner, and R Fedkiw. Animation and rendering of complex water surfaces. In Proceedings of ACM SIGGRAPH,

pages 736–744, 2002.

[24] M Carlson, P Mucha, R van Horn, and G Turk. Melting and flowing. In Symposium on Computer Animation, 2002.

[25] S Worley. A cellular texture basis function. In Proceedings of ACM SIGGRAPH, pages 291–294, 1996.

[26] J Bloomenthal. Introduction to Implicit Surfaces. Morgan Kaufmann, 1997.

10

#### View other sources

#### Hide other sources

- Available from Parris K. Egbert · Jan 2, 2015
- Available from psu.edu