0% found this document useful (0 votes)
47 views57 pages

2018 Introduction To Pba

Uploaded by

Waqas Zafar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views57 pages

2018 Introduction To Pba

Uploaded by

Waqas Zafar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 57

An Introduction to Physics-based Animation

ADAM W. BARGTEIL, University of Maryland, Baltimore County, United States


TAMAR SHINAR, University of California, Riverside, United States
Physics-based animation has emerged as a core area of computer graphics finding widespread application
in the film and video game industries as well as in areas such as virtual surgery, virtual reality, and training
simulations. This course introduces students and practitioners to fundamental concepts in physics-based
animation, placing an emphasis on breadth of coverage and providing a foundation for pursuing more advanced
topics and current research in the area. The course focuses on imparting practical knowledge and intuitive
understanding rather than providing detailed derivations of the underlying mathematics. The course is suitable
for someone with no background in physics-based animation—the only prerequisites are basic calculus, linear
algebra, and introductory physics.
We begin with a simple, and complete, example of a mass-spring system, introducing the principles behind
physics-based animation: mathematical modeling and numerical integration. From there, we systematically
present the mathematical models commonly used in physics-based animation beginning with Newton’s laws
of motion and conservation of mass, momentum, and energy. We then describe the underlying physical
and mathematical models for animating rigid bodies, soft bodies, and fluids. Then we describe how these
continuous models are discretized in space and time, covering Lagrangian and Eulerian formulations, spatial
discretizations and interpolation, and explicit and implicit time integration. In the final section, we discuss
commonly used constraint formulations and solution methods.
CCS Concepts: • Computing methodologies → Simulation by animation; Physical simulation;
Additional Key Words and Phrases: Animation, Dynamics/Simulation, Research
ACM Reference Format:
Adam W. Bargteil and Tamar Shinar. 2018. An Introduction to Physics-based Animation. 1, 1 (August 2018),
57 pages. https://doi.org/10.1145/3214834.3214849

Intended Audience: Beginner (Beginning PhD students and industry professionals).

Prerequisites: Calculus, Linear Algebra, Introductory Physics.

Adam W. Bargteil is an assistant professor in the Computer Science and Electrical Engineering
department at the University of Maryland, Baltimore County. His primary research interests lie in
physics-based animation, an area he has worked in since 2001. His work spans a wide range of
phenomena including rigid bodies, soft bodies, and fluids. He earned his Ph.D. in computer science
from the University of California, Berkeley and spent two years as a postdoctoral fellow in the
School of Computer Science at Carnegie Mellon University. From 2005 to 2007, he was a consultant
at PDI/DreamWorks, developing fluid simulation tools that were used in "Shrek the Third" and
"Bee Movie." He has offered full semester graduate courses on physics-based animation five times
Authors’ addresses: Adam W. Bargteil, [email protected], University of Maryland, Baltimore County, Baltimore, United
States; Tamar Shinar, [email protected], University of California, Riverside, Riverside, United States.

Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee
provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and
the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses,
contact the owner/author(s).
SIGGRAPH ’18 Courses, August 12-16, 2018, Vancouver, BC, Canada
© 2018 Copyright held by the owner/author(s).
ACM ISBN 978-1-4503-5809-5/18/08.
https://doi.org/10.1145/3214834.3214849

1
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

and has twice taught an undergraduate course on computer animation, about half of which focuses
on physics-based animation.

Tamar Shinar is an assistant professor of Computer Science and Engineering at the University of
California, Riverside, where she co-leads the Riverside Graphics Lab. She completed her Ph.D. at
Stanford University in 2008, where she developed techniques for physics-based animation of solids,
fluids, and solid-fluid coupling. She was a postdoctoral fellow at the Courant Institute at NYU,
where she developed mathematical and computational models of cell biomechanics. Her research
interests center on physics-based animation, with a particular focus on solid-fluid coupling. At UCR,
she teaches courses on computer graphics, scientific computing, and physics-based animation.

2
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

SCHEDULE

I. A Simple Start: Particle Dynamics V. Temporal Discretization


A. A Passive Particle in a Velocity Field A. Explicit
B. A Particle with Mass 1. Trapezoidal Rule vs. Midpoint
C. Spring-Mass Systems Method
II. Mathematical Models 2. Symplectic Euler
A. Physical Laws B. Implicit Integration
1. Newton’s Laws of Motion VI. Constraints
2. Conservation of Mass, Momen- A. Bilateral and Unilateral Constraints
tum, Energy B. Soft vs. Hard Constraints
B. Materials C. Penalty Forces, Lagrange Multipli-
1. Rigid Bodies ers, Generalized Coordinates
2. Soft Bodies (Elasticity) D. Practical Rigid Body Systems
3. Fluids E. Non-penetration Constraints, Colli-
III. Spatial Discretization sions, and Contact
A. Lagrangian vs. Eulerian
B. Grids, Meshes, Particles
C. Interpolation
D. Finite Differences
E. Finite Elements

A Simple Start: Particle Dynamics. To begin, we develop a complete physics-based animation


system by restricting ourselves to the simplest of models: particle systems. We introduce basic
concepts of mass, energy, forces, and velocity. We then provide a refresher on first- and second-
order differential equations and introduce numerical integration. Finally, we add springs between
particles to allow for animation of soft bodies.
Mathematical Models. We continue by introducing the physical and mathematical models
that underlie physics-based animation. We provide a refresher on Newton’s laws of motion and
then discuss the notions of conservation of mass, momentum, and energy. Then, still working
in the continuous domain, we introduce the mathematical models and equations of motion that
describe the most commonly used materials in physics-based computer animation: rigid bodies,
soft elastic bodies, and fluids.
Spatial Discretization. An important component of physics-based animation is the discretiza-
tion of spatially continuous quantities. We discuss a variety of techniques related to spatial dis-
cretization. First, we explain the difference between Eulerian and Lagrangian frames of reference,
both of which are important and widely used and give some examples of their use. We introduce
some commonly used grid-based data structures, e.g., collocated and staggered grids, and accelera-
tion structures. We then describe the use of unstructured meshes for spatial discretization, as well
as mesh-free particle-based discretizations. Interpolation techniques are critical for communicating
between different spatial discretizations, and these are discussed. Finally, we describe two common
approaches to discretization of spatial derivatives: finite differences and finite elements.
Temporal Discretization. We first introduce the explicit form of temporal discretization and
integration. We discuss truncation error and order of accuracy and point out that methods with the
same truncation error can behave differently by examining the trapezoidal rule and the midpoint
method for first-order ordinary differential equations. We then discuss explicit integrators for

3
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

second-order ordinary differential equations and advocate for the symplectic Euler method, despite
its lower order of accuracy. We then turn to implicit integration, which couples together a system
of partial differential equations. We then derive the linearly implicit Euler method by explicitly
linearizing the equations of motion for elastic bodies (avoiding the need for Taylor expansion).
Then we briefly discuss alternatives for solving the resulting linear system and the underlying
nonlinear system.
Constraints. In our final section, we discuss the use of constraints in physics-based animation.
We discuss the difference between bilateral (equality) and unilateral (inequality) constraints and
the resulting implications. We also discuss the difference between soft and hard constraints and
the enforcement of constraints through penalty forces, Lagrange multipliers, and generalized
coordinates. We then discuss how constraints are enforced in practical constrained rigid body
systems. Finally, we discuss one of the most difficult constraint problems in computer animation:
non-penetration constraints that result from collision and contact.

4
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

1 A SIMPLE START: PARTICLE DYNAMICS


In this section, we develop a complete physics-based animation system by restricting ourselves to
the simplest of models: particle systems. We introduce basic concepts of mass, energy, forces, and
velocity. We also provide a refresher on first- and second-order differential equations and introduce
numerical integration. Finally, we add springs between particles to allow for animation of soft
bodies.

1.1 A passive particle in a velocity field


In the simplest particle systems, mass-less particles are advected through given velocity fields. As
simple as this case is, talented animators can create compelling animations by varying the velocity
fields over space and time. Sometimes the velocity fields are even the result of another simulation.
When advecting a passive particle through a given velocity field, we only need to track the
particle’s position through time. We must also be able to evaluate the velocity field at a given point
in space and at a given instant of time. Thus, we assume that we have a function 𝐯(𝐱, 𝑡) that will
provide us with a velocity 𝐯 at a position, 𝐱, and time, 𝑡 . A particle’s position, which varies over
time, 𝐱𝑝 (𝑡) is then the solution of an Initial Value Problem:
𝐱𝑝 (0) = 𝐱0
𝑑𝐱𝑝 (𝑡) (1)
= 𝐱̇ 𝑝 (𝑡) = 𝐯(𝐱𝑝 , 𝑡),
𝑑𝑡
where the the initial position of the particle, at time 0, is given as 𝐱0 and the change in position
is determined by the velocity field. Here the overdot is a common shorthand to denote a time
derivative. Because we described the particle’s position by describing how it changes, the second
equation is a differential equation. This differential equation is known as an Oridinary Differential
Equation (ODE) because it only involves a single derivative, in this case, with respect to time.
Moreover, this equation is a First-order ODE because we are only taking a single derivative with
respect to time. Later, we will see both second-order systems and partial differential equations
(PDE).
For very simple velocity fields, we could solve this initial value problem analytically, but in the
general case we will need to use numerical integration to solve this system. The intuition behind the
simplest method, known as Euler integration, can be found by looking at the continuous definition
of the derivative,
𝑑𝐱𝑝 (𝑡) 𝐱𝑝 (𝑡 + 𝜖) − 𝐱𝑝 (𝑡)
= lim . (2)
𝑑𝑡 𝜖 →0 𝜖
To approximate this equation discretely, we simply replace the limit as 𝜖 → 0 with a finite value
𝜖 = Δ𝑡 ,
𝑑𝐱𝑝 (𝑡) 𝐱𝑝 (𝑡 + Δ𝑡) − 𝐱𝑝 (𝑡)
≈ . (3)
𝑑𝑡 Δ𝑡
Substituting into Equation (1)
𝐱𝑝 (𝑡 + Δ𝑡) − 𝐱𝑝 (𝑡)
= 𝐯(𝐱𝑝 , 𝑡) (4)
Δ𝑡
and performing some manipulation, we have
𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + Δ𝑡 ⋅ 𝐯(𝐱𝑝 , 𝑡). (5)
Given that the initial value problem gives us 𝐱𝑝 (0), we can now use Equation (5) to trace the
particle forward through time. More advanced and accurate techniques exist, of course, and we will
postpone the discussion of these until Section 4. One thing to note here, is that as the timestep, Δ𝑡 ,

5
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

is decreased the approximation in Equation (3) becomes more accurate, resulting in a better solution
to the initial value problem. However, that better solution comes at the cost of longer computation
time as a larger number of timesteps are required to cover the same amount of simulated time.

1.2 A particle with mass


A real-world object’s motion is governed by internal and external forces that affect the object’s
acceleration through Newton’s second law of motion, 𝐟 = 𝑚𝐚. Thus to introduce forces, such as
gravity, into our particle systems we must also introduce mass. Our initial value problem then
becomes
𝐱𝑝 (0) = 𝐱0
𝑑 2 𝐱𝑝 (𝑡) 𝐟(𝐱𝑝 , 𝑡) (6)
= 𝐱̈ 𝑝 (𝑡) = .
𝑑𝑡 2 𝑚𝑝
It is often convenient to rewrite this second-order differential equation as a system of coupled
first-order equations,
𝐱𝑝 (0) = 𝐱0
𝐯𝑝 (0) = 𝐯0
𝑑𝐱𝑝 (𝑡) (7)
= 𝐱̇ 𝑝 (𝑡) = 𝐯𝑝 (𝑡)
𝑑𝑡
𝑑𝐯𝑝 (𝑡) 𝐟(𝐱𝑝 , 𝑡)
= 𝐯̇ 𝑝 (𝑡) = .
𝑑𝑡 𝑚𝑝
As before we can numerical solve this initial value problem by integrating forward in time using
Euler’s method:
𝐟(𝐱𝑝 , 𝑡)
𝐯𝑝 (𝑡 + Δ𝑡) = 𝐯𝑝 (𝑡) + Δ𝑡 ⋅
𝑚𝑝 (8)
𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + Δ𝑡 ⋅ 𝐯𝑝 (𝑡 + Δ𝑡).
This particular integration scheme is commonly referred to as symplectic Euler and is, in many
cases, the best choice among the simple integration schemes.
The particle system designer can specify a wide variety of forces such as gravitational forces
around a point, line, or (ground) plane, damping, and penalties for violating constraints. An early
example of such systems was detailed in 1990 by Sims [1990] and was used to create the animated
short Particle Dreams.
In a particle system implementation, a Particle structure would typically store, at a minimum:
mass, position, velocity, and a force accumulator.1 Most implementations allow particles to have
arbitrary attributes such as color, size, age, type, etc. A typical simulation will have an outer
loop that takes timesteps. Each timestep typically contains three loops. The first iterates over the
particles initializing the force accumulators. The second iterates over the forces, applying them to
the affected particles. The third updates the particles velocities and positions using Equation (8).

1 While it is conceptually convenient to imagine a Particle structure, many practical implementations do not store all a
particle’s data contiguously. Instead, a ParticleSystem will store multiple single-datum arrays (i.e. separate arrays for
positions, velocities, and force accumulators). Doing so increases efficiency because it avoids loading unnecessary data into
the cache. For example, a particle’s position is not needed to zero out its force accumulator.

6
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

1.3 Spring-mass systems


In the sort of particle systems thus far described, the particles can be subjected to a wide range of
forces, but they do not interact. Allowing the particles to interact enables the creation of particle
systems that can be used to animate a wide range of physical phenomena from hair to water to
clothing. The simplest mechanism for particle interaction is to apply spring forces between particles.
The resulting systems are typically called spring-mass or mass-spring systems.
The simplest formulation of a spring force involves a mass attached to the origin with a zero
length spring and is often expressed as
𝐟 = −𝑘𝐝 (9)
where 𝑘 is Hooke’s spring constant and 𝐝 is the displacement. Using the notation we have been
using, we would replace 𝐝 with 𝐱𝑝
𝐟 𝑝 = −𝑘𝐱𝑝 . (10)
This can be generalized to a spring with a given rest length 𝑟 as
−𝐱𝑝
𝐟 𝑝 = 𝑘 (‖𝐱𝑝 ‖ − 𝑟 ) . (11)
‖𝐱 ‖
𝑝
Here we have a force that is proportional to the difference between the spring’s current length
and its rest length, in the direction from the particle to the origin. Unfortunately, in this form, the
term (‖𝐱𝑝 ‖ − 𝑟 ) has units of meters, which means that if the resolution increases the forces get
smaller. That is, if a single spring is replaced by two springs the force on the particle is half as
large and 𝑘 must be adjusted to maintain similar behavior. It is better to divide by 𝑟 and use the
dimension-less quantity (‖𝐱𝑝 ‖/𝑟 − 1). This dimension-less quantity is known as a strain measure
and will be discussed in more detail in Section 2.2.2. Because strain is dimension-less, our parameter
𝑘 is now a material parameter independent of the discretization. Our force then becomes
‖𝐱𝑝 ‖ −𝐱𝑝
𝐟𝑝 = 𝑘 −1 . (12)
( 𝑟 ) ‖𝐱𝑝 ‖
We can generalize further by placing the other end point at an arbitrary point in space 𝐱𝑞 . Then
our force becomes
‖𝐱𝑞 − 𝐱𝑝 ‖ 𝐱𝑞 − 𝐱𝑝
𝐟𝑝 = 𝑘 −1 . (13)
( 𝑟 ) ‖𝐱𝑞 − 𝐱𝑝 ‖
From Newton’s third law we know that the force on particle 𝑞 must be 𝐟 𝑞 = −𝐟 𝑝 .
So far we have a model for ideal elastic bodies, but in nature internal friction converts some elastic
energy into heat. This phenomenon is called damping. We can enhance our model by including an
additional damping force, which depends on the relative velocities between the particles:
𝐯𝑞 − 𝐯𝑝 𝐱𝑞 − 𝐱𝑝 𝐱𝑞 − 𝐱𝑝
𝐟 𝑝 = 𝑘𝑑 ⋅ . (14)
(
𝑟 )
‖𝐱𝑞 − 𝐱𝑝 ‖ ‖𝐱𝑞 − 𝐱𝑝 ‖
Putting together the elastic and damping forces and rearanging terms we get,
‖𝐱𝑞 − 𝐱𝑝 ‖ (𝐯𝑞 − 𝐯𝑝 ) ⋅ (𝐱𝑞 − 𝐱𝑝 ) 𝐱𝑞 − 𝐱𝑝
𝐟 𝑝 = 𝑘𝑠 − 1 + 𝑘𝑑 . (15)
[ ( 𝑟 ) ( 𝑟 ‖𝐱𝑞 − 𝐱𝑝 ‖ )] ‖𝐱𝑞 − 𝐱𝑝 ‖
In code, the simulation loop might look something like the listing in Algorithm 1

7
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Algorithm 1 Spring-Mass System Timestep Loop


1: for Particle p : particles do
2: p.frc = 0
3: p.frc += p.mass*gravity
4: end for
5: for Spring s : springs do
6: Vec3 d = particles[s.j].pos - particles[s.i].pos
7: double l = mag(d)
8: Vec3 v = particles[s.j].vel - particles[s.i].vel
9: Vec3 frc = (k_s*((l / s.r) - 1.0) + k_d*dot(v / s.r, d / l)) * (d / l)
10: particles[s.i].frc += frc
11: particles[s.j].frc -= frc
12: end for
13: for Particle p : particles do
14: p.vel += dt*(p.frc / p.mass)
15: p.pos += dt*(p.vel)
16: end for

2 MATHEMATICAL MODELS
In this section we introduce the mathematical models that govern motion. This field of study is
often referred to as Continuum Mechanics because the models assume that the underlying materials
are continuous, which is a reasonable assumption at the scales and for the phenomena we are
generally concerned with. In the following sections we will discuss how numerical methods are
employed to discretize these models to obtain computational solutions.

2.1 Physical Laws


Much of physics-based simulation is based on the the formulation of classical mechanics developed
by Isaac Newton, which he published in his tome The Principia in 1687. In that work, he described
several laws of motion that remain fundamental in the modeling, analysis, and simulation of the
types of mechanical systems that we are interested in here. Another distinct formulation of classical
mechanics is variational or analytical mechanics, which is based on the principle of least action,
and also has significant use in physics-based animation. We will revisit concepts from variational
mechanics in discussing rigid bodies and constraints. Here, we focus on the fundamental laws of
Newtonian mechanics.

2.1.1 Newton’s Laws of Motion. Newton’s laws describe the dynamics of a body that can be
idealized as a particle, or point mass. Newton used these laws to study many systems, including the
motion of planets over large distances. While Newton’s laws do not address the extent of the body,
the distribution of its mass, and its internal forces, they can be applied to systems such as soft bodies
or fluids by viewing these as collections of particles and characterizing all of the inter-particle
forces.
Newton’s first law. Newton’s first law states that a body remains at rest or moves with a
constant velocity unless acted upon by a force. This is also called the law of inertia and the motion
described is called uniform motion.
Newton’s second law. Newton’s second law is fundamental in computing the evolution in time
of the state of a body. Newton’s famous second law, 𝐟 = 𝑚𝐚, states that the instantaneous change

8
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

in the momentum of a body is equal to the net force acting on the body. The momentum of a body
is given by
𝐩(𝑡) = 𝑚𝐯(𝑡), (16)
where 𝑚 is the mass of the body and 𝐯 is the velocity of the body. The mathematical expression of
Newton’s second law is
𝑑 𝑑
𝐟(𝑡) =𝐩(𝑡) = 𝑚 𝐯(𝑡) = 𝑚𝐚(𝑡). (17)
𝑑𝑡 𝑑𝑡
Therefore, application of Newton’s second law to a physical system is done by identifying all of
the bodies in the system and identifying the forces acting on each body. For example, in Figure 1,

Fig. 1. A particle of mass 𝑚 is subject to a spring force 𝐟 𝑠 , a graviational force 𝐟 𝑔 , and an unspecified
external force 𝐟 𝑒 . Given the forces, Newton’s second law gives the acceleration of the particle, which is
then used to compute a new velocity and position of the particle.

a particle of mass 𝑚 experiences a spring force 𝐟 𝑠 from a neighboring particle, the gravitational
force 𝐟 𝑔 , and another unspecified external force 𝐟 𝑒 . By Newton’s second law, the acceleration of
the particle is given by
𝑚𝐚 = 𝐟 𝑠 + 𝐟 𝑔 + 𝐟 𝑒 . (18)
Given the forces, the acceleration is used to update the velocity of the body, and the velocity is
used to update the position of body.
Newton’s third law. Newton’s third law states that for every action, there is an equal and
opposite reaction. Specifically, in an interaction between two particles or bodies, if body A applies
force 𝐟 to body B, then body B applies force −𝐟 to body A. We can use this law to help identify all
of the forces acting on the bodies in a given scenario. For example, in the image below, a particle of
mass 𝑚1 is connected by spring to a particle of mass 𝑚2 . If the spring force experienced by the

particle of mass 𝑚1 is 𝐟 , then Newton’s third law requires that the spring force experienced by the
particle of mass 𝑚2 is −𝐟 . Note that by Newton’s second law, if their masses are unequal, then their
accelerations due to the spring force will necessarily be unequal. In particular, the lighter particle
will experience a larger acceleration, while the heavier particle experiences a smaller acceleration.
Consider another example, illustrated below, where a particle of mass 𝑚 is resting on the ground.
The particle exerts a force on the ground equal to 𝐟 = −𝑚𝐠. By Newton’s third law, the ground

9
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

exerts a reaction force on the particle equal to −𝐟 = 𝑚𝐠. Therefore, forces acting on the particle are
the force of gravity −𝑚𝐠 and the reaction force from the ground 𝑚𝐠. By Newton’s second law,
𝑚𝐚 = −𝑚𝐠 + 𝑚𝐠 = 𝟎, (19)
so that the particle remains at rest on the ground.
Finally, consider an example where a moving particle of mass 𝑚1 collides with a moving particle
of mass 𝑚2 , illustrated below. Due to the collision, each particle feels a force, such that after the

collision the relative velocity of the particles is at least zero to prevent their interpenetration. By
Newton’s third law, the forces on the particles must be a pair of action/reaction forces. Notably,
since the change in momentum of each particle is equal to the force acting on it, Newton’s third
law implies here that the total momentum of the particles before the collision will be equal to the
total momentum of the particles after the collision, i.e., the total momentum of the system will be
conserved.
2.1.2 Conservation of Mass, Momentum, Energy. The physical principles of conservation of
mass, linear and angular momentum, and energy are also of central importance in physics-based
animation. A conserved quantity is one which cannot be created or destroyed.
Newton’s second law tells us that if there is no net force acting on a particle, then
𝑑
𝑚𝐯(𝑡) = 𝟎 ⇒ 𝑚𝐯(𝑡) = constant, (20)
𝑑𝑡
i.e., the momentum of the particle is conserved. By Newton’s third law, every action has an equal
and opposite reaction, which also leads to conservation of linear and angular momentum in a
closed system of interacting particles.
The principle of conservation of energy tells us that energy cannot be created or destroyed, but
can only change form, so that the total energy in a closed system remains constant. For example,
consider an object of mass 𝑚 dropped with zero initial velocity in a vacuum (so that there is no loss
of energy to air friction) from a height ℎ0 . Initially the object has potential energy 𝑚𝑔ℎ0 due to
the force of gravity. As the object falls, the potential energy is converted to kinetic energy 21 𝑚𝑣 2 ,
where 𝑣 = ‖𝐯‖ is the speed of the object. Since total energy is conserved and equal to the initial
energy 𝑚𝑔ℎ0 , we have
1
𝑚𝑔ℎ(𝑡) + 𝑚𝑣(𝑡)2 = 𝑚𝑔ℎ0 (21)
2√
⇒ 𝑣(𝑡) = 2(𝑔ℎ0 − 𝑔ℎ(𝑡)). (22)

10
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Therefore, using the principle of conservation


√ of energy, we can conclude, for example, that the
object will be traveling with speed 2𝑔ℎ0 when in hits the ground.
Conservation laws for continua. The principles of conservation of mass, momentum, and
energy are also used in the field of continuum mechanics to derive the equations describing the
behavior of continua. These are materials such as soft bodies and fluids, modeled as being made
of up of a continuum of matter rather than discrete particles, an assumption that is appropriate
for the spatial scales of interest in physics-based animation. In this case, given a continuum of
material, we consider the rate of change of the conserved quantity in an arbitrary control volume Ω
with boundary 𝜕Ω, as illustrated below. Imagine that the material is a fluid, and that 𝐯(𝐱, 𝑡) is the

time-varying velocity field of the fluid. The total mass in the region Ω is given by ∫Ω 𝜌𝑑𝑉 where 𝜌
is the fluid density and 𝑑𝑉 is a volume element. Conservation of mass tells us that the total amount
of mass in the fixed region Ω can only change in time due to flow of mass into or out of Ω through
its boundary 𝜕Ω. Mathematically, this is expressed as
𝑑
𝜌𝑑𝑉 = − ∮ 𝜌𝐯(𝐱, 𝑡) ⋅ 𝐧(𝐱)𝑑𝑆, (23)
𝑑𝑡 ∫Ω 𝜕Ω
where 𝐧(𝐱) is the outward unit normal on 𝜕Ω. Applying the divergence theorem to the right hand
side, and moving all terms to the left hand side gives
𝜕𝜌
∫ 𝜕𝑡 + ∇ ⋅ (𝜌𝐯) 𝑑𝑉 = 0. (24)
Ω
Since the control volume was arbitrary and this must hold for any control volume, we get that
𝜕𝜌
+ ∇ ⋅ (𝜌𝐯) = 0. (25)
𝜕𝑡
More details can be found in [Landau and Lifshitz 1959].
These conservation laws are local rather than global, so that if we lose mass in one part of the
domain but add it in another, such that the total global mass is conserved, the conservation law
would still be violated. In a simulation, this would amount to seeing a volume of fluid disappear
in one part of the domain and magically appear in another, a situation that is not desirable. The
local nature of the conservation laws means that mass, momentum, and energy should be locally
conserved everywhere.
In general, a local conservation law takes the form
𝜕𝑢
+ ∇ ⋅ 𝐟(𝑢) = 0, (26)
𝜕𝑡
where 𝑢 is the conserved quantity, and 𝐟(𝑢) is the flux function, representing the flow through the
boundary of the conserved quantity.
It is also possible to include sources or sinks on the right hand side of (23). These functions
are used to model the addition or removal of the conserved quantity through interaction with an
external system.

11
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

2.2 Materials
Physics-based animation is used for a wide variety of materials: rigid bodies which are idealized to
have no deformation, soft bodies that deform elastically and plastically, fluids such as air, water,
honey, and others materials such as sand and snow. In this section, we introduce the mathematical
models describing soft bodies, rigid bodies, and fluids. These models and their combinations form
the basis for most materials considered in physics-based animation.
2.2.1 Rigid Bodies.

(b) Simulation of rigid barrels, augmented with


example-based deformations. Reproduced from
(a) Simulation of rigid bodies coupled to elastic cloth.
[Jones et al. 2016].
Reproduced from [Sifakis et al. 2007].

Fig. 2. Examples of rigid body simulations.

Introduction. We saw previously that a system of particles connected by springs can be used
to model an elastic object. In many cases, we are interested in modeling very stiff objects for which
we are not concerned with elastic deformation. We could use a particle system connected with very
stiff springs, but this representation is inefficient compared to a rigid body approximation. A rigid
body is a object whose points are constrained to be at a fixed distance from one another, i.e., it is
assumed to not undergo any deformation. In this idealized limit, the position of all points on the
object can be describe with six degrees of freedom. First, the center of mass of the object can be
at any point in three-dimensional space, giving three positional degrees of freedom. Second, the
object can be oriented in any way about that center of mass, given three orientational degrees of
freedom. Using the constraint that all points in the rigid body remain a fixed distance from one
another, we arrive at a special form for the laws of motion of a rigid body.
For further reading, a thorough introduction to rigid body simulation can be found in [Baraff
2001].
Kinematics. Though we will use rigid bodies to model very stiff continuous media, for the
purposes of deriving the rigid body properties and laws, it is convenient to think of the rigid body
as composed of discrete particles labeled 𝑖 = 1, ⋯ , 𝑁 , each with mass 𝑚𝑖 . In what follows, discrete
sums over the constituent particles can be replaced with continuous integrals to derive the results.
The center of mass, 𝐱𝑐𝑜𝑚 of the rigid body is the mass-weighted average position of the rigid
body’s constituent particles,
∑𝑁
𝑖=1 𝑚𝑖 𝐩𝑖
𝐱𝑐𝑜𝑚 = . (27)
∑𝑁
𝑖=1 𝑚𝑖

12
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

(a) Object space. (b) World space.

Fig. 3

It is convenient to fix a coordinate system to the body, with its origin at the body’s center of mass.
Coordinates of points on the body relative to this fixed coordinate system are said to be in object
space. In constrast, the usual common space in which all objects are defined is now referred to
as world space. As the body translates and rotates over time, its center of mass and constituent
particles will move in space. Hence, while the object space coordinates of the body particles are
fixed, the world space coordinates generally change over time. A rigid body in object space and
world space is depicted in Figure 3.
Consider a particle of the rigid body with object space position 𝐫0 . At time 𝑡 , the position of the
body center of mass is given by 𝐱(𝑡), and the orientation of the body can be described by a rotation
matrix 𝐑(𝑡) about the center of mass. Therefore, the world space position of the particle is given by
𝐩(𝑡) = 𝐱(𝑡) + 𝐑(𝑡)𝐫0 . (28)
We will also write
𝐫(𝑡) = 𝐑(𝑡)𝐫0 , (29)
to represent the rotated particle position about the center of mass, so that 𝐩(𝑡) = 𝐱(𝑡) + 𝐫(𝑡) as
shown in Figure 3b.
The velocity of a particle of the rigid body can be found by differentiating (28) with respect to
time, to get
̇ = 𝐱(𝑡)
𝐯(𝑡) = 𝐩(𝑡) ̇
̇ + 𝐑(𝑡)𝐫0. (30)
Linear and Angular Velocity. The velocity of the rigid body center of mass, 𝐱(𝑡) ̇ , is referred
as the rigid body linear velocity, and is analogous to the velocity of a single particle. Notice that the
motion of a particle on the body in Eq. (30) contains this term. It is the component of the motion of
̇
the particle due to the linear velocity of the body. If the body is not rotating, i.e., 𝐑(𝑡) = 0, then
̇ , and the velocity of the particle is identical to the velocity of the body center of mass.
̇ = 𝐱(𝑡)
𝐩(𝑡)
̇
For a rigid body that is rotating, 𝐑(𝑡) ̇
≠ 0. Let us examine this term further. This term 𝐑(𝑡)𝐫 0 in
Eq. (30) represents the component of motion of the particle due to the instantaneous rotation of
the body about its center of mass. Euler’s rotation theorem tells us that this instantaneous rotation

13
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

must be equivalent to a rotation about a single axis that runs through the center of mass. We let 𝝎
be the vector whose direction is the instantaneous axis of rotation and whose length is the rate of
rotation in radians per second. Figure 4 illustrates the motion of the point 𝐩 due to the rotation. Let

Fig. 4. For a body with angular velocity 𝝎 , a point at 𝐫 on the body relative to the body center of
mass rotates about about the center of mass with velocity 𝝎 × 𝐫.

𝜃 be the angle between 𝝎 and 𝐫, and 𝑟 = ‖𝐫‖. Since the point rotates ‖𝝎 ‖ radians/sec on a circle of
radius 𝑟 sin 𝜃 , the speed of motion of the particle is ‖𝝎 ‖‖𝐫‖ sin 𝜃 , and the direction of motion of the
particle is perpendicular to 𝝎 and 𝐫 and given by the right-hand rule. Hence, we have that
̇
𝐑(𝑡)𝐫0 = 𝝎(𝑡) × 𝐫(𝑡). (31)

Therefore, we can rewrite the velocity of the particle in Eq. (30) as

̇ = 𝐱(𝑡)
𝐯(𝑡) = 𝐩(𝑡) ̇ + 𝝎(𝑡) × 𝐫(𝑡). (32)

The vector 𝝎(𝑡) is called the angular velocity of the body.


Note also that since 𝐫(𝑡) = 𝐑(𝑡)𝐫0 ,
̇
𝐑(𝑡)𝐫 0 = 𝝎(𝑡) × 𝐑(𝑡)𝐫0 , (33)

and as this holds for any vector 𝐫0 , we have


̇
𝐑(𝑡) = 𝝎(𝑡) × 𝐑(𝑡), (34)

where the cross product is understood to apply to each column of the matrix.

Linear Momentum. The momentum of the rigid body is given by the sum of the momenta of
its constituent particles,
𝑁
𝐏(𝑡) = ∑ 𝑚𝑖 𝐯𝑖 (𝑡). (35)
𝑖=1

14
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Using Eq. (32) to substitute for 𝐯𝑖 (𝑡), we get


𝑁
̇ + 𝝎(𝑡) × 𝐫𝑖 (𝑡))
𝐏(𝑡) = ∑ 𝑚𝑖 (𝐱(𝑡) (36)
𝑖=1
𝑁 𝑁
̇ + 𝝎(𝑡) ×
= ∑ 𝑚𝑖 𝐱(𝑡) ∑ 𝑚𝑖 𝐫𝑖 (𝑡) . (37)
𝑖=1 (𝑖=1 )
Because the 𝐫𝑖 are defined relative to the center of mass of the object, the last sum in the above
equation is zero. Let 𝑀 = ∑𝑁
𝑖=1 𝑚𝑖 be the total mass of the body. Then the linear momentum of the
body is simply
̇
𝐏(𝑡) = 𝑀 𝐱(𝑡). (38)
Angular Momentum. The angular momentum of the body is given by the sum of the angular
momenta of its constituent particles,
𝑁
𝐋(𝑡) = ∑ 𝐫𝑖 (𝑡) × 𝑚𝑖 𝐯𝑖 (𝑡). (39)
𝑖=1
Using Eq. (32) to substitute for 𝐯𝑖 (𝑡), we get
𝑁
̇ + 𝝎(𝑡) × 𝐫𝑖 (𝑡))
𝐋(𝑡) = ∑ 𝑚𝑖 𝐫𝑖 (𝑡) × (𝐱(𝑡) (40)
𝑖=1
𝑁 𝑁
̇ + ∑ 𝑚𝑖 𝐫𝑖 (𝑡) × 𝝎(𝑡) × 𝐫𝑖 (𝑡).
= ∑ 𝑚𝑖 𝐫𝑖 (𝑡) × 𝐱(𝑡) (41)
𝑖=1 𝑖=1
The first sum is again equal to zero, simplifying the expression for the body angular velocity to
𝑁
𝐋(𝑡) = ∑ 𝑚𝑖 𝐫𝑖 (𝑡) × (𝝎(𝑡) × 𝐫𝑖 (𝑡)). (42)
𝑖=1
Since 𝝎 does not depend on 𝑖 , we’d like to pull it out of the sum. First, we’ll use the fact that
𝝎 × 𝐫 = −𝐫 × 𝝎 , to write
𝑁
𝐋(𝑡) = ∑ 𝑚𝑖 𝐫𝑖 (𝑡) × (−𝐫𝑖 (𝑡) × 𝝎(𝑡)). (43)
𝑖=1
To further simplify the remaining term, it is helpful to switch from cross product notation to matrix
notation, after which we can use more familiar matrix algebra. For a vector 𝐫 = (𝑟𝑥 , 𝑟𝑦 , 𝑟𝑧 )𝑇 , and
any vector 𝝎 , the result of computing 𝐫 × 𝝎 is equivalent to premultiplying 𝝎 by the matrix2
⎛ 0 −𝑟𝑧 𝑟𝑦 ⎞
𝐫⋆ = ⎜ 𝑟𝑧 0 −𝑟𝑥 ⎟ . (44)
⎜ ⎟
⎝−𝑟𝑦 𝑟𝑥 0 ⎠
Note that like the cross product operator, this matrix is skew-symmetric, i.e., −𝐫⋆ = 𝐫⋆𝑇 . Therefore,
we can replace the expression 𝐫𝑖 × with 𝐫⋆𝑖 , and, −𝐫𝑖 × with 𝐫⋆𝑇
𝑖 in the above to get
𝑁
𝐋(𝑡) = ∑ 𝑚𝑖 𝐫⋆𝑖 (𝑡)(𝐫⋆𝑇
𝑖 (𝑡)𝝎(𝑡)) (45)
𝑖=1
𝑁
= ∑ 𝑚 𝐫⋆ (𝑡)𝐫⋆𝑇
𝑖 (𝑡)) 𝝎(𝑡). (46)
(𝑖=1 𝑖 𝑖
(47)
2 Other authors and communities use a variety of other symbols for 𝐫⋆ : 𝐫∗ , 𝐫× , 𝐫̂ , [𝐫], and 𝐫̃

15
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Notice that the term in parentheses depends only on the masses of the particle and their geometric
distributions. This 3 × 3 matrix is called the inertia tensor of the body, and is often denoted by
𝑁
𝐈(𝑡) = ∑ 𝑚𝑖 𝐫⋆𝑖 (𝑡)𝐫⋆𝑇
𝑖 (𝑡). (48)
𝑖=1
The inertia tensor describes the distribution of mass in a rigid body and can be readily computed
directly from a closed triangle mesh. With the inertia tensor, we can write
𝐋(𝑡) = 𝐈(𝑡)𝝎(𝑡). (49)
Though it depends on time, we can also express the inertia tensor as a transformation of the
object space inertia tensor by noting that 𝐫⋆ 𝐫⋆𝑇 = 𝐫𝑇 𝐫𝜹 − 𝐫𝐫𝑇 , where 𝜹 is the 3 × 3 identity matrix,
and substituting 𝐫 = 𝐑𝐫0 to get
𝑁
𝐈(𝑡) = ∑ 𝑚𝑖 𝐫⋆𝑖 (𝑡)𝐫⋆𝑇
𝑖 (𝑡) (50)
𝑖=1
𝑁
= ∑ 𝑚𝑖 (𝐫𝑇𝑖 𝐫𝑖 𝜹 − 𝐫𝑖 𝐫𝑇𝑖 ) (51)
𝑖=1
𝑁
= 𝐑(𝑡) ∑ 𝑚𝑖 (𝐫𝑇0𝑖 𝐫0𝑖 𝜹 − 𝐫0𝑖 𝐫𝑇0𝑖 ) 𝐑(𝑡)𝑇 (52)
𝑖=1
= 𝐑(𝑡)𝐈0 𝐑(𝑡)𝑇 . (53)
Thus, the inertia tensor at time 𝑡 is the constant object-space inertia tensor 𝐈0 transformed to
account for the current body orientation.
Force and Torque. Newton’s second law relates the time rate of change of momentum of a
body to the net force on the body. In the case of a rigid body, Newton’s second law takes the form
𝑑 𝐏(𝑡) 𝐟(𝑡)
= , (54)
𝑑𝑡 ( 𝐋(𝑡) ) ( 𝝉(𝑡) )
where 𝐟 is the net force on the body, and 𝝉 is the net torque on the body.
If a force 𝐟 is applied to a rigid body at its center of mass, then the body responds as if it was a
particle with mass 𝑀 , that is, its particles undergo an acceleration 𝐚 = 𝐟/𝑀 . When a force is applied
to the body at a point other than its center of mass, this may generate a torque as well. The torque
due to an applied force at a point 𝐩 located at 𝐫 from the center of mass is equal to
𝝉 = 𝐫 × 𝐟. (55)
Since the magnitude of the torque is ‖𝝉 ‖ = ‖𝐫‖‖𝐟 ‖ sin 𝜃 , where 𝜃 is the angle between 𝐫 and 𝐟 , the
torque can be increased by increasing either the applied force or the distance at which it is applied.
Summary. In summary, if we define the auxiliary quantities, 𝐯(𝑡), 𝐈(𝑡), and 𝝎(𝑡) as,
𝐏(𝑡)
𝐯(𝑡) = , 𝐈(𝑡) = 𝐑(𝑡)𝐈0 𝐑(𝑡)𝑇 , and 𝝎(𝑡) = 𝐈(𝑡)−1 𝐋(𝑡), (56)
𝑀
then the update to the state of the rigid body is given by,
⎛ 𝐱(𝑡) ⎞ ⎛ 𝐯(𝑡) ⎞
𝑑 ⎜𝐑(𝑡)⎟ ⎜𝝎 ⋆ (𝑡)𝐑(𝑡)⎟
⎜ 𝐏(𝑡) ⎟ = ⎜ 𝐟(𝑡) ⎟ . (57)
𝑑𝑡 ⎜ ⎟ ⎜ ⎟
⎝ 𝐋(𝑡) ⎠ ⎝ 𝝉(𝑡) ⎠
2.2.2 Soft Bodies.

16
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Introducing Elasticity into Newton’s Second Law. To model soft bodies we incorporate
elastic and damping forces into Newton’s second law, 𝐟 = 𝑀𝐚. Elastic forces are often expressed
as a function of displacements, 𝐝, so that zero displacement results in zero force, but can also be
written as a function of position, 𝐱. Damping forces are usually a function of velocity, which is the
time deriviative of 𝐝 or 𝐱,
𝑑𝐱 𝑑𝐝 ̇
= = 𝐱̇ = 𝐝, 𝐯= (58)
𝑑𝑡 𝑑𝑡
where an overdot is shorthand for a time derivative. The resulting dynamic system is
𝐊(𝐝) + 𝐃(𝐝)̇ + 𝐌𝐝̈ = 𝐟 𝑒𝑥𝑡 , (59)
̇
where 𝐊(𝐝) represents internal elastic forces, 𝐃(𝐝) represent damping forces, 𝐌 is the mass matrix,
and 𝐟 𝑒𝑥𝑡 is external forces (such as gravity or wind). After discretization both 𝐊 and 𝐃 will be
matrices as well, with 𝐊 referred to as the “stiffness” matrix and 𝐃 as the “damping” matrix. The
stiffness matrix, which determines the magnitude of elastic forces, is the negative of the Jacobian
of the the elastic forces with respect to position, 𝐊 = −𝜕𝑓 /𝜕𝑥 and is positive semi-definite. It is also
the negative Hessian of the elastic energy, 𝐊 = −𝜕 2 𝜂/𝜕𝑥𝑖 𝜕𝑥𝑗 , which makes clear that 𝐊 encodes the
elastic relationships between particles in the system. In the commonly adopted Rayleigh damping
model, 𝐃 = 𝜆𝐊 + 𝜇𝐌. 3 Notice the similarity to the damped zero-length Hookean spring,
̇
𝐟 = −𝑘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5Fo5XHLPvVS+7df/Dw0cHj9MnTZ89f9Acvz33dOgkTWevaXRbCg1YWJqhQw2XjQJhCw0Vx9WntX1yD86q2X3HVQG7E3KpKSYFRmvVf8XG3DFxDhUeRtmGWcafmC3w/6w+zUbYBvUvYjgzJDmezQY/xspatAYtSC++nLGsw74RDJTWElLceGiGvxBymkVphwOfd5g+BvotKSavaxWORbtR/JzphvF+ZIiaNwIXf99bi/7xpi9XHvFO2aRGs3C6qWk2xputCaKkcSNSrSIR0Kr6VyoVwQmKsLeUWvsnaGGHLjo/DlOUdX+9QuL2LqhuyEMLtYImh46egUVDct5Z/rWVIY8lsv9K75PzDiGUj9iUbnox3dR+Q1+QtOSKMHJMT8pmckQmR5Dv5QW7Iz97vJE0GyeE2mvR2M4fkFpI3fwCqqbl9</latexit>
sha1_base64="iQiV+xIdnNHtqMJYkPZnWHDNY+g=">AAACYnicbVDLjhMxEHSG1zI8NoETgoNFQFou0QxCgmMUOHBcJLK7UjyKPJ6exFrbM7J7IJFl8TVc4Xu48yE4DxBkaclyuapa3a6yVdJhlv3oJdeu37h56+h2eufuvfvH/cGDM9d0VsBUNKqxFyV3oKSBKUpUcNFa4LpUcF5evt3o55/AOtmYj7huodB8YWQtBcdIzfuP2MSvAlNQ40mEXZhnzMrFEl/M+8NslG2LXgX5HgzHz8i2TueDXs6qRnQaDArFnZvlWYuF5xalUBBS1jloubjkC5hFaLgGV/jtHwJ9HpmK1o2NxyDdsn93eK6dW+syOjXHpTvUNuT/tFmH9ZvCS9N2CEbsBtWdotjQTSC0khYEqnUEXFgZd6ViyS0XGGNLmYHPotGam8qzSZjlhWebGRJ3d1n7YR5C+NdYYfDsHSjkFA+l1R9pFdIYcn4Y6VVw9nKUZ6P8w6vheLJLmxyRx+QpOSE5eU3G5D05JVMiyBfylXwj33s/kzQZJA931qS379m/f1fy5BdZRLnl</latexit>

Fig. 5. A function 𝐱(𝐮) maps points in rest (or material or object) space 𝐮𝑖 to points in world space, 𝐱𝑖 .

Deformation Gradient. We begin by defining a deformation function 𝐱(𝐮) that maps points
in a rest space, 𝐮𝑖 , to points in world space, 𝐱𝑖 . This mapping may be arbitrarily complicated, but
we can always linearize about a point, 𝐮0 , to arrive at a familiar affine transformation,
𝐱(𝐮) = 𝐱(𝐮0 ) + 𝐀 (𝐮 − 𝐮0 ) , (61)
where 𝐀 is an arbitrary 𝑑 × 𝑑 (in 𝑑 -dimensional space) transformation matrix and 𝐱(𝐮𝟎 ) is the world
space position corresponding to 𝐮0 , which can be thought of as a translation. Elastic forces work
to ensure that this mapping is a rigid transformation—a global rotation and translation—and are
determined by the gradient of this mapping, the deformation gradient, 𝜕𝐱/𝜕𝐮, which is commonly
denoted 𝐅 and for this linearized mapping is simply the matrix 𝐀. This 𝑑 × 𝑑 matrix describes
how infinitesimal vectors/lengths/displacements in rest space are mapped to world space (ignoring
3 We have adopted the convention that 𝐊 is positive semi-definite, other authors choose 𝐊 to be negative semi-definite.

17
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

translations). This bears repeating: intuitively, 𝐅 is the rest→world transformation. 𝐅 measures


stretch—if a soft body is stretched by a factor of two, then displacements in rest space lead to
displacements in world space that are twice as large. If 𝐅 is a rotation, then displacements in rest
space lead to the same size displacements in world space. Similarly, if det(𝐅) = 1 then volume is
preserved between rest and world space.
The Singular Value Decomposition (SVD) of 𝐅 = 𝐔𝚺𝐕𝑇 , where 𝐔 and 𝐕 are orthonormal matrices
and 𝚺 is a diagonal matrix4 , provides a great deal of insight. Intuitively, 𝐕𝑇 maps from rest space
to a perfectly aligned space where the deformation is described by a non-uniform scale 𝚺, and 𝐔
maps from this perfectly aligned space to world space. The, related, polar decomposition is used
later to avoid elastic forces resulting from global rotations.

Strain. From the deformation gradient we define a strain metric. Strain is a dimension-less (or
unit-less) quantity that measures the amount of deformation. Because strain is dimension-less
it does not depend on the scale of an object. There are several strain metrics commonly used in
computer graphics: Green’s finite strain, Cauchy’s infinitesimal strain, and the co-rotated strain.
Green’s finite strain, also known as the right Cauchy-Green strain, is given by

1 𝜕𝐱 𝜕𝐱 1
𝜖𝑖𝑗 = ⋅ − 𝐈 = (𝐅𝑇 𝐅 − 𝐈) . (62)
2 ( 𝜕𝑢𝑖 𝜕𝑢𝑗 ) 2

This strain metric is straightforward and simple and has the significant property that it does not
penalize world-space rotations, which led to widespread early adoption in computer graphics.
Unfortunately, this metric is quadratic in positions, leading to a quartic energy function, which in
turn leads to a stiffness matrix, 𝐊—the Hessian (second derivative) of the energy—that is quadratic
in positions. The result is that Green’s strain always results in a non-constant 𝐊, which makes
various pre-computations and pre-factorizations invalid and results in significant computational
cost.
To derive Cauchy’s infinitesimal strain let us re-write the deformation gradient as 𝐅 = 𝐈 + 𝐃.
Then Green’s strain is
1
𝜖= (𝐈 + 𝐃)𝑇 (𝐈 + 𝐃) − 𝐈) (63)
2(
1 𝑇
= 𝐈 𝐈 + 𝐃𝑇 + 𝐃 + 𝐃𝑇 𝐃 − 𝐈) (64)
2(
1
= 𝐃𝑇 + 𝐃 + 𝐃𝑇 𝐃) (65)
2(
1
= (𝐃 + 𝐈)𝑇 + (𝐃 + 𝐈) + 𝐃𝑇 𝐃) − 𝐈 (66)
2(
1 𝑇
= 𝐅 + 𝐅 + 𝐃𝑇 𝐃) − 𝐈 (67)
2(
(68)

4 Note that the Singular Value Decomposition is not unique. Singular values are unique and, if they are distinct, singular

vectors are unique, up to the sign. For repeated singular values, the associated vectors form an orthonormal basis for the
subspace associated with the singular value, so are not unique. Also, the singular values and vectors can be permuted and
still form a valid decomposition, though it is common to order them from largest to smallest. It is sometimes helpful to view
the SVD as 𝐔𝚺𝐕𝑇 = ∑𝑖 𝝈 𝑖 𝐮𝑖 𝐯𝑇𝑖 , where we are using the subscript to select column of the matrices. That is, the original
matrix is a sum of outer products of the singular vectors, weighted by their singular values.

18
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Now if deformation is small (i.e. infinitesimal), then the 𝐃𝑇 𝐃 term is negligable compared to the
other terms and can be dropped, resulting in Cauchy’s infinitesimal strain,
1 𝑇 1
𝜖= (𝐅 + 𝐅) − 𝐈 = (𝐅 + 𝐅𝑇 ) − 𝐈, (69)
2 2
or using Einstein notation,
1 𝜕𝐱 𝜕𝐱
𝝐 𝑖𝑗 = + −𝛿 . (70)
2 ( 𝜕𝑢𝑖 𝜕𝑢𝑗 ) 𝑖𝑗
The primary advantage of this strain metric is that it is linear, which leads to a quadratic energy
and a constant Hessian that can be pre-factored or otherwise analyzed. The entire field of modal
analysis is derived from this assumption that elastic deformations will occur, but will be very
small. Unfortunately, this strain metric does penalize world-space rotations, leading to a variety of
unpleasant artifacts under large deformations.
By far the most common strain model in computer graphics since its introduction in the mid-
2000s is the co-rotated strain metric. Intuitively, this model is Cauchy’s linear strain with the
rotation explicitly removed through the polar decomposition. Once the deformation gradient, 𝐅, is
computed, we compute the polar decomposition 𝐅 = 𝐐𝐅̃ and replace 𝐅 with 𝐅̃ in Equation (69),
1 ̃ ̃𝑇
𝜖= 𝐅 + 𝐅 ) − 𝐈. (71)
2(
By explicitly discarding the rotation the metric does not penalize rotations. The changing rotations
mean that stiffness matrix is no longer constant, though some pre-computation is still possible and
𝑇
implementations can be quite efficient. It is worth noting that since 𝐅̃ is symmetric, 𝐅̃ = 1/2(𝐅̃ + 𝐅̃ ),
but, while the values of these functions are equivalent, their derivatives are not.

Stress. Unlike strain, stress is not a dimension-less quantity. In three dimensions, stress has
units of Newton’s per meter squared (𝑁 /𝑚2 ). Instead of measuring the amount of deformation, it
measures the materials reaction to that deformation. Different materials have different stress-strain
relationships, which are often specified with parameterized models. Entire research careers in
material science have been devoted to developing stress-strain models and fitting their parameters
to real-world materials. The most common models in computer graphics are linear,
𝝈 = 𝐂𝝐, (72)
where 𝐂 is a rank-four tensor containing 81 entries. If we take into account that both 𝝈 and 𝝐
are symmetric, this reduces to 36 unique entries; further assuming that the material is iso-tropic
(doesn’t resist deformation in different directions differently), then there are just two parameters.
There are many ways for specifying these two coefficients (see wikipedia) but a convenient one is
the Lamé coefficients. In this case,
𝜎𝑖𝑗 = 𝜆𝜖𝑘𝑘 𝛿𝑖𝑗 + 2𝜇𝜖𝑖𝑗 , (73)
or in matrix notation
𝝈 = 𝜆Tr (𝜖) 𝐈 + 2𝜇𝜖. (74)
Here the stress is some constant times the strain plus a scaled identity matrix times the trace of
the strain. The second term approximately preserves volume. Far more sophisticated stress-strain
relationship have been developed, especially in the context of organic materials and elasto-plasticity
for, e.g. granular materials and snow.

19
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Elastic Potential, Traction, and Force. The elastic potential energy density is the product of
stress and strain
1 1 1
𝜂 = 𝜎𝑖𝑗 𝜖𝑖𝑗 = 𝝈 ∶ 𝝐 = ∑ 𝜎𝑖𝑗 𝜖𝑖𝑗 . (75)
2 2 2 𝑖,𝑗
The total elastic energy in a soft body is found by integrating the energy density over the volume
of the body. Another important quantity is the traction, or force per unit area,
𝝉 = 𝝈𝐧, (76)
where 𝐧 is the unit-magnitude surface normal to the area being integrated over.
Elastic forces will seek to reduce the energy of the system, thus they will be in the direction of
the negative gradient of the energy. That is the force at a point, 𝐱𝑖 , will be
𝜕𝜂
𝐟𝑖 = − . (77)
𝜕𝐱𝑖
Forces can also be defined by integrating tractions over the boundary of a region, 𝑅 , (the foundation
of finite volume methods),
𝐟=∮ 𝝈𝐧 𝑑𝑆. (78)
𝜕𝑅
Stress Revisited. The definition of traction makes clear that stress maps from normals to forces
(per unit area). However, it is important to distinguish where these normals and forces are defined.
If both normals and forces are in world space, the stress is known as a Cauchy stress and often
written as 𝝈 . If the stress maps normals in material space to forces in material space it is known
as a second Piola-Kirchhoff stress and sometimes written as 𝐒. A first Piola-Kirchhoff stress maps
normals in material space to forces in world space and is written 𝐏. Now, watch out, when only
one stress is being considered it is often written with 𝝈 regardless of its definition. The stress
we defined earlier was actually a second Piola-Kirchhoff stress. Now its easy to convert between
these stresses since they all measure the same thing just in different coordinate systems. Letting
𝐽 = det(𝐅) we have

𝐏 = 𝐽 𝝈𝐅−𝑇 = 𝐅𝐒 (79)
By having different ways of specifying stress, we can choose whichever one is most convenient
for a given application. The first Piola-Kirchhoff is particularly attractive since it works with
normals in the material space (where they are often constant) and maps directly to forces in world
space (where they will be applied). But many material models (stress-strain relationships) yield a
second Piola-Kirchhoff stress.

Plasticity. Plasticity refers to permanent deformation that typically occurs when a material fails.
While sophisticated plasticity models have been developed in the graphics literature, incorporating
basic plastic effects is straightforward. We begin by breaking the deformation gradient 𝐅 into two
parts, an elastic part and a plastic part,
𝐅 = 𝐅𝑒 𝐅𝑝 . (80)
Then when computing elastic strain, stress, forces, etc, we ignore the plastic part and only use
the elastic part, 𝐅𝑒 . Intuitively, 𝐅𝑝 measures how the rest shape is (permanently) changing and
𝐅𝑒 is measuring how the mapping from rest to world space. Elastic forces will seek to undo the
latter deformation. The sophistication we referred to earlier has to do with how the decomposition
in Equation (80) is formulated and is beyond the scope of these notes.

20
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

2.2.3 Fluids. Fluids surround us in our daily lives, from the air that we breathe, to water droplets,
oceans, and fire. Other materials that flow include sand, toothpaste, and putty. Intuitively, we can
think of a fluid as a material that flows to conform to the shape of its container. Physically, a fluid is
a material that, unlike a solid, cannot support a shear force and instead rearranges itself in response.
Fluids do support compressive forces, as can be seen by considering a balloon filled with air, where
the elastic balloon exerts compressive forces that are balanced by air pressure.
Here, we give a brief overview of the quantities and equations describing fluid motion. We refer
the interested reader to the excellent comprehensive text on fluid simulation in computer graphics
by Bridson [2015]. Many of the fluids of interest in physics-based animation can be described by
the incompressible Navier-Stokes equations,

𝜌(𝐮𝑡 + 𝐮 ⋅ ∇𝐮) = −∇𝑝 + 𝜇Δ𝐮 + 𝐟, (81)


∇ ⋅ 𝐮 = 0, (82)

where 𝜌 is the fluid density, 𝐮(𝐱, 𝑡) = (𝑢(𝐱, 𝑡), 𝑣(𝐱, 𝑡), 𝑤(𝐱, 𝑡))𝑇 is the three-dimensional fluid
velocity, 𝐮𝑡 is shorthand for 𝜕𝐮/𝜕𝑡 , 𝑝 is the pressure, 𝜇 is the dynamic viscosity, and 𝐟 represents
body forces such as gravity. Note that the mathematics community tends to use Δ to denote the
Laplacian operator, while the engineering community tends to favor 𝛁2 ; 𝛁 ⋅ 𝛁 is also sometimes
used. The first equation is derived using the principle of conservation of momentum [Landau and
Lifshitz 1959; Bridson 2015]. In the form given it has units of force per unit volume (𝑁 /𝑚3 ), and is
analogous to Newton’s second law 𝑚𝑎 = 𝑓 .
Material derivative. On the left hand side, we identify the density 𝜌 with the mass 𝑚, while
the acceleration term takes the form

𝐮𝑡 + 𝐮 ⋅ ∇𝐮. (83)

To understand where the acceleration form in Eq. (83) comes from, consider a fluid particle with
position 𝐱𝑝 (𝑡). Above, we described the fluid velocity field 𝐮(𝐱, 𝑡) as a function of position 𝐱 and
time 𝑡 . The fluid particle will be moving through the fluid velocity field. At any given time, the
velocity of the fluid particle 𝐯𝑝 (𝑡) is equal to the velocity at the particle’s position,

𝐯𝑝 (𝑡) = 𝐮(𝐱(𝑡), 𝑡).


Therefore, the acceleration of the fluid particle is
𝑑
𝐚𝑝 (𝑡) = 𝐯𝑝 (𝑡) (84)
𝑑𝑡
𝑑
= 𝐮(𝐱𝑝 (𝑡), 𝑡) (85)
𝑑𝑡
𝜕𝐮 𝜕𝐮 𝑑𝐱𝑝
= + (𝐱 (𝑡), 𝑡), (86)
( 𝜕𝑡 𝜕𝐱 𝑑𝑡 ) 𝑝

where we have used the chain rule. With the notation 𝐮𝑡 = 𝜕𝐮 𝜕𝐮


𝜕𝑡 , ∇𝐮 = 𝜕𝐱 , and using the fact that
𝑑𝐱𝑝
𝑑𝑡 = 𝐮(𝐱𝑝 , 𝑡), we can see that the acceleration of a fluid particle at 𝐱 is given by
𝐷𝐮
= 𝐮𝑡 + 𝐮 ⋅ ∇𝐮,
𝐷𝑡
the form that appears in the Navier-Stokes equations. This quantity goes by many names, commonly
the material derivative or substantial derivative of the velocity field. To clarify, it is worth writing

21
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

out the derivative in terms of its components, recalling that 𝐮 = (𝑢, 𝑣, 𝑤)𝑇 :

𝐷𝐮 ⎛ 𝑢𝑡 + 𝐮 ⋅ ∇𝑢 ⎞
= 𝐮𝑡 + 𝐮 ⋅ ∇𝐮 = ⎜ 𝑣𝑡 + 𝐮 ⋅ ∇𝑣 ⎟ .
𝐷𝑡 ⎜ ⎟
⎝𝑤𝑡 + 𝐮 ⋅ ∇𝑤 ⎠
Forces. On the right hand side of Eq. (81) are the forces acting on the fluid. The first term is the
negative pressure gradient in the flow. The pressure 𝑝(𝐱, 𝑡) is a scalar field, that in an incompressible
fluid acts everywhere to maintain the volume of the flow, resisting any compression or expansion
forces. Since the gradient of a function points uphill in the direction of steepest increase, and hence
the negative gradient points downhill, this forcing term drives the flow from areas of high pressure
to areas of low pressure. In an incompressible fluid, the pressure forces arise internally to resist
compression or expansion due to other forces. The pressure field will take on exactly the values
needed to ensure that the fluid in any arbitrary region does not compress or expand. For this reason,
it is sometimes called a “Lagrange multiplier” for the divergence-free constraint on the fluid, a
concept we will discuss Section 5.
The second term on the right hand side of Eq. (81) represents the viscous forces in the fluid. The
dynamic viscosity of the fluid, 𝜇 , is a material parameter that depends on the type of fluid. Generally,
“thicker” fluids like honey have a high viscosity. The viscosity of water is one to two orders of
magnitude larger than the viscosity of air, while honey is three to four orders of magnitude more
viscous than water. Viscosity is also sometimes specified in terms of the kinematic viscosity, 𝜈 = 𝜇/𝜌 .
Viscous forces arise from drag between layers of fluid flowing at different velocities. The Laplacian
operator, Δ, can be thought of as measuring the difference between the value of a function at a
point and the average surrounding values, and the viscous force 𝜇Δ𝐮 in Eq. (81) penalizes velocity
differences, acting to equalize velocities throughout the fluid. When a viscous fluid flows past a
solid wall, the fluid particles adjacent to the wall experience drag from the wall and stick to it. This
is called the no-slip boundary condition and says that the fluid should not slip at the surface of the
wall. Mathematically, this is expressed as
𝐮(𝐱, 𝑡) = 𝐕(𝐱, 𝑡), 𝐱∈Γ
where 𝐕 is the velocity of the solid wall, and Γ is the boundary of the fluid domain in contact with
the wall.
Finally, the 𝐟 in Eq. (81) represents other forces such as gravity. It may also be used to model a
variety of other effects, such as surface tension forces, control forces for driving the flow based on
artistic goals, or forces due to elastic stuctures embedded in the fluid.
Incompressibility. As we saw in Section 2.1.2, conservation of mass leads to the conservation
law
𝜌𝑡 + ∇ ⋅ (𝜌𝐮) = 0.
Applying the product rule to the spatial derivative term gives
∇ ⋅ (𝜌𝐮) = 𝜕𝑥 (𝜌𝑢) + 𝜕𝑦 (𝜌𝑣) + 𝜕𝑧 (𝜌𝑤) (87)
= (𝜕𝑥 𝜌)𝑢 + (𝜕𝑦 𝜌)𝑣 + (𝜕𝑧 𝜌)𝑤 + 𝜌(𝜕𝑥 𝑢 + 𝜕𝑦 𝑣 + 𝜕𝑧 𝑤) (88)
= 𝐮 ⋅ ∇𝜌 + 𝜌∇ ⋅ 𝐮. (89)
Therefore, conservation of mass can be written as
𝐷𝜌
+ 𝜌∇ ⋅ 𝐮 = 0,
𝐷𝑡
using the notation for the material derivative. Since the fluid should not compress or expand under
𝐷𝜌
the incompressibility assumption, 𝐷𝑡 = 0, so the conservation of mass equation reduces to the

22
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

divergence-free condition seen in Eq. (81)


∇ ⋅ 𝐮 = 0. (90)
This condition holds everywhere in the fluid. Integrating the divergence-free condition over an
arbitrary control volume, and applying the divergence theorem, we have

0 = ∫ ∇ ⋅ 𝐮 𝑑𝑉 = ∫ 𝐮 ⋅ 𝐧 𝑑𝑆, (91)
Ω 𝜕Ω
which says that the total flow through the boundary of any region in the flow must be zero. If other
forces attempt to compress or expand the fluid, an internal pressure arises to counteract those
forces and prevent the change in volume.

23
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

3 SPATIAL DISCRETIZATION
In this section we review essential concepts for spatially discretizing continuous equations of
motion. We first discuss Lagrangian and Eulerian reference frames, then discuss the most common
spatial data structures used to store simulation variables before discussing how quantities stored
in the structures are interpolated at arbitrary points in space. Finally, we discuss two of the most
common approaches to discretizing equations of motion: finite differences and finite element
methods.

3.1 Lagrangian vs Eulerian


A fundamental concept when discussing spatial discretization is the distinction between Lagrangian
and Eulerian reference frames. In fact, the concept is so fundamental that it is often only implicitly
mentioned.
As a concrete example, imagine we wanted to know how fast a river was flowing. There are two
ways we could measure its flow rate: we could wade out into the river and see how quickly the
water moved by us or we could jump on a raft and see how quickly we moved. In the first approach
the point of measurement, the reference frame, is fixed in space. We refer to such a fixed reference
frame as Eulerian. In the second approach, the reference frame moves with the material and we
refer to the reference frame as Lagrangian. Eulerian reference frames are often used for fluids and
often employ regular grids and finite differences and Lagrangian reference frames are often used
for solids and employ tetrahedral meshes or particles and finite element methods. These trends are
so common that it is easy to confuse the underlying distinction that Eulerian frames are fixed and
Lagrangian frames move with the material.
The reason Lagrangian frames are often used for soft bodies is that these simulations need a
mapping (𝐱(𝐮)) from rest or material space to deformed or world space (see Section 2.2.2) in order
to compute elastic forces. This mapping is easily constructed if we explicitly track points in the
material through time. Eulerian approaches are well-suited to fluids because we do not need such a
mapping and fixed reference frames offer many computational advantages.
There is also a difference in the mathematical notation we use when working in an Eulerian
frame vs. a Lagrangian frame. In a Lagrangian frame we will often write the material derivative of
a field 𝑦
𝐷𝑦
, (92)
𝐷𝑡
while when working in an Eulerian frame we will apply the chain rule and write
𝜕𝑦
+ 𝐮 ⋅ 𝛁𝑦, (93)
𝜕𝑡
breaking out the rate of change at a fixed point and the advection through the flow field (see Sec-
tion 2.2.3.

3.2 Grids, Meshes, Particles


Grids. Perhaps the most common spatial data structure is the regular grid. In this structure all
edges have the same length, called the grid spacing, which is often denoted ℎ or Δ𝑥 . Individual
cubes in the grid are referred to as cells which have eight vertices, twelve edges, and six faces. The
grid can be described by a few redundant parameters: the grid spacing, the grid resolution (i.e.
the number of cells in each dimension), and the upper and lower extent of the gird. Grids are
typically fixed in space and do not change shape, thus typically an Eulerian frame is adopted. In
many implementations the grid is abstract, with only part of it every being allocated. In this case a

24
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

wi,j,k+1
vi,j+1,k
<latexit sha1_base64="KKphge87q8yAv89FOnlyiwT7oa8=">AAACG3icbVDLSgMxFM3UV62vqks3g0UQLGXiRpelblxWsA+YGUomzbSxeQxJxlKG+QyX6se4E7cu/BY3po+Fth4IOZxzL/feEyWMauN5X05hbX1jc6u4XdrZ3ds/KB8etbVMFSYtLJlU3QhpwqggLUMNI91EEcQjRjrR6Gbqdx6J0lSKezNJSMjRQNCYYmSs5I97Ga0+VEcXMO+VK17Nm8FdJXBBKmCBZq/8HfQlTjkRBjOktQ+9xIQZUoZiRvJSkGqSIDxCA+JbKhAnOsxmK+fumVX6biyVfcK4M/V3R4a41hMe2UqOzFAve1PxP89PTXwdZlQkqSECzwfFKXONdKf3u32qCDZsYgnCitpdXTxECmFjUyoFgoyx5ByJfhY0ch+GWTCdQc38j+KsAvM8L9m04HI2q6R9WYNeDd55lXpjkVsRnIBTcA4guAJ1cAuaoAUwkOAJvIBX59l5c96dj3lpwVn0HIM/cD5/AFR8oZU=</latexit>
sha1_base64="rb9Hdsb/q931ZP1N68Y3P9Kx+oI=">AAACG3icbVDLSgMxFL3j2/qqunQzWARBKRMRdFl041LBtsLMUDNpRmPzGJKMUof5DJfqx7gTty7ET3Fj2rrwdSDkcM693HtPknFmbBC8eWPjE5NT0zOzlbn5hcWl6vJKy6hcE9okiit9lmBDOZO0aZnl9CzTFIuE03bSOxz47WuqDVPy1PYzGgt8IVnKCLZOCm86Bdu+2u5tobJTrQX1YAj/L0FfpNbYvX0/B4DjTvUj6iqSCyot4diYEAWZjQusLSOclpUoNzTDpIcvaOioxIKauBiuXPobTun6qdLuSesP1e8dBRbG9EXiKgW2l+a3NxD/88LcpvtxwWSWWyrJaFCac98qf3C/32WaEsv7jmCimdvVJ5dYY2JdSpVI0huihMCyW0QHZYjiIhrMYHb0J2lRQ2VZVlxa6Hc2f0lrp46COjpxsR3ACDOwBuuwCQj2oAFHcAxNIKDgDh7g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kvBnvxsesNGfMew7AHxifP0NvpQk=</latexit>

wi,j,k
<latexit sha1_base64="tn5D9nlwj6CtLMYKxIqXCOB32zU=">AAACGXicbVC7TsMwFHXKq5RXgZElIkJiqKqEBcaqLIxFog+URJXjOK2p7US2Q1VF+QpG4GPYECsT38KC02aAliNZPjrnXt17T5BQIpVtfxmVtfWNza3qdm1nd2//oH541JNxKhDuopjGYhBAiSnhuKuIoniQCAxZQHE/mFwXfv8RC0lifqdmCfYZHHESEQSVlu6nw4w0HhqTfFi37KY9h7lKnJJYoERnWP/2whilDHOFKJTSdexE+RkUiiCK85qXSpxANIEj7GrKIcPSz+YL5+aZVkIzioV+XJlz9XdHBpmUMxboSgbVWC57hfif56YquvIzwpNUYY4Wg6KUmio2i+vNkAiMFJ1pApEgelcTjaGASOmMah7HUxQzBnmYee3cdfzMK2YQtfiDKLOcPM9rOi1nOZtV0rtoOnbTubWtVrvMrQpOwCk4Bw64BC1wAzqgCxBg4Am8gFfj2Xgz3o2PRWnFKHuOwR8Ynz9psKEl</latexit>
sha1_base64="BGG6xM71FcWRla4+uthjR27EEpE=">AAACGXicbVA9T8MwEL2U7/JVYGSJqJAYqipBSDBWZWEEiUJREhXHdaip7US2Q1Wi/ApG4MewIVYmxE9hwW06AOVJlp/eu9PdvTBhVGnH+bBKM7Nz8wuLS+XlldW19crG5oWKU4lJC8cslu0QKcKoIC1NNSPtRBLEQ0Yuw/7xyL+8I1LRWJzrYUICjm4EjShG2khXg05Ga7e1ft6pVJ26M4Y9TdwJqTYO7j+vAeC0U/nyuzFOOREaM6SU5zqJDjIkNcWM5GU/VSRBuI9uiGeoQJyoIBsvnNu7RunaUSzNE9oeqz87MsSVGvLQVHKke+qvNxL/87xUR0dBRkWSaiJwMShKma1je3S93aWSYM2GhiAsqdnVxj0kEdYmo7IvyADHnCPRzfxm7rlB5o9mUF38YZRV3TzPyyYt92820+Riv+46dffMxNaEAouwDTuwBy4cQgNO4BRagIHDAzzBs/VovViv1ltRWrImPVvwC9b7N6zxo04=</latexit>
sha1_base64="0aksVMGhaShoHzGNw6oHZvJ7D4I=">AAACGXicbVC7TsMwFHUKhRJeBUaWiAqJoaoShARjVRbGItEHSqLKcZ3W1HYi26EqUb6CEfgSJjbEyoT4lC64jwFajmT56Jx7de89QUyJVLb9ZeRWVvNr64UNc3Nre2e3uLfflFEiEG6giEaiHUCJKeG4oYiiuB0LDFlAcSsYXE781j0WkkT8Ro1i7DPY4yQkCCot3Q47KSnflQdZp1iyK/YU1jJx5qRUPXv4hq/5cb1THHvdCCUMc4UolNJ17Fj5KRSKIIoz00skjiEawB52NeWQYemn04Uz61grXSuMhH5cWVP1d0cKmZQjFuhKBlVfLnoT8T/PTVR44aeEx4nCHM0GhQm1VGRNrre6RGCk6EgTiATRu1qoDwVESmdkehwPUcQY5N3Uq2Wu46feZAZRsz8I05KTZZmp03IWs1kmzdOKY1ecax1bDcxQAIfgCJwAB5yDKrgCddAACDDwCJ7Bi/FkvBnvxsesNGfMew7AHxifP0UkpQo=</latexit>

Fig. 6. Staggered grid

hierarchical structure, such as an octree or B-tree, is typically used to represent the full domain.
OpenVDB [Museth 2013] is an example of such a structure.
A question that arises when considering grids is where to store simulation variables. It is equally
natural to store variables at cell centers or at vertices and either convention is frequently adopted.
A special case, known as the staggered grid (sometimes less-usefully referred to as the MAC grid,
because it was introduced by Harlow and Welch [1965] with their Marker-and-Cell fluid simulation
method) stores different variables at different locations. This structure is commonly used in fluid
simulation to achieve second-order accuracy when using finite differences at small additional
computational cost. The resulting computer code is more complicated than when variables are
co-located. In this case individual component of the velocity 𝐮 are stored as scalars at face centers,
while pressure is stored at cell centers, see Figure 6. Note that some authors prefer using half-index
notation so that a velocity may be referred to as 𝑢𝑖−1/2,𝑗,𝑘 , but this maps less cleanly to computer
code.

Meshes. “Meshes” itself is an ill-defined term, but typically the term is used to refer to simplicial
complexes. A 𝑘 -simplex contains 𝑘 + 1 vertices that are all connected. A 0-simplex is a point, a
1-simplex a line segment or edge, a 2-simplex a triangle, and a 3-simplex a tetrahedron. A simplicial
complex is decomposes a domain into a set of disjoint simplices, triangles in 2D and tetrahedra in
3D. These simplices meet at lower-dimensional simplices forming the complex. For example, two
tetrahedra meet at a face, which will be a triangle. Similarly, two triangles meet at an edge, and two
edges meet at a vertex. Automatic tetrahedral meshing is still a difficult problem that continues
to receive attention from the SIGGRAPH and Computational Geometry research communities. In
fact, the difficulty of generating high quality tetrahedral meshes for arbitrary geometry remains a
significant impediment to their widespread use.

25
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Particles. Given the difficulty of generating tetrahedral meshes, some choose to represent
geometry as a set of particles. Particles then typically interact with nearby particles. The primary
advantage of this approach is simplicity. The primary drawback is that, because space is not broken
into disjoint pieces, integration becomes more difficult.
Hybrid Structures. In recent years hybrid data structures have become increasingly common.
In particular combining Lagrangian particles with regular background grids, such as in the Fluid
Implicit Particle (FLIP) and Material Point Method (MPM) approaches, has proven very successful
at combining the various strengths of these two approaches.

3.3 Interpolation
As we saw previously, the values of scalar, vector, or tensor fields that we are tracking are often
sampled at discrete points on a grid, mesh, or set of particles. When the value of the field is required
at a location other than the sample points, it must be interpolated from the discrete samples to the
desired location. A simple example of interpolation is finding the value of some quantity on a line
segment between two endpoints for which we have samples, illustrated below. The samples at the

endpoints are 𝑓1 and 𝑓2 , 𝑡 is the fraction of the distance from 𝑓1 to 𝑓2 at which we want to determine
the value 𝑓 (𝑡). Linear interpolation between the endpoints gives us
𝑓 (𝑡) = (1 − 𝑡)𝑓1 + 𝑡𝑓2 .
As a sanity check, we see that this formula gives 𝑓 (0) = 𝑓1 and 𝑓 (1) = 𝑓2 as desired. Notice that the
formula is computing a weighted average of the two endpoints, with the weights of each endpoint
being the length ratio of the line sub-segment opposite the sample. Importantly, the weights in
any interpolation formula should always sum to 1, forming a partition of unity. This is indeed the
cases here as 1 − 𝑡 + 𝑡 = 1. The formula above can also be rearranged into 𝑓 (𝑡) = 𝑓1 + 𝑡(𝑓2 − 𝑓1 ),
but the former expression is more useful for generalizing to bilinear, trilinear, and barycentric
interpolation, as we do next.

26
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

We now move to two dimensions, where we have a function sampled at the four corners of
a rectangle or square, with samples 𝑓1 , 𝑓2 , 𝑓3 , 𝑓4 . If the function value is desired at a point inside
the rectangle, we can use bilinear interpolation. We first assign the coordinates (𝑠, 𝑡) to the point
in the rectangle, where 𝑠 is the fraction of the distance from 𝑓1 to 𝑓2 , and 𝑡 is the fraction of the
distance from 𝑓1 to 𝑓4 , as illustrated in the figure. With bilinear interpolation, we take a weighted
average of the function values at the four corner samples. As with linear interpolation, the weight
of each sample point is equal to the relative area of the region opposite that sample point, so that
the formula for bilinear interpolation is
𝑓 (𝑠, 𝑡) = (1 − 𝑠)(1 − 𝑡)𝑓1 + 𝑠(1 − 𝑡)𝑓2 + 𝑠𝑡𝑓3 + (1 − 𝑠)𝑡𝑓4 . (94)
Notice that, as required, the weights sum to 1. The formula can also be derived by using two linear
interpolation steps to intermediate values 𝑓5 and 𝑓6 , and then a final linear interpolation step to
𝑓 (𝑠, 𝑡) as illustrated below. From here, we have

𝑓5 = (1 − 𝑡)𝑓1 + 𝑡𝑓4 (95)


𝑓6 = (1 − 𝑡)𝑓2 + 𝑡𝑓3 (96)
𝑓 (𝑠, 𝑡) = (1 − 𝑠)𝑓5 + 𝑠𝑓6 (97)
= (1 − 𝑠) ((1 − 𝑡)𝑓1 + 𝑡𝑓4 ) + 𝑠 ((1 − 𝑡)𝑓2 + 𝑡𝑓3 ) . (98)
Rearranging gives Eq. (94). The rule that each weight is the relative area of the region opposite the
sample is easier to recall and generalizes nicely.
In three dimensions, we use trilinear interpolation to interpolate values from the eight corners of
a rectangle to a point inside the rectangle. If the point is at coordinate (𝑠, 𝑡, 𝑢) inside the rectangle,
then by using the relative volumes of the rectangle opposite the sample point, trilinear interpolation
gives
𝑓 (𝑠, 𝑡, 𝑢) =(1 − 𝑠)(1 − 𝑡)(1 − 𝑢)𝑓1 + 𝑠(1 − 𝑡)(1 − 𝑢)𝑓2 + 𝑠𝑡(1 − 𝑢)𝑓3 + (1 − 𝑠)𝑡(1 − 𝑢)𝑓4 (99)
+ (1 − 𝑠)(1 − 𝑡)𝑢𝑓5 + 𝑠(1 − 𝑡)𝑢𝑓6 + 𝑠𝑡𝑢𝑓7 + (1 − 𝑠)𝑡𝑢𝑓8 . (100)
As before, we could also derive this formula by first doing bilinear interpolation to intermediate
points on two opposite faces using two of the three coordinates, and then doing a linear interpolation
between those two using the third coordinate.
We saw previously that triangles and more generally simplicial complexes are used frequently
in physics-based animation. Similiar to the above, we can linearly interpolate between the three
nodes of a triangle using barycentric coordinates. To interpolate to a point 𝑝 , we associate with
the vertices 𝑎, 𝑏 , and 𝑐 the weights 𝛼 , 𝛽 , and 𝛾 , respectively, so that a quantities 𝑓𝑎 , 𝑓𝑏 , and 𝑓𝑐 are
interpolated as
𝑓𝑝 = 𝑓 (𝛼, 𝛽, 𝛾 ) = 𝛼𝑓𝑎 + 𝛽𝑓𝑏 + 𝛾 𝑓𝑐 . (101)

27
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

As before, 𝛼 + 𝛽 + 𝛾 = 1, and can be determined by finding the ratio of the area of the opposite
subtriangle to the whole triangle. Specifically,

area(𝑝, 𝑏, 𝑐)
𝛼= , (102)
area(𝑎, 𝑏, 𝑐)
area(𝑝, 𝑐, 𝑎)
𝛽= , (103)
area(𝑎, 𝑏, 𝑐)
area(𝑝, 𝑎, 𝑏)
𝛾= . (104)
area(𝑎, 𝑏, 𝑐)

Notice that at each vertex 𝑎, 𝑏 , or 𝑐 , the corresponding weight 𝛼 , 𝛽 , or 𝛾 , respectively, is 1, while


the other weights are 0. Along any of the three edges of the triangle, the weight of the opposite
vertex is 0 while the other two weights can be determined by linear interpolation between the edge
vertices. The areas above are signed areas, with the convention that counter-clockwise orientation
has positive sign, and clockwise orientation has negative sign. Some of the barycentric coordinates
of points in the plane of a triangle can be negative, but they must always sum to one. In addition
to being used for interpolation of quantities throughout the triangle, barycentric coordinate are
sometimes determined for a point to test whether the point lies inside the triangle or on its boundary
(all coordinates non-negative), or outside the triangle (one or more coordinates negative). Alternate
ways of finding barycentric coordinates exist (see e.g., [Marschner and Shirley 2015]).

28
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Sometimes it is convenient to remove the redundancy introduced by the constraint that 𝛼 +𝛽 +𝛾 =


1 and write
𝑓𝑝 = 𝑓 (𝛼, 𝛽) = (1 − 𝛼 − 𝛽)𝑓𝑎 + 𝛼𝑓𝑏 + 𝛽𝑓𝑐 = 𝑓𝑎 + 𝛼(𝑓𝑏 − 𝑓𝑎 ) + 𝛽(𝑓𝑐 − 𝑓𝑎 ) (105)
where the definitions of 𝛼 and 𝛽 have changed. This formulation often leads to more efficient code.
Polynomial interpolation. Given 𝑛 + 1 distinct data points (𝑡1 , 𝑓1 ), … , (𝑡𝑛+1 , 𝑓𝑛+1 ), there is a
unique polynomial of degree 𝑛 that interpolates the data points. One approach to writing down the
interpolating polynomial is via Lagrange interpolation, where
𝑖=1
𝑓 (𝑡) = ∑ 𝑓𝑖 𝑙𝑖 (𝑡) (106)
𝑖=1
Π𝑘 ≠𝑖 (𝑡 − 𝑡𝑘 )
𝑙𝑖 (𝑡) = . (107)
Π𝑘 ≠𝑖 (𝑡𝑖 − 𝑡𝑘 )
The polynomial can also be determined using monomial basis elements, leading to the ill-conditioned
Vandermonde matrix, or using Newton interpolation. Further details as well as advantages and
disadvantages of the different approaches can be found in a textbook such as [Heath 2002].
Approximating functions. While interpolating functions go through a set of discrete samples
and can be used to determine function values between the samples, approximating functions do not
necessarily go through the data points. One of the most common approaches to approximating a
set of sample data is least squares interpolation. When data is noisy or a system is overdetermined,
it is often undesirable to require interpolation of the data points, as very poor approximations can
result. Instead, we seek to find unknown parameters for a model that is thought to fit the data,
while minimizing the resulting error between the model and data. In least squares, given 𝑚 data
points (𝑥𝑖 , 𝑓𝑖 ), 𝑖 = 1, … , 𝑚, a set of 𝑛 basis functions 𝜙1 (𝑥), … , 𝜙𝑛 (𝑥) are assumed to model the data,
and 𝑛 coefficients 𝛼1 , … , 𝛼𝑛 are sought so that the resulting approximating function
𝜙(𝑥) = 𝛼1 𝜙1 (𝑥) + 𝛼2 𝜙2 (𝑥) + … + 𝛼𝑛 𝜙𝑛 (𝑥)
minimizes the sum of the squared errors,
𝑚
∑ |𝜙(𝑥𝑖 ) − 𝑓𝑖 |2 . (108)
𝑖=1
Once the basis functions are chosen, the approximation is completed by fitting the coefficients
𝛼1 , … , 𝛼𝑛 to the data, resulting in the optimization
argmin𝜶 ‖𝐴𝜶 − 𝐟 ‖2 (109)
where
⎛ 𝜙1 (𝑥1 ) 𝜙2 (𝑥1 ) ⋯ 𝜙𝑛 (𝑥1 ) ⎞ ⎛ 𝛼1 ⎞ ⎛ 𝑓1 ⎞
⎜ 𝜙 (𝑥 ) 𝜙2 (𝑥2 ) ⋯ 𝜙𝑛 (𝑥2 ) ⎟ ⎜ 𝛼2 ⎟ ⎜ 𝑓2 ⎟
𝐴=⎜ 1 2 ⎟,𝜶 = ⎜ ⋮ ⎟,𝐟 = ⎜ ⋮ ⎟. (110)
⎜ ⋮ ⎟ ⎜ ⎟ ⎜ ⎟
⎝𝜙1 (𝑥𝑚 ) 𝜙2 (𝑥𝑚 ) ⋯ 𝜙𝑛 (𝑥𝑚 )⎠ ⎝𝛼𝑛 ⎠ ⎝𝑓𝑛 ⎠
The normal equations 𝐴𝑇 𝐴𝜶 = 𝐴𝑇 𝐟 can be formed and used to solve the nonsingular least squares
problem, although this method is poorly conditioned and better alternatives exist [Heath 2002].
Sometimes a weighted version of Eq. (108) is used, so that the error to be minimized is
𝑚
∑ 𝑤𝑖 |𝜙(𝑥𝑖 ) − 𝑓𝑖 |2 , (111)
𝑖=1
where the 𝑤𝑖 are weights that modify the relative contribution of each error term to the total error.
More generally, these weights can vary over the domain. Such moving least squares approaches are

29
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

used in scattered data interpolation to reconstruct functions from unstructured data [Shen et al.
2005].
Approximating piecewise polynomial curves such as Bezier curves and B-splines are also some-
times used in physics-based animation to reconstruct functions from sample data [Marschner and
Shirley 2015].
Finally, we note that in the context of geometric deformation of character models, specialized
coordinates for interpolation have been developed that work with more general structures.These
include mean-value coordinates [Floater 2003; Ju et al. 2005] harmonic coordinate [Joshi et al. 2007],
green coordinates [Lipman et al. 2008], and bounded biharmonic weights [Jacobson et al. 2011].

3.4 Finite Differences


The evolution equations that we have encountered often involve first and second order spatial
derivatives of functions. Finite difference methods are commonly used to discretize the differential
operators for numerical solution. Recall that the derivative of a function 𝑓 (𝑥) is
𝑑 𝑓 (𝑥 + ℎ) − 𝑓 (𝑥)
𝑓 (𝑥) = lim (112)
𝑑𝑥 ℎ→0 ℎ
if this limit exists. By choosing ℎ to be some small yet finite number, a finite difference approximation
to the derivative of 𝑓 at a point 𝑥 is
𝑑 𝑓 (𝑥 + ℎ) − 𝑓 (𝑥)
𝑓 (𝑥) ≈ . (113)
𝑑𝑥 ℎ
The error in this approximation decreases with decreasing ℎ. The exact dependence between ℎ and
the error can be investigated using the Taylor series of the function 𝑓 about the point 𝑥 (when the
Taylor series converges in some interval about 𝑥 ), specifically
ℎ2 ′′ ℎ3 ℎ𝑛
𝑓 (𝑥 + ℎ) = 𝑓 (𝑥) + ℎ𝑓 ′ (𝑥) +
𝑓 (𝑥) + 𝑓 ′′′ (𝑥) + … + 𝑓 (𝑛) (𝑥) + … . (114)
2 6 𝑛!
Rearranging and dividing through by ℎ, we see that
𝑓 (𝑥 + ℎ) − 𝑓 (𝑥) ℎ ′′ ℎ2 ℎ𝑛−1 (𝑛)
𝑓 ′ (𝑥) = − 𝑓 (𝑥) + 𝑓 ′′′ (𝑥) + … + 𝑓 (𝑥) + … , (115)
ℎ 2 6 𝑛!
or
𝑓 (𝑥 + ℎ) − 𝑓 (𝑥)
𝑓 ′ (𝑥) = + 𝑂(ℎ), (116)

since the 𝑂(ℎ) term in the infinite series is the dominant term as ℎ → 0. This choice of finite
difference approximation to 𝑓 ′ (𝑥) is called a forward difference. Since its dominant error term is
𝑂(ℎ), it is said to be first order accurate. Another choice of finite difference approximation to 𝑓 ′ (𝑥)
is the backward difference
𝑓 (𝑥) − 𝑓 (𝑥 − ℎ)
𝑓 ′ (𝑥) ≈ . (117)

Taylor series expansion about 𝑥 gives
ℎ2 ′′ ℎ3
𝑓 (𝑥 − ℎ) = 𝑓 (𝑥) − ℎ𝑓 ′ (𝑥) + 𝑓 (𝑥) − 𝑓 ′′′ (𝑥) + … ,
2 6
which can be rearranged to
𝑓 (𝑥) − 𝑓 (𝑥 − ℎ) ℎ ′′ ℎ2
𝑓 ′ (𝑥) = + 𝑓 (𝑥) − 𝑓 ′′′ (𝑥) + … , (118)
ℎ 2 6

30
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

or
𝑓 (𝑥) − 𝑓 (𝑥 − ℎ)
𝑓 ′ (𝑥) = + 𝑂(ℎ). (119)

Like the forward difference, the backward different is first order accurate, although notice that
their dominant error terms differ by a sign. The significance of first order accuracy is that if the
spacing between sample points, ℎ, is halved, the dominant error term will also be halved as it is
linear in the size of the mesh spacing.
A common second order accurate finite difference discretization is the central difference,
𝑓 (𝑥 + ℎ) − 𝑓 (𝑥 − ℎ)
𝑓 ′ (𝑥) ≈ . (120)
2ℎ
We can again use Taylor series to study the order of accuracy, using
ℎ2 ′′ ℎ3 ′′′
𝑓 (𝑥 + ℎ) = 𝑓 (𝑥) + ℎ𝑓 ′ (𝑥) + 𝑓 (𝑥) + 𝑓 (𝑥) + 𝑂(ℎ4 ), (121)
2 6
ℎ2 ℎ3 ′′′
𝑓 (𝑥 − ℎ) = 𝑓 (𝑥) − ℎ𝑓 ′ (𝑥) + 𝑓 ′′ (𝑥) − 𝑓 (𝑥) + 𝑂(ℎ4 ). (122)
2 6
Taking the difference of these two expressions and dividing by 2ℎ, we get
𝑓 (𝑥 + ℎ) − 𝑓 (𝑥 − ℎ) 1 ℎ3
= 2ℎ𝑓 ′ (𝑥) + 𝑓 ′′′ (𝑥) + 𝑂(ℎ4 ) (123)
2ℎ 2ℎ ( 3 )
ℎ2
= 𝑓 ′ (𝑥) + 𝑓 ′′′ (𝑥) + 𝑂(ℎ3 ) (124)
6
= 𝑓 ′ (𝑥) + 𝑂(ℎ2 ) (125)

This shows that the dominant error term for the central difference is 𝑂(ℎ2 ), making it second order
accurate. This means if we decrease the mesh spacing from ℎ to ℎ/2, the dominant error term will
scale by a factor of 1/4. Thus, asymptotically, the error decreases more quickly with decreasing ℎ
in a higher order method.
When choosing a finite difference scheme, order of accuracy is only one of several considerations.
Other considerations include the overall stability of the scheme, the nature of the errors produced
by the scheme (e.g., dissipative or dispersive), and the conservation properties of the scheme. For
example, when discretizing advective terms in a partial differential equation, the central difference
scheme above can lead to undesirable oscillations or instabilities when combined with certain time
discretization methods. Upwind discretizations are often preferred for advection. These schemes use
the local flow direction to choose between the forward or backward differences, or higher-order
one-sided discretizations.
We can also approximate higher derivatives with finite difference approximations. For example,
we can write a central difference approxmation to 𝑓 ′′ (𝑥) as

𝑓 ′ (𝑥 + ℎ2 ) − 𝑓 ′ (𝑥 − ℎ2 )
𝑓 ′′ (𝑥) = + 𝑂(ℎ2 ) (126)

𝑓 (𝑥+ℎ)−𝑓 (𝑥)
− 𝑓 (𝑥)−𝑓ℎ(𝑥−ℎ)
= ℎ + 𝑂(ℎ2 ) (127)

𝑓 (𝑥 + ℎ) − 2𝑓 (𝑥) + 𝑓 (𝑥 − ℎ)
= + 𝑂(ℎ2 ), (128)
ℎ2

31
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

where Taylor series analysis of this finite difference approximation shows that the odd errors terms
in the approximations to 𝑓 (𝑥 − ℎ) and 𝑓 (𝑥 + ℎ) cancel perfectly, leaving an 𝑂(ℎ4 ) dominant error
term in the numerator, and thus giving second order accuracy.
Laplacian operator. Now consider approximating the Laplacian operator applied to a function
2 𝜕 2 𝑢 , and each of the two second
𝑢 , i.e., Δ𝑢 using finite differences. In two dimensions, Δ𝑢 = 𝜕𝜕𝑥𝑢2 + 𝜕𝑦 2
order derivatives can be approximated using the centered difference scheme in (128) as
𝜕 2 𝑢(𝑥, 𝑦) 𝑢(𝑥 + ℎ, 𝑦) − 2𝑢(𝑥, 𝑦) + 𝑢(𝑥 − ℎ, 𝑦)
≈ (129)
𝜕𝑥 2 ℎ2
2
𝜕 𝑢(𝑥, 𝑦) 𝑢(𝑥, 𝑦 + ℎ) − 2𝑢(𝑥, 𝑦) + 𝑢(𝑥, 𝑦 − ℎ)
≈ (130)
𝜕𝑦 2 ℎ2
Combining these, we get
𝜕 2 𝑢(𝑥, 𝑦) 𝜕 2 𝑢(𝑥, 𝑦) 𝑢(𝑥 + ℎ, 𝑦) − 2𝑢(𝑥, 𝑦) + 𝑢(𝑥 − ℎ, 𝑦) 𝑢(𝑥, 𝑦 + ℎ) − 2𝑢(𝑥, 𝑦) + 𝑢(𝑥, 𝑦 − ℎ)
+ ≈ +
𝜕𝑥 2 𝜕𝑦 2 ℎ2 ℎ2
(131)
𝑢(𝑥 + ℎ, 𝑦) + 𝑢(𝑥 − ℎ, 𝑦) + 𝑢(𝑥, 𝑦 + ℎ) + 𝑢(𝑥, 𝑦 − ℎ) − 4𝑢(𝑥, 𝑦)
= (132)
ℎ2
If we consider our function 𝑢 to be sampled at the nodes of a uniform two-dimensional grid, as
illustrated below and associate with the location 𝑥 , 𝑥 + ℎ, 𝑦 , 𝑦 − ℎ the grid indices 𝑖 , 𝑖 + 1, 𝑗 , 𝑗 − 1,

etc., respectively, we can write the finite difference approximation in a the commonly used form
𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 − 4𝑢𝑖,𝑗
Δ𝑢(𝑥, 𝑦) ≈ (133)
ℎ2
The figure above illustrates which surrounding sample points are used in the finite difference
approximation, and is called the stencil of the finite difference scheme. The particular stencil
illustrated for the Laplacian is very commonly used and is called the five-point stencil. In one
dimension and three dimensions, the analogous stencils are the three- and seven-point stencils,
respectively.
We now consider discretizing the one-dimensional Poisson equation
𝑢𝑥𝑥 = 𝑓 , 𝑥 ∈Ω (134)
on a uniform one-dimensional grid of size 8. We use the finite difference approximation in (128) at
each point in the grid. Discretizing the Laplacian over the grid gives rise to a matrix that is sparse
yet globally couples all variables. Finite difference discretization of differential operators generally
gives rise to sparse matrices, since differential operators give local information about functions.

32
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

We number the 𝑛 samples from the left to right 𝑖 = 0, 1, … , 𝑛 − 1. At node 𝑖 on the grid, the finite
difference approximation gives the equation
𝑢𝑖−1 − 2𝑢𝑖 + 𝑢𝑖+1
= 𝑓𝑖 .
ℎ2
We apply this discretization at each of the 8 grid nodes and assemble the resulting equations into a
linear system. Here we notice that at the two endpoints of the grid, we do not have all the neighbors
required by the stencil. Mathematically, we require boundary conditions for the solution of Eq. (134)
to be fully determined. The boundary conditions are then used in discretizing the equation at the
boundary points near the boundary. If we assume, for example, the Dirichlet boundary condition

̄
𝑢(𝑥) = 𝑢(𝑥), 𝑥 ∈ 𝜕Ω, (135)

then the discretized Laplace equation for our example becomes the linear system
̄ )
𝑢(𝑥
⎛−2 1 0 0 0 0 ⎞ ⎛𝑢1 ⎞ ⎛𝑓1 − ℎ20 ⎞
⎜ 1 −2 ⎜ ⎟
1 0 0 0 ⎟ ⎜𝑢2 ⎟ ⎜ 𝑓2 ⎟
1 ⎜⎜ 0 1 −2 1 0
⎟⎜ ⎟ ⎜
0 ⎟ ⎜𝑢3 ⎟ 𝑓3 ⎟
= (136)
2
ℎ ⎜ 0 0 1 −2 1 0 ⎟ ⎜𝑢4 ⎟ ⎜⎜ 𝑓4 ⎟⎟
⎜0 0 0 1 −2 1 ⎟ ⎜𝑢5 ⎟ ⎜ 𝑓5 ⎟
⎜ ⎟⎜ ⎟ ̄ 7) ⎟
⎝ 0 0 0 0 1 −2⎠ ⎝𝑢6 ⎠ ⎜𝑓6 − 𝑢(𝑥
⎝ ℎ2 ⎠

Note how the first and last rows in the matrix have only 2 nonzero terms, while the rows corre-
sponding to interior samples have 3. For the first and last rows, the third term is a boundary term
and not an unknown, and hence appears on the right hand side of the equation.
Neumann boundary conditions, which specify derivatives are also common. If we assume that
the derivative at the boundary is zero,

𝜕𝑢(𝑥)
= 0 ∈ 𝜕Ω, (137)
𝜕𝑥
as we would for pressure at a solid boundary, then the discretized Laplace equation for our example
becomes the linear system

⎛−1 1 0 0 0 0 ⎞ ⎛𝑢1 ⎞ ⎛𝑓1 ⎞


⎜ 1 −2 1 0 0 0 ⎟ ⎜𝑢2 ⎟ ⎜𝑓2 ⎟
1 ⎜⎜ 0 1 −2 1 0
⎟⎜ ⎟ ⎜ ⎟
0 ⎟ ⎜𝑢3 ⎟ ⎜𝑓3 ⎟
= (138)
ℎ2 ⎜ 0 0 1 −2 1 0 ⎟ ⎜𝑢4 ⎟ ⎜𝑓4 ⎟
⎜0 0 0 1 −2 1 𝑢5 ⎜𝑓5 ⎟
⎟ ⎜ ⎟
⎜ ⎟⎜ ⎟ ⎜ ⎟
⎝ 0 0 0 0 1 −1⎠ ⎝𝑢6 ⎠ ⎝𝑓6 ⎠

Note how the first and last rows in the matrix have only 2 nonzero terms and that the diagonal
entry has been reduced. For the first and last rows, the third entry must be equal to the solution
and the matrix entries cancel.

33
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

3.5 Finite Elements


The Finite Element Method can seem a little intimidating and it is true that a rigorous mathematical
derivation is a bit involved, requiring the introduction of arbitrary test functions and integration by
parts. However, the underlying ideas and the linear finite elements that are commonly encountered
in graphics are actually quite straightforward.
As seen in the last section, finite differences discretize derivatives directly by replacing infinitesi-
mal differences with finite ones. The key idea underlying the finite element method is to, instead,
discretize the space of functions that can be represented and solve problems in that limited space.
As the name implies, we begin by breaking an object up into a finite set of elements. The elements
are disjoint (non-overlapping) and provide a spatial discretization of the object. Common elements
are simplices (triangles in 2D and tetrahedra in 3D) and deformed hypercubes (quadrilaterals in
2D and hexahedra in 3D). We then define basis functions over these elements. Unsurprisingly, the
most common basis function space is piecewise linear and we will limit our discussion to this
case. Arbitrary functions in the equations we wish to solve are then projected onto this piecewise
linear space. This projection is often referred to as a Galerkin projection. Intuitively, given a spatial
discretization, we find the closest piecewise linear function to the function of interest. We then
solve the problem in this limited space, resulting in a piecewise linear solution, which, of course,
just an approximation to the solution to the original problem.
Application to Soft Bodies. Finite elements are commonly used in graphics for animating
elastic bodies. Recall that to do so we must compute the deformation gradient, 𝐅. Because we
are using a piecewise linear basis to represent the deformation function 𝐱(𝐮), the gradient of this
function will be piecewise constant. That is 𝐅 is constant over an element. Recall that an arbitrary
point inside a triangle can be represented with barycentric coordinates as
𝐮 = 𝐮0 + 𝛼 (𝐮1 − 𝐮0 ) + 𝛽 (𝐮2 − 𝐮0 ) . (139)
That same point, in the deformed element will have the same barycentric coordinates and can be
computed as
𝐱 = 𝐱0 + 𝛼 (𝐱1 − 𝐱0 ) + 𝛽 (𝐱2 − 𝐱0 ) . (140)
Letting 𝐮𝑎𝑏 be the vector 𝐮𝑎 − 𝐮𝑏 and similarly for 𝐱, we can write these in matrix form as
𝛼
𝐮 = 𝐮0 + (𝐮10 𝐮20 ) (141)
(𝛽 )
and
𝛼
𝐱 = 𝐱0 + (𝐱10 𝐱20 ) , (142)
(𝛽 )
where the columns of the matrices are vectors along the edges of the element. Putting these together
we can write the deformation function that takes 𝐮 to 𝐱(𝐮) as
−1
𝐱(𝐮) = 𝐱0 + (𝐱10 𝐱20 ) (𝐮10 𝐮20 ) (𝐮 − 𝐮0 ) . (143)
The gradient of this function with respect to 𝐮, the deformation gradient is,
𝜕𝐱 −1
𝐅= = 𝐱10 𝐱20 ) (𝐮10 𝐮20 ) . (144)
𝜕𝐮 (
Thus, the finite element method, using linear basis functions, allows us to compute the defor-
mation gradient for a single element by simply assembling matrices composed of vectors along
edges of the elements, inverting one of the matrices and then performing a matrix multiply. This
simple process is remarkably powerful because once we have the deformation gradient we compute
any stress measure we would like and from there compute elastic forces. Also, note that if the

34
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Rest/Material Canonical World

<latexit sha1_base64="/YWnvgzpDtV6CNot1FGM2b72lJk=">AAACH3icbVDLSsNAFJ3UV42vqks3wSK4Kkk3uix147KCfUASymQybYfOI8xMlDLkM9wqfo07cduv0STNQlsPDBzOuZd75kQJJUq77tKqbW3v7O7V9+2Dw6Pjk8bp2UCJVCLcR4IKOYqgwpRw3NdEUzxKJIYsongYze8Kf/iEpSKCP+pFgkMGp5xMCII6l/yga9JsbNpuZo8bTbfllnA2iVeRJqjQGze+g1iglGGuEYVK+Z6b6NBAqQmiOLODVOEEojmcYj+nHDKsQlNGzpyrXImdiZD549op1d8bBjKlFizKJxnUM7XuFeJ/np/qyW1oCE9SjTlaHZqk1NHCKf7vxERipOkiJxBJkmd10AxKiHTekh1w/IwEY5DHJuhmvheaIBI0LqIIaoLinmSm6WVZ2Zi33s8mGbRbntvyHtxmp1t1VwcX4BJcAw/cgA64Bz3QBwgI8AJewZv1bn1Yn9bXarRmVTvn4A+s5Q+bOaOC</latexit>
sha1_base64="PuUH45tvQ75b/y3hvyQ9nBUNTPI=">AAACH3icbVDLSsNAFL3xbX1VXboJFsFVTbrRZakblwq2FZJQJpOpDp1HmJkoZchnuFX8Gnfitl/hJ+ik7cLXgYHDOfdyz5w0Z1SbIJh4C4tLyyura+u1jc2t7Z367l5Py0Jh0sWSSXWTIk0YFaRrqGHkJlcE8ZSRfjo6r/z+PVGaSnFtxjlJOLoVdEgxMk6K4o4tyoFtBWVtUG8EzWAK/y8J56TRPjn+aAPA5aD+GWcSF5wIgxnSOgqD3CQWKUMxI2UtLjTJER6hWxI5KhAnOrHTyKV/5JTMH0rlnjD+VP2+YRHXesxTN8mRudO/vUr8z4sKMzxLLBV5YYjAs0PDgvlG+tX//Ywqgg0bO4Kwoi6rj++QQti4lmqxIA9Yco5EZuNOGYWJjVPJsiqKZDau7iluG2FZThsLf/fzl/RazTBohleuug7MsAYHcAjHEMIptOECLqELGCQ8whM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jqTP8JmSRvwlTT/KAX+N1c5hHHlS9sbWtajdV7V2qb/4tCdm0188H+bLwNiBr0B8e/frxEyF0Ou39LWrNWgnKMUGtnZC8caWnxnEmIHq0FhrKrugcJhEqKsGWfhlRwK8iU+OZNvEph5fspsJTae1CVnEzXnlpb8868q7ZpHWzd6XnqmkdKLYymrUCO427vHHNDTAnFhFQZni8FbNLaihz8VeyQsE101LSGE8xChNS+qLSou5O0cIXnZ+Rvk9CWCZGbuezDc4OByQfkC8xuhFa1S56gV6iN4igYzREn9ApGiOG/iQ7yV6ynx6kx+lJOlytpsla8xz9V+nnfw5Vyp8=</latexit>
sha1_base64="iYt6ETyINIoasnv75M7WPN6AOgU=">AAACj3icbVHLbhMxFPUMFMoAbQoSm24sIhAbonG7KBuqKEiI7opE2kqZIfJ47qRW/RjZHtrImk9hwUfwDXwDKz4FPEkWoemVLJ177j06V8dFLbh1afo7iu/d33rwcPtR8vjJ053d3t6zM6sbw2DMtNDmoqAWBFcwdtwJuKgNUFkIOC+uPnTz829gLNfqi5vXkEs6U7zijLpATXvzbOQ/tvh9khUw48rXkjrDb9ok8Dft1JO0xa/xqjlIAw+qXNvaVDXrquYu1Vf/lrTJtNdPB+mi8CYgK9AfHv76/qN68fN02vublZo1EpRjglo7IWntck+N40xA8Ggs1JRd0RlMAlRUgs39IqIWvwpMiSttwlMOL9h1hafS2rkswma48tLennXkXbNJ46p3ueeqbhwotjSqGoGdxl3euOQGmBPzACgzPNyK2SU1lLnwK0mm4JppKWmIJxu1E5L7rNCi7E7Rwmedn5G+T9p2kRi5nc8mODsYkHRAPofoRmhZ22gfvURvEEFHaIg+oVM0Rgz9ibainWg33ouP4uN4uFyNo5XmOfqv4pN/3K3L0Q==</latexit>

Fig. 7. The finite element method. To compute the deformation gradients we assemble matrices
composed of vectors along the edges of the elements in rest and world space. We invert the rest space
matrix and premultiple by the world space matrix.

object’s rest shape does not change, the matrix that needs to be inverted is constant and can be
precomputed. See Figure 7.
Probably the most common strain model in computer graphics, as mentioned in Section 2.2.2, is
the co-rotated model where we compute the polar decomposition 𝐅 = 𝐐𝐅̃ and then compute strain
as
1 𝑇
𝜖 = (𝐅̃ + 𝐅̃ ) − 𝐈. (145)
2
We can then compute stress as
𝝈 = 𝜆Tr (𝜖) 𝐈 + 2𝜇𝜖. (146)
And finally forces are given by
𝐟 = 𝐐𝝈𝐧𝑖 , (147)
where 𝐧𝑖 is the area weighted normal of the edge (2D) or face (3D) opposite the node the force is
acting upon in the rest configuration. The simplicity of the finite element approach can be seen in
Algorithm 25 , which differs little from Algorithm 1.

5 Thereare a couple of obvious optimizations: inverse(Matrix3x3(u1-u0, u2-u0, u3-u0)) in line 6 can be precomputed and line
8 can be simplified because Ftilde is symmetric.

35
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Algorithm 2 Finite Element Timestep Loop


1: for Particle p : particles do
2: p.frc = 0
3: p.frc += p.mass*gravity
4: end for
5: for Element e : elements do
6: Matrix3x3 F = Matrix3x3 (x1-x0, x2-x0, x3-x0) * inverse(Matrix3x3(u1-u0, u2-u0, u3-u0))
7: PolarDecomp (F, Q, Ftilde)
8: Matrix3x3 strain = 1/2 * (Ftilde + transpose (Ftilde)) - I
9: Matrix3x3 stress = lambda * trace(strain) * I + 2 * mu * strain
10: for 𝑖 = 0 to 3 do
11: particles[e.node[i]].frc += Q * stress * e.normal[i]
12: end for
13: end for
14: for Particle p : particles do
15: p.vel += dt*(p.frc / p.mass)
16: p.pos += dt*(p.vel)
17: end for

4 TEMPORAL DISCRETIZATION
In addition to discretizing space, we must also discretize time. For the purposes of animation we
typically march forward through time outputing frames at some regular frequency. Though the
timestep can vary in size, a fixed timestep is often adopted for simplicity and to avoid unwanted
changes in material behavior, which may occur with changes in timestep size. Typically there are
several timesteps per frame of animation, but most modern animation systems try to take as few
steps per frame as possible.

4.1 Explicit Integration


Explicit integration refers to integration techniques where the updated state at time 𝑡 + Δ𝑡 is de-
scribed solely in terms of quantities computed at time 𝑡 . The Euler integrator discussed in Section 1,

𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + Δ𝑡 ⋅ 𝐯(𝐱𝑝 , 𝑡). (148)

is an explicit integrator. We have an explicit formula for 𝐱𝑝 (𝑡 + Δ𝑡) in terms of quantities evaluated
at time 𝑡 , 𝐱𝑝 (𝑡) and 𝐯(𝐱𝑝 , 𝑡). There are infinitely many such integration techniques all with different
properties. In studying such integrators it is important to remember that properties that are
important for particular applications, may not be important for computer animation and that
integration techniques that may seem very similar can have very different behavior in practice.

4.1.1 Trapezoidal Rule vs. Midpoint Method. Let’s take a closer look at the particular cas of
the Trapezoidal Rule and the Midpoint Method. You may remember these from your first calculus
class where you learned to integrate the area under a curve by computing the area of various
rectagles. See Figure 8. It turns out that these methods can also be applied to our problem of moving
massless particles through a velocity field from Section 1.1.
For the trapezoidal rule, we evaluate the velocity at the particle’s position, pretend to move
the particle a full timestep and evaluate the velocity again, then use the average of these two

36
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Fig. 8. From left to right: Forward Euler, Trapazoidal Rule, and Midpoint Method.

evaluations to update the particle’s position, see Figure 9. Mathematically,


Δ𝑡
𝐱(𝑡 + Δ𝑡) = 𝐱(𝑡) + (𝐯(𝐱(𝑡), 𝑡) + 𝐯(𝐱 + Δ𝑡𝐯(𝐱, 𝑡), 𝑡)) . (149)
2
For the midpoint method, we evaluate the velocity at the particle’s position, pretend to move the
particle a half step and evaluate the velocity again, then use the second evaluation to update the
particle’s position, see Figure 9. Mathematically,
Δ𝑡
𝐱(𝑡 + Δ𝑡) = 𝐱(𝑡) + Δ𝑡 𝐯(𝐱 + 𝐯(𝐱, 𝑡), 𝑡) . (150)
( 2 )
These are both second order Runge-Kutta (RK2) methods and Taylor series analysis easily reveals
that these methods both have local truncation errors of 𝑂(Δ𝑡 3 ) and are second-order accurate.
They are both frequently used in computer animation as the improvement in accuracy over the
Euler integrator does seem to be worth the cost of the additional evaluation in many contexts.
But, they do behave quite differently. Because the trapezoidal rule averages to velocity estimates it
tends to produce a smoother solution, while the midpoint method is more susceptible to noise or
aliasing. In some cases the additional smoothing of the trapezoidal rule is desired, in other cases
these solutions appear overly damped and the midpoint method is preferred.
The take away point is that there is more to a numerical method than its accuracy and that
differences that can seem quite subtle during analysis can be significant in practice.
4.1.2 Symplectic Euler. We already saw the Symplectic Euler integrator in Section 1, but it is
important enough to revisit. For a second-order ordinary differential equation, e.g. Newton’s Second
Law, there are three obvious numerical methods for updating the position:
𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + 𝑑𝑡 ⋅ 𝐯𝑝 (𝑡) (151)

𝑑𝑡
𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + ⋅ 𝐯𝑝 (𝑡) + 𝐯𝑝 (𝑡 + Δ𝑡)) (152)
2 (
𝐱𝑝 (𝑡 + Δ𝑡) = 𝐱𝑝 (𝑡) + 𝑑𝑡 ⋅ 𝐯𝑝 (𝑡 + Δ𝑡). (153)
The first one doesn’t seem to have a name associated with it, but the middle one is sometimes
called Improved Euler and the third one is called Symplectic Euler. Obviously the only difference is
where the velocity is evaluated, at the beginning of the step, end of the step, or an average of both.
From the discussion above, the reader may guess that improved Euler is second-order accurate and
that is partially true. It turns out that depending on the problem improved Euler may not converge
at all. In particular, for pure elasticity problems one can fairly easily show that improved Euler
is unconditionally unstable for open-ended (i.e. infinite) time integration. That means no matter

37
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

octave:1> [x,y] = meshgrid(0:.5:2*pi,0:.5:2*pi);


quiver(x,y,x,5*cos(x))

Fig. 9. Trapazoidal Rule (top) vs. Midpoint Method (bottom) for integrating a path through a velocity
field. The black arrow is the first velocity evaluation, the orange arrow is the second, and the gray
arrow is the velocity used to upate the particles position. Note that the midpoint mehtod moves only
halfway along the path from the first estimate and that the trapazoidal rule uses the average of the
two velocity evaluations
octave:1> to update the position.
[x,y] = meshgrid(0:.5:2*pi,0:.5:2*pi);
quiver(x,y,x,5*cos(x))
38
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

how small the timestep the solution will still diverge. In practice, for most problems in computer
animation symplectic Euler is the preferred explicit integrator, despite its lower order accuracy.
Again, this demonstrates that there is more to chosing a numerical method than simple order of
accuracy and numerical experiments are often necessary to determine the best choice.

4.2 Implicit Integration


Sometimes we wish to solve stiff problems. “Stiff problem” is not particularly well defined, but
they occur, for example, when materials have very strong resistance to deformation.As problems
become more stiff, explicit integrators require smaller and smaller timesteps in order to remain
stable. In the simple case of a zero-length spring where
𝐟 = −𝑘𝐱 (154)
with initial displacement 𝐱𝟎 , initial velocity of 0, and mass 𝑚. If we use our symplectic Euler
integrator we after the first step our new position will be
Δ𝑡 2 𝑘
𝐱(Δ𝑡) = 1 − 𝐱 . (155)
( 𝑚 ) 𝟎
√ √
If Δ𝑡 > 𝑚 𝑘 we will overshoot the origin. If Δ𝑡 > 2𝑚 the spring will be more extended then when
𝑘
it started and our solution will diverge. So, as 𝑘 increases the size of our timestep must decrease to
maintain stability. If we wish to avoid this timestep restriction, we can switch to implicit integration.
Here is our explicit symplectic Euler integrator again:
𝐯(𝑡 + Δ𝑡) = 𝐯(𝑡) + Δ𝑡 ⋅ 𝐌−1 𝐟(𝐱(𝑡), 𝑡)
(156)
𝐱(𝑡 + Δ𝑡) = 𝐱(𝑡) + Δ𝑡 ⋅ 𝐯(𝑡 + Δ𝑡).
and here is the implicit formulation:
𝐯(𝑡 + Δ𝑡) = 𝐯(𝑡) + Δ𝑡 ⋅ 𝐌−1 𝐟(𝐱(𝑡 + Δ𝑡), 𝑡 + Δ𝑡)
(157)
𝐱(𝑡 + Δ𝑡) = 𝐱(𝑡) + Δ𝑡 ⋅ 𝐯(𝑡 + Δ𝑡).
The only difference is that in the implicit version, forces are evaluated at 𝑡 + Δ𝑡 . But, because we
can’t directly compute the forces at 𝑡 + Δ𝑡 without knowing the system state at 𝑡 + Δ𝑡 the new
state is defined implicitly as one which satisfies this equation. This definition is analogous to the
definition of implicit surfaces being the set of points that satisfy an equation (e.g 𝑥 2 + 𝑦 2 = 𝑟 2
defines a circle). Generally, this is a complex non-linear problem and Newton’s method is often
employed in conjunction with a variety of performance enhancing approaches. However, we will
consider the simplest version of the problem, which can be thought of as a single Newton iteration,
where we linearize the system around the current state and solve the linearized problem. We take
our non-linear dynamic system for soft bodies,

𝐊(𝐱 − 𝐱0 ) + 𝐃(𝐱)̇ + 𝐌𝐱̈ = 𝐟 𝑒𝑥𝑡 , (158)


where 𝐱0 is the rest state. We then linearize to get
𝐊𝐱 − 𝐊𝐱0 + 𝐃𝐱̇ + 𝐌𝐱̈ = 𝐟 𝑒𝑥𝑡 . (159)
Thus our forces are
̇
𝐟 𝑒𝑥𝑡 − 𝐊𝐱 + 𝐊𝐱0 − 𝐃𝐱. (160)
Substituting these forces and the second equation of Equation (157) into the first equation of Equa-
tion (157) we have,
𝐯(𝑡 + Δ𝑡) = 𝐯(𝑡) + Δ𝑡 ⋅ 𝐌−1 [−𝐊 (𝐱(𝑡) + Δ𝑡𝐯(𝑡 + Δ𝑡)) + 𝐊𝐱0 − 𝐃𝐯(𝑡 + Δ𝑡) + 𝐟 𝑒𝑥𝑡 ] . (161)

39
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Rearranging terms we arrive at the linear system


2 (162)
(𝐌 + Δ𝑡 𝐊 + Δ𝑡𝐃) 𝐯(𝑡 + Δ𝑡) = 𝐌𝐯(𝑡) + Δ𝑡 (−𝐊 (𝐱(𝑡) − 𝐱0 ) + 𝐟 𝑒𝑥𝑡 ) .
This integrator is often referred to as Linearly Implicit Euler and can also be derived from a first-
order Taylor expansion. It is worth noting that the right hand side corresponds to an explicit Euler
step that ignores damping forces. The matrix on the left hand side acts as a smoothing filter on this
explicit Euler step. Traditionally, this system is solved with preconditioned conjugate gradients
to take advantage of the sparse structure of the matrix on the left hand side. This integrator is
also the first step in a Newton’s method solution of a fully implicit backwards Euler integrator for
the non-linear problem. As such it is sometimes referred to as semi-implicit Euler or semi-implicit
Backward Euler.

40
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

5 CONSTRAINTS
Newton’s second law describes the evolution of a body under applied forces. However, in many
scenarios, it is more natural and convenient to specify conditions on the positions or velocities
of the body that should be satisfied, rather than the forces acting on the body. These conditions
are referred to as constraints. For example, an object resting on a table is subject to gravity and
possibly other external forces, while constrained to not penetrate the table. How is this constraint
maintained physically? By Newton’s third law, the table pushes on the object with a force equal in
magnitude and opposite in direction to the force of the object on the table. The net effect on the
object will be to prevent penetration. The force associated with the non-penetration constraint will
be exactly the force necessary to maintain the constraint. In this scenario and others, the constraint
force arises instantaneously in response to other forces in the system to maintain the constraint. It
is thus more natural to specify the constraint and determine the necessary force than to specify the
constraint force. There are a many types of constraints as well as a variety of methods for solving
problems of constrained dynamics.

5.1 Bilateral / Unilateral constraints


The number of degrees of freedom (DOF) in a system is the number of independent parameters
needed to fully specify the configuration of the system. For example, in three-dimensional space, a
single particle has three degrees of freedom, and a single rigid body has six degrees of freedom. A
holonomic constraint is a relationship between the positional degrees of freedom in the system of
the form
𝑔(𝑥1 , 𝑥2 , … , 𝑥𝑛 , 𝑡) = 0. (163)
Note that it may depend on time. The constraint defines a relationship between the positional
degrees of freedom that must be satisfied, therefore it implicitly removes degrees of freedom, since
given 𝑛 − 1 of the 𝑛 positions, the remaining position can be determined using Eq. (163).
Implicitly, Eq. (163) defines a manifold embedded in the 𝑛-dimensional space. The constraint in
(163) is a bilateral or equality constraint, as it requires that the positions be on the manifold and
prohibits them from being off the manifold to either side.
As an example of such a constraint, consider two rigid bodies in two dimensions that are attached
at their ends, but free to rotate about the point of attachment, as illustrated below. The degrees of

Fig. 10

freedom of the rigid bodies ignoring the constraint are 𝐱1 , 𝜃1 , and 𝐱2 , 𝜃2 , and the constraint can be
written as
𝐠(𝐱1 , 𝜃1 , 𝐱2 , 𝜃2 ) = (𝐱1 + 𝐫1 ) − (𝐱2 + 𝐫2 ) = 𝟎. (164)

41
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Here 𝐠 ∶ ℝ6 → ℝ2 and implicitly removes two DOF, so that the constrained problem has 6 − 2 = 4
degrees of freedom. We can also see this as the system configuration is fully determined by
specifying the position of the attachment point in ℝ2 , and the angle of each rigid body, giving a
total of 4 DOF.
In a unilateral or inequality constraint, the equality sign in (163) is replaced by an inequality, so
that the constraint takes the form
𝑔(𝑥1 , 𝑥2 , … , 𝑥𝑛 , 𝑡) ≥ 0. (165)
This form of constraint arises when one body is in contact with another. In such cases, the bodies
are free to move apart, but are prohibited from interpenetrating. An example is illustrated below,
where a ball rests on a surface. The ball is constrained from moving into the surface, but can be
freely lifted off the surface. The point of contact is shown in light blue. The constraint can be

written as
𝐠(𝑥1 , 𝑦1 , 𝜃1 ) = 𝑦1 − ℎ ≥ 0, (166)
where 𝑦1 is the height of the center of the ball. This constraint allows the ball to slide, so that its
lateral position 𝑥1 and orientation 𝜃1 are independent. If the ball is further restricted to rolling,
then 𝑥1 and 𝜃1 would not evolve independently during contact.
Inequality constraints arise in other cases as well, for example when limits are set on the legal
range of joint angles in an articulated rigid body.

5.2 Soft vs. Hard


Constraints can also be said to be either hard or soft. A hard constraint is one which should be
satsified exactly. Thus the forces maintaining it should be able to overcome any competing forces
that act to violate the constraint. In constrast, a soft constraint need not be satisfied exactly; some
amount of error is tolerated. The forces maintaining the soft constraint are not arbitrarily strong as
in the case of hard constraints, and competing forces can cause the constraint to be violated until
those forces subside.

5.3 Solution Methods: Penalty Forces, Lagrange Multipliers, Generalized Coordinates


There are several approaches to simulation of constrained dynamics problems. Most broadly,
they fall into two categories: approaches which use maximal coordinates, the coordinates of the
bodies disregarding the constraints, and impose auxiliary conditions defining the constraints,
and approaches which use generalized coordinates (sometimes referred to as reduced coordinates,
perhaps because they are reduced in number as compared with maximal coordinates), which are
parameters representing directly the degrees of freedom after accounting for the constraints, and
from which the maximal coordinates can then be deduced. Penalty methods and the method of

42
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Lagrange multipliers are examples of approaches that use maximal coordinates. We discuss these
first.
Penalty methods. Penalty methods attempt to enforce constraints by penalizing constraint
violation using spring-like restoring forces. As an example, consider the scenario illustrated in
Figure 10 where the ends of two rigid bodies are attached. As a simple illustration of a penalty
method, we add a zero restlength spring that connects the two ends of the rigid bodies, as illustrated
below. The first rigid body then feels a force at its attachment point equal to

𝐟 21 (𝐱1 , 𝜃1 , 𝐱2 , 𝜃2 ) = −𝑘 ((𝐱2 + 𝐫2 (𝜃2 )) − (𝐱1 + 𝐫1 (𝜃1 ))) , (167)

while the second rigid body feels a force at its attachment point equal to

𝐟 12 (𝐱1 , 𝜃1 , 𝐱2 , 𝜃2 ) = −𝐟 21 (𝐱1 , 𝜃1 , 𝐱2 , 𝜃2 ). (168)

More generally, penalty forces may be formulated based on an energy associated with the constraint
violation as in [Faure et al. 2008] and may include damping terms that depend on derivatives of the
constraint [Bender et al. 2014].
While penalty terms for constraint violation are relatively simple to implement, they do suffer
from several drawbacks [Drumwright 2008; Bender et al. 2014]. As with the parameter 𝑘 in our
example above, penalty force terms contain one or more strength parameters. Tuning stiffness
parameters in complex systems with many competing forces can be challenging. When 𝑘 is relatively
large, the constraint will be better maintained. However, this introduces a stiff force into the system
which will incur a severe time step restriction or necessitate implicit integration. Penalty forces can
also lead to undesirable oscillations and make scenes with resting contact of many bodies difficult
to achieve [Bender et al. 2014]. Nevertheless, penalty methods are still widely used, and researchers
continue to develop approaches to mitigate their drawbacks [Harmon et al. 2009; Tang et al. 2012;
Xu et al. 2014].
Lagrange multipliers. The method of Lagrange multipliers is an approach that explicitly
includes in the equations of motion the constraint forces necessary to maintain the constraints.
Unlike a penalty force, the constraint force is exactly that force needed to counteract any other
forces violating the constraint. Although mathematically this is sufficient to maintain a constraint
that is satisfied initially, in practice additional stabilization techniques are required to counteract
drift in the constraint satisfaction.
Consider the constraint equation

𝑔(𝐱) = 0, (169)

43
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

where 𝐱 = (𝑥1 , 𝑥2 , … , 𝑥𝑛 ). This is an implicit surface equation defining all the legal positions 𝐱. The
gradient of the constraint is the vector
𝜕𝑔
⎛ 𝜕𝑥1 (𝐱)⎞
⎜ 𝜕𝑔 ⎟
(𝐱)
∇𝑔(𝐱) = ⎜ 𝜕𝑥2 ⎟ . (170)
⎜ ⋮ ⎟
⎜ 𝜕𝑔 ⎟
⎝ 𝜕𝑥𝑛 (𝐱)⎠
As illustrated in the figure above, the gradient vector is perpendicular to the surface. A vector 𝐳

which is tangent to the constraint surface at a point 𝐱 will satisfy 𝐳𝑇 ∇𝑔(𝐱) = 0.


Consider an arbitrary force 𝐅 applied to a constrained particle. If 𝐅 attempts to move the particle
off the constraint surface, a counteracting constraint force 𝐅𝑐 will arise. With the notable exception
of frictional contact forces, the constraint forces we consider act only in the direction ∇𝑔(𝐱), and
are therefore workless [Lanczos 2012]. This is expressed by considering a virtual displacement 𝛿𝑟
that is consistent with the constraints, as
𝐅𝑇𝑐 𝛿𝐫 = 0. (171)

Displacements consistent with the constraint are those such that 𝛿𝐫 = 𝛼𝐳, so that 𝛿𝐫𝑇 ∇𝑔 = 0.
Therefore, constraint forces that satisfy (171) are exactly those forces of the form
𝐅𝑐 = 𝜆∇𝑔 (172)
for some scalar 𝜆. The scalar 𝜆 is known as the Lagrange multiplier for the constraint, and determines
the strength of the constraint force.
More generally, we consider 𝑚 constraint equations,

⎛ 𝑔1 (𝐱) ⎞ ⎛0⎞
⎜ 𝑔 (𝐱) ⎟ ⎜0⎟
𝐠(𝐱) = ⎜ 2 ⎟ = ⎜ ⎟ = 𝟎. (173)
⎜ ⋮ ⎟ ⎜⋮⎟
⎝𝑔𝑚 (𝐱)⎠ ⎝0⎠
The Jacobian of the constraints is the 𝑚 × 𝑛 matrix
𝜕𝑔 𝜕𝑔1 𝜕𝑔1
⎛ 𝜕𝑥11 (𝐱) 𝜕𝑥2 (𝐱) … 𝜕𝑥𝑛 (𝐱) ⎞⎛ ∇𝑔1 (𝐱)𝑇 ⎞
⎜ 𝜕𝑔2 𝜕𝑔2 𝜕𝑔2 ⎟⎜ ⎟
𝜕𝐠 (𝐱) 𝜕𝑥2 (𝐱) … 𝜕𝑥𝑛 (𝐱) ⎟ ∇𝑔 (𝐱)𝑇 ⎟
𝐽 (𝐱) = (𝐱) = ⎜ 𝜕𝑥1 =⎜ 2 . (174)
𝜕𝐱 ⎜ ⋮ ⎟ ⎜ ⋮ ⎟
⎜ 𝜕𝑔𝑚 𝜕𝑔𝑚 𝜕𝑔𝑚 ⎟ ⎜∇𝑔 (𝐱)𝑇 ⎟
⎝ 𝜕𝑥1 (𝐱) 𝜕𝑥2 (𝐱) … 𝜕𝑥𝑛 (𝐱)⎠ ⎝ 𝑚 ⎠

44
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

In this case, the total constraint forces is comprised of 𝑚 terms, one for each constraint, 𝜆1 ∇𝑔1 +
𝜆2 ∇𝑔2 + … + 𝜆𝑚 ∇𝑔𝑚 , which we write
𝐅𝑐 = 𝐽 𝑇 𝝀, (175)
for 𝝀 = (𝜆1 , 𝜆2 , … , 𝜆𝑚 ).
Given this form for the constraint forces, the equations of motion, including applied forces and
constraint forces, are written as
𝑀𝐚 = 𝐅 + 𝐅𝑐 = 𝐅 + 𝐽 𝑇 𝝀. (176)
We follow a derivation similar to [Baraff 1996; Witkin 2001]. The unknown 𝝀 can be determined
by requiring the acceleration 𝐚 of the system to be compatible with the constraint. To get this
condition, we differentiate the constraint equation with respect to time to get
̇
0 = 𝐠(𝐱) (177)
𝜕𝐠 𝑇
= ̇
𝐱(𝑡) (178)
𝜕𝐱
= 𝐽 (𝐱)𝐯(𝑡), (179)
This shows us that the legal velocities are those that are orthogonal to the constraint gradient,
parallel to 𝐳 in the figure above.
To get an expression involving the accelerations, we differentiate once more with respect to time
to get
̈
0 = 𝐠(𝐱) (180)
= 𝐽̇ 𝐯(𝑡) + 𝐽 𝐯(𝑡)
̇ (181)
= 𝐽̇ 𝐯(𝑡) + 𝐽 𝐚(𝑡) (182)
This is the condition that must be satisfied by the accelerations to maintain the position and velocity
level constraints. Plugging in 𝐚 from Eq. (176) into (182), we get

𝐽 𝑀 −1 (𝐅 + 𝐽 𝑇 𝝀 ) = −𝐽̇ 𝐯(𝑡). (183)

Isolating the terms involving 𝝀 on the left hand side, we get


(𝐽 𝑀 −1 𝐽 𝑇 )𝝀 = −𝐽 𝑀 −1 𝐅 − 𝐽̇ 𝐯(𝑡). (184)
In practice constraints often couple only a few degrees of freedom in the system. Therefore, the
factors 𝐽 and 𝑀 in (184) are typically sparse. However, the product 𝐽 𝑀 −1 𝐽 𝑇 is not generally sparse.
Baraff [Baraff 1996] reformulated Eq. (184) into the sparse KKT system
𝑀 −𝐽 𝑇 𝐲 𝟎
= , (185)
(−𝐽 0 ) (𝝀 ) (−𝐛)
where 𝐲 = 𝐚 − 𝑀 −1 𝐅, and 𝐛 = −𝐽 𝑀 −1 𝐅 − 𝐽̇ 𝐯(𝑡) is the left-hand side of (184), and described a
linear-time algorithm for its solution which is applicable in many practical cases. KKT systems
appear regularly in solution methods for a variety of constrained dynamics problems.
Generalized coordinates. So far we have treated constraints in maximal coordinates and used
Newton’s second law to define the equations of motion. Another approach to constrained dynamics
is based on finding a minimal set of independent coordinates, or generalized coordinates,
𝑞1 , 𝑞2 , … , 𝑞𝑁 ,

45
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

and expressing the equations of motion in terms of these coordinates and their derivatives. The
formulation of the equations of motion in terms of generalized coordinates is part of the subject of
variational mechanics, developed after Newton’s time by Euler, Lagrange, Hamilton, and others
[Lanczos 2012]. The choice of 𝑞𝑖 is not unique, but in some cases there may be a particular choice
which is natural and convenient.
The best-known example of generalized coordinates are those for a rigid body, which can be
viewed as a collection of particles where each pair of particles are constrained to be a fixed distance
apart. In three dimensions, a minimal set of six degrees of freedom, three for position and three for
orientation, is used to describe a rigid body. The maximal coordinates of any point on the body can
be calculated from the generalized coordinates using the well known formula in Section 2.2.1.
The 𝑛 (𝑛 > 𝑁 ) maximal coordinates are given as functions of the generalized coordinates,
𝑥1 = 𝑥1 (𝑞1 , 𝑞2 , … , 𝑞𝑁 ) (186)
𝑥2 = 𝑥2 (𝑞1 , 𝑞2 , … , 𝑞𝑁 ) (187)
⋮ (188)
𝑥𝑛 = 𝑥𝑛 (𝑞1 , 𝑞2 , … , 𝑞𝑁 ). (189)
Concatening all the maximal and generalized coordinates, we denote this 𝐱 = 𝐱(𝐪). In general,
Equations (186)-(189) may also depend on time, but for simplicity we do not consider that case
here. See [Murray et al. 1986; Lanczos 2012] for further details.
These expressions can be used to define the kinetic energy and potential energy of the system in
terms of the 𝐪 and 𝐪̇ , the generalized velocity. The velocity of the system is
𝜕𝐱
̇ =
𝐱(𝑡) ̇
𝐪. (190)
𝜕𝐪
Let 𝐽 (𝐪) = 𝜕𝐱
𝜕𝐪 be the Jacobian of the coordinate functions. The kinetic energy is given by
1 1 1
𝑇 = 𝐱̇ 𝑇 𝑀 𝐱̇ = (𝐽 𝐪)
̇ 𝑇 𝑀 𝐽 ̇𝐪̇ = 𝐪̇ 𝑇 𝐽 𝑇 𝑀𝐽 𝐪.
̇ (191)
2 2 2
Analogous to the force in the system of maximal coordinates, we can define generalized forces
for the system of generalized coordinates. For example, for a rigid body the generalized forces are
the six components of the force and torque and on the body. As described in detail in [Lanczos
2012], two sets of forces for two sets of coordinates will induce equivalent dynamics if they do
the same virtual work on a virtual displacement consistent with the constraints. Therefore, the
generalized forces for any system can be easily found by equating the virtual work done by both
sets of forces on virtual displacements consistent with the constraints as
𝐅 ⋅ 𝛿𝐱 = 𝐆 ⋅ 𝛿𝐪, (192)

where we have used 𝐆 ∈ ℝ𝑁 to represent the generalized forces. The displacements 𝛿𝐱 are required
to be consistent with the constraints, so 𝛿𝐱 = 𝐽 𝛿𝐪. Using this, we get

𝐅𝑇 𝛿𝐱 = 𝐆𝑇 𝛿𝐪 (193)
𝐅𝑇 𝐽 𝛿𝐪 = 𝐆𝑇 𝛿𝐪 (194)
The coordinates 𝛿𝐪 are unconstrained and so are arbitrary. This means we must have

𝐅𝑇 𝐽 = 𝐆𝑇 , or 𝐆 = 𝐽 𝑇 𝐅. (195)

46
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

We can verify this result in the case of a rigid body, where the velocity of a particle is
𝐯
𝐱̇ = (𝐼 𝐫∗𝑇 ) , (196)
(𝝎 )
so 𝐽 = (𝐼 𝐫∗𝑇 ). A force 𝐅 applied to the particle results in a generalized force on the body
𝐼 𝐅
𝐆 = 𝐽𝑇𝐅 = 𝐅= , (197)
(𝐫 ∗ ) (𝐫 × 𝐅)
which are the familiar expressions for force and torque.
The Lagrange equations of motion, analogous to Newton’s second law, can be written as
𝑑 𝜕𝑇
= 𝐆, (198)
𝑑𝑡 ( 𝜕 𝐪̇ )
where 𝐺 are the generalized forces. For conservative forces, we can define the Lagrangian, 𝐿 = 𝑇 −𝑉 ,
where 𝑉 is the potential energy associated with the forces, and express the above as the Euler-
Lagrange equations
𝑑 𝜕𝐿 𝜕𝐿
− = 𝟎. (199)
𝑑𝑡 ( 𝜕 𝐪̇ ) 𝜕𝐪
Additional generalized forces accounting for non-conservative forces or constraint forces not
respected by the generalized coordinates can be included on the right hand side of the Euler-
Lagrange equations.
As an example we consider the pendulum in two dimensions illustrated in the figure below. A

single particle of mass 𝑚 with maximal coordinates 𝐱 = (𝑥, 𝑦) is suspended at a length 𝑙 . Although
𝐱 has two coordinates, the system has only one degree of freedom due to the constraint imposed
by the pendulum. We use the angle of pendulum with the vertical, 𝜃 , as the generalized coordinate.
With the origin at the attachment point, the maximal coordinates are
𝑥(𝜃) = 𝑙 sin 𝜃 (200)
𝑦(𝜃) = −𝑙 cos 𝜃 (201)
The velocity is
̇
𝑥(𝜃) 𝑙 cos 𝜃 𝜃̇
= = 𝐽 𝜃.̇ (202)
̇ )
(𝑦(𝜃) ( 𝑙 sin 𝜃 𝜃̇ )
The kinetic energy is
1 1
𝑇 = 𝑚(𝑥̇ 2 + 𝑦̇ 2 ) = 𝑚𝑙 2 𝜃̇ 2 .
2 2
We have
𝜕𝑇
= 𝑚𝑙 2 𝜃,̇
𝜕 𝜃̇
47
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

and thus
𝑑 𝜕𝑇
= 𝑚𝑙 2 𝜃.̈ (203)
𝑑𝑡 ( 𝜕 𝜃̇ )
The only force we need to explicitly account for is gravity, given in maximal coordinates as
(0, −𝑚𝑔)𝑇 . The generalized force is therefore
0 0
𝐽𝑇 = (𝑙 cos 𝜃 𝑙 sin 𝜃 ) = −𝑙𝑚𝑔 sin 𝜃. (204)
(−𝑚𝑔 ) (−𝑚𝑔 )
Putting together Equations (203) and (204), we get

𝑚𝑙 2 𝜃̈ = −𝑙𝑚𝑔 sin 𝜃,
or the well-known equations of motion for a pendulum
𝑔
𝜃̈ + sin 𝜃 = 0.
𝑙

5.4 Practical Constrained Rigid Body Systems


Practical rigid body simulation systems must deal with a variety of constraints. These include
articulation constraints, or joints (e.g., ball and socket, revolute, prismatic), collisions, and resting
and sliding contact. For ragdoll physics, where the connectivity prescribed by the articulation
constraints is that of a tree (no closed loops), generalized coordinates are often efficiently employed
[Bender et al. 2014], using e.g., Featherstone’s algorithm [Featherstone 1983]. For other types of
constraints, constraint forces are widely used. In these cases, several modifications are made to the
formulation of Lagrange multipliers presented in Section 5.3.
In Section 5.3, we took the second time derivative of the constraint equation, which gave us an
acceleration-level condition for constraint satisfaction. We then derived the linear system for the
Lagrange multipliers by plugging in the acceleration from Newton’s second law into this condition
and solving for 𝝀 . This effectively determines the forces needed to maintain a legal acceleration.
Assuming that the position and velocity are already legal, legal accelerations should result in
maintenance of the position and velocity level constraints over the time. In practice, there are issues
with acceleration-level constraints that make them unsuitable as a general-purpose approach in
rigid body systems. Newton’s second law describes a continuous evolution of the velocity. However,
collision of rigid bodies results in a discontinuous change in velocity, as when a rigid block hits the
ground and immediately bounces back up. Acceleration-level resolution of constraints has also
been found to be problematic in modeling frictional contact scenarios, as when an object is pushed
over a rough surface (as in the Painlevé paradox).
For these reasons, many systems model rigid body constraints on the velocity level, using the
integrated Newton’s equations that describe finite velocity changes [Mirtich 1996; Guendelman
et al. 2003; Weinstein et al. 2006]. In the velocity-level formulation, impulses change the velocity of
a body discontinuously. An impulse is defined as the integral of a force acting over time,
𝑡2
𝐣=∫ 𝐟 𝑑𝑡. (205)
𝑡1
It therefore has units of momentum, N ⋅ s = kg m/s. An impulse applied to a particle of mass 𝑚 will
result in a change of momentum of the particle. Integrating Newton’s second law for a particle

48
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

with mass 𝑚 with respect to time, we get the momentum-impulse equation


𝑡2 𝑡2
∫ 𝑚𝐚 𝑑𝑡 = ∫ 𝐟 𝑑𝑡, (206)
𝑡1 𝑡1
⇒ 𝑚(𝐯(𝑡2 ) − 𝐯(𝑡1 )) = 𝐣. (207)
To reformulate the system (185) on the velocity level, we consider the discretized Newton’s law
𝑀𝐕𝑛+1 = 𝑀𝐕𝑛 + Δ𝑡𝐅 + Δ𝑡𝐽 𝑇 𝝀 𝑛+1 . (208)
The velocity constraint (179) is 𝐽 𝐕𝑛+1 = 𝟎. Defining 𝝁𝑛+1 = Δ𝑡𝝀 𝑛+1 , moving the unknowns 𝐕𝑛+1
and 𝝁𝑛+1 to the left hand side, and combining the two equations gives the linear system [Tournier
et al. 2015]
𝑀 −𝐽 𝑇 𝐕𝑛+1 𝑀𝐕𝑛 + Δ𝑡𝐅
= . (209)
(−𝐽 0 ) ( 𝝁𝑛+1 ) ( 𝟎 )
This linear system is similar to Eq. (185), but has units of momentum instead of force. Notice also
that instead of 𝝀 , we have the impulse form 𝝁 = Δ𝑡𝝀 as the unknown. If we eliminate 𝐕𝑛+1 from
the equations, we get the system
𝐽 𝑀 −1 𝐽 𝑇 𝝁𝑛+1 = −𝐽 𝐕𝑛 − Δ𝑡𝐽 𝑀 −1 𝐅. (210)
Equation (210) is an equation that couples the solution of the constraints impulses, which occurs
because when a body’s velocity is adjusted to satisfy a constraint, it may result in the violation of a
different constraint. The constraints in the system must be taken into account simultaneously to give
a solution that satisfies them all. In practice, many systems use an impulse-based approach [Mirtich
1996; Guendelman et al. 2003; Weinstein et al. 2006], computing an approximate solution to (210)
using a limited number of Gauss-Seidel iterations, where each constraint is updated independently
using the most recently computed state of the other constraints. Interactive applications may
severely limit the number of allowed Gauss-Seidel iterations, and require techniques such as warm-
starting the solution (with the solution from the previous time step) to achieve acceptable results
[Catto 2014]. Gauss-Seidel approaches can be very slow to converge when a light object couples
the interaction between two heavier objects, as the light object will not succeed in moving the
heavy object very much during a single pairwise iteration. This messenger problem can be partially
mitigated by solving some constraints simultaneously, a compromise between solving the full
global system and local pairwise constraints [Shinar et al. 2008; Catto 2014].
Another issue which occurs in practice due to discretization and numerical errors is that of drift.
In the acceleration-level formulation of Section 5.3, the position and velocity are assumed to satisfy
the constraint initially, and only accelerations are required to be legal thereafter. Over time, this will
cause velocities and positions to drift away from legal states, creating noticeable artifacts such as
erroneous overlaps or gaps. The velocity-level formulation as presented so far in this section suffers
from a similar problem because it does not explicitly correct any position errors in the constraints.
To combat drift, stabilization techniques are employed [Bender et al. 2014]. A widely used approach
is Baumgarte stabilization [Baumgarte 1972], where the acceleration constraint equation 𝐠(𝐱) ̈ =0
is replaced with [Bender et al. 2014]
̈ + 2𝛼 𝐠(𝐱)
𝐠(𝐱) ̇ + 𝛽 2 𝐠(𝐱) = 0, (211)
for some parameters 𝛼 and 𝛽 which must be tuned. For the velocity-level formulation, the velocity
constraint equation 𝐠(𝐱)
̇ = 0 is replaced with
̇
𝐠(𝐱) + 𝛾 𝐠(𝐱) = 0, (212)

49
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Fig. 11. A convex polygon is one that fully contains the line segment joining any two points in the
polygon. The polygon on the left is nonconvex, while the polygon on the right is convex.

for some tunable parameter 𝛾 . When the position-level constraint 𝐠(𝐱) = 0 is already satisfied, this
will result in the same equation as before. If there is error in the position constraint, the computed
velocities will drive the error to zero.
Many practical rigid body systems (e.g., Bullet [Coumans 2010], ODE [Smith et al. 2005], and
Box2D [Catto 2011a]) add compliance to hard constraints by replacing 𝐽 𝐯 = 0 with
𝛽
𝐽𝐯 + 𝐠(𝐱) + 𝛾 𝝀 = 0, (213)
Δ𝑡
for constants 𝛽 and 𝛾 [Catto 2011b]. The linear system (209) then becomes
𝑀 −𝐽 𝑇 𝐕𝑛+1 𝑀𝐕𝑛 + Δ𝑡𝐅
𝑛+1 = 𝛽 . (214)
(−𝐽 𝛾 𝐼 ) ( 𝝁 ) ( − Δ𝑡 𝐠(𝐗𝑛 ) )
This makes the constraint a bit softer, while countering drift. Furthermore, Eq. (214) is easier
to solve numerically as the new diagonal block regularizes the equations, which may become
poorly conditioned in the case of redundant or nearly redundant constraints. See also [Catto 2011b;
Tournier et al. 2015; Lacoursiere 2007] for further details.

5.5 Collisions
Dynamic scenarios with many rigid or deformable solids will typically lead to many collisions
and contacts between objects. Soft bodies also experience self-collision, where one part of the
body deforms and collides with another part of the body. Cloth simulations in particular can
undergo many simultaneous self-collisions that can be challenging to resolve. In all of these cases,
a significant part of the computational cost of a solver is in detecting and resolving collisions and
contacts.
Collision detection. Before collisions can be resolved, they must first be detected by checking
for interpenetration of object geometry. Collision detection algorithms make use of a variety of
geometric representations.
Polygonal geometry is commonly used to represent both rigid and deformable bodies. Many
algorithms have been developed for finding intersections of polytopes, particularly convex polytopes
(illustrated above). The Separating Axis Theorem says that if a separating hyperplane can be found
between two convex shapes, they are disjoint and hence do not intersect. Faces of potentially
colliding geometry are natural candidates for separating hyperplanes. Convex decompositions are
often computed for nonconvex bodies for collision detection purposes. When using polygonal
geometry, various intersection cases must be considered, such as point-face intersections and
edge-edge intersections.

50
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Fig. 12. Left and middle: Three-dimensional dragon model and two-dimensional slice of its signed
distance field. Right: Signed distance field for a circle. The vertices of a polygonal shape, illustrated in
white, can be efficiently tested against the signed distance field to detect the interpenetration.

Another geometric representation commonly used in collision detection is the signed distance
field. The signed distance field 𝜙(𝐱) of an object assigns to each point in space 𝐱 the signed distance
from 𝐱 to the nearest point on the surface of the object. Points inside the object will have 𝜙 < 0
while points outside have 𝜙 > 0, or the other way around depending on the convention used. The
surface is then implicitly defined as the zero level set of 𝜙 , the points 𝐱 such that 𝜙(𝐱) = 0. Typically
𝜙 will be sampled on a structured grid containing the object. Surface points 𝐩 from other objects
can query 𝜙(𝐩) to determine in constant time whether they are inside or outside the object, as
illustrated in the figure below. Though inside/outside tests are fast, with many objects there can be
significant memory overhead in storing the distance fields. Also, while 𝜙 can be computed once
for rigid bodies in a preprocessing step, for deformable geometry it may need to be recomputed
intermittently. Another advantage of a signed distance representation is that the surface normals
needed for collision and contact resolution can be readily computed from the signed distance field
since 𝐧(𝐱) = ∇𝜙(𝐱).
For 𝑛 objects, there are 𝑂(𝑛2 ) pairs of objects. To make collision detection practical in simulations
with many interacting objects, acceleration structures must be employed. A common approach
is to create bounding volumes for the geometry, specifically volumes for which intersection tests
can be made very fast. The bounding volumes are then used to quickly prune the set of possible
intersections, since two objects do not intersect if their bounding volumes do not intersect. Spheres,
axis-aliged bounding boxes, and oriented bounding boxes are commonly used. Furthermore, hi-
erarchical bounding volumes can computed, potentially allowing for more efficient culling of a
large number of candidate intersections. In addition to bounding volumes, spatial partitions can
accelerate collision detection by indicating which objects are simultaneously present in a particular
region of space. The must be updated throughout the simulation as the objects evolve.
In discrete collision detection we consider the geometric state of objects in the scene at a fixed
instant in time, ignoring their trajectories. For large volumetric objects this is often sufficient.
However, thin objects such as cloth, or very small objects could experience intersections during a
time step that would not be evident when looking at a fixed instant of time at the beginning or
end of the time step. For example, a small object thrown at a piece of cloth could be fully on one
side of the cloth at the start of the time step and fully on the other side at the end of the time step.
However, between the two instants of time the object passed through the cloth, so in principle
a collision should be detected and resolved. Continuous collision detection takes into account the
trajectory of motion over the time step when checking for intersections. Analytical methods for
solving the intersection problem exist in some cases. Ray casting and numerical solvers are also
used. This is harder and more computationally intensive than discrete collision detection and some
systems may avoid continuous collision detection by limiting time steps.

51
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Collision response (1D). In collision response, the solver resolves a previously detected colli-
sion, typically by computing and applying a pair of impulses to the colliding bodies so that their
updated velocities are valid. Let us consider a simple example where two particles in one dimension
with masses 𝑚1 , 𝑚2 and velocities 𝑣1 , 𝑣2 collide, as illustrated below. By Newton’s third law, they

will exert equal and opposite forces on each other. The collision is instantaneous, so we find a pair
of impulses ±𝑗 that effect the change in momenta of the particles. Let 𝑣1′ and 𝑣2′ be the velocities of
the particles after the collision. We add impulses 𝑗 and −𝑗 to the system as
𝑚1 𝑣1′ = 𝑚1 𝑣1 + 𝑗 (215)
𝑚2 𝑣2′ = 𝑚2 𝑣2 − 𝑗, (216)
and require that the collision be inelastic, or sticking, which means that after the collision the
particles travel together, i.e.,
𝑣1′ = 𝑣2′ . (217)
We now have three equations and three unknowns. We solve for 𝑣1′ and 𝑣2′ in Equations (215) and
(216) and plug the expressions into Eq. (217) to get
1 1
(𝑚 𝑣 + 𝑗) = (𝑚 𝑣 − 𝑗). (218)
𝑚1 1 1 𝑚2 2 2
We can now solve for 𝑗 :
1 1
+ 𝑗 = 𝑣2 − 𝑣1 (219)
( 𝑚1 𝑚2 )
1 1 −1
⇒𝑗= + (𝑣2 − 𝑣1 ). (220)
( 𝑚1 𝑚2 )
For example, if 𝑣1 = 𝑣 , 𝑣2 = −𝑣 , and 𝑚1 = 𝑚2 = 𝑚, then the above tells us that 𝑗 = −𝑚𝑣 and
after the collision 𝑣1′ = 𝑣2′ = 0. If 𝑣1 = 𝑣 , 𝑣2 = −𝑣 , and 𝑚1 = 3, 𝑚2 = 1, then after the collision
𝑣1′ = 𝑣2′ = 12 𝑣 , so that the particles continue to travel together in the direction that the more
massive particle was traveling, with reduced speed.
It is also common to employ elastic collisions, especially in rigid body simulation. In that case,
instead of being zero, the relative velocity of the particles after collision is given by
(𝑣2′ − 𝑣1′ ) = −𝜖(𝑣2 − 𝑣1 ), (221)
where 𝜖 ∈ [0, 1] is the coefficient of restitution. Note that 𝜖 = 0 gives the inelastic case above.
Substituting the expressions for 𝑣1′ and 𝑣2′ from Eqs. (215) and (216) as before, and solving for 𝑗 we
get
1 1 −1
𝑗= + (1 + 𝜖)(𝑣2 − 𝑣1 ). (222)
( 𝑚1 𝑚2 )
For example, if 𝑣1 = 𝑣 , 𝑣2 = −𝑣 , and 𝑚1 = 𝑚2 = 𝑚, then for a perfectly elastic collision with 𝜖 = 1,
𝑗 = −2𝑚𝑣 , and 𝑣1′ = −𝑣 , 𝑣2′ = 𝑣 .

52
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

Deformable object collisions. Physically, the bounce resulting from a collision occurs due to
deformation of the colliding objects in some region around the collision. As the bodies collide,
they compress, and elastic energy is stored. The release of the energy results in the rebound
seen following the collision. Therefore, for deformable objects, one can use the inelastic collision
equations described above. The one-dimensional case generalizes straightforwardly to two or three
dimensions to give
𝑚1 𝐯′1 = 𝑚1 𝐯1 + 𝐣 (223)
𝑚2 𝐯′2 = 𝑚2 𝐯2 − 𝐣 (224)
𝐯′2 = 𝐯′1 , (225)
for a total of six equations and unknowns in two dimensions, or nine equations and unknowns
in three dimensions. The velocities are measured at the point of collision, and the impulses are
applied at the point of collision. As the objects deform, there may be many points of collision.
Rigid body collisions. For rigid bodies the situation is somewhat different than for deformable
bodies. Physically, such objects will also undergo deformation in a collision in the process described
above for deformable bodies. But given the rigid body idealization which prohibits any deformation,
a different approach is needed to model rigid body collisions. Typically, collision laws are used
to relate quantities before and after the collision [Chatterjee and Ruina 1998]. These are derived
similarly to the above derivations, but consider also the angular components of velocity and
momentum. The treatment of friction in the tangential directions of motion significantly complicates
rigid body collisions. We first consider the simpler cases of sticking and frictionless collisions.
Following [Ruina and Pratap 2009], we consider the collision of two rigid bodies with masses 𝑚1 ,
𝑚2 , inertia tensors 𝐼1 , 𝐼2 , linear velocities 𝐯1 , 𝐯2 , and angular velocities 𝝎 1 , 𝝎 2 . The velocities after
collision are denoted with a prime as before. The scenario is illustrated below. The figure identifies

a plane tangent to the bodies at the time of collision, with 𝐧 a unit normal the plane.
We write the linear momenta of the bodies before and after the collision,
𝑚1 𝐯′𝐶1 = 𝑚1 𝐯𝐶1 + 𝐣 (226)
𝑚2 𝐯′𝐶2 = 𝑚2 𝐯𝐶2 − 𝐣, (227)

53
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

and the angular momenta of the bodies before and and after collisions as
𝐼1 𝝎 ′1 = 𝐼1 𝝎 1 + 𝐫1 × 𝐣, (228)
𝐼2 𝝎 ′2 = 𝐼2 𝝎 1 − 𝐫2 × 𝐣. (229)
For a sticking collisions, the remaining equations state that the objects move at the same velocity
at the point of contact immediately following the collision:
𝐯′𝑃1 = 𝐯′𝑃2 , (230)
where
𝐯′𝑃1 = 𝐯′𝐶1 + 𝝎 ′1 × 𝐫1 , (231)
𝐯′𝑃2 = 𝐯′𝐶2 + 𝝎 ′2 × 𝐫2 (232)
are the velocities of the first and second body, respectively, at the collision point. The number of
equations/unknowns in (226)-(230) are eight in two dimensions and fifteen in three dimensions.
For a frictionless elastic collision, we assume
𝐣 = 𝑗𝐧, (233)
and replace Eq. (230) with a condition on the normal component of the relative velocities after
collisions, analogous to Eq. (221):
(𝐯′𝑃2 − 𝐯′𝑃1 ) ⋅ 𝐧 = −𝜖(𝐯𝑃2 − 𝐯𝑃1 ) ⋅ 𝐧, (234)

where 𝜖 ∈ [0, 1]. Given the linear and angular velocities of the bodies before the collision and the
collision plane at collision, these equations can be solved to determine the normal impulse and the
velocities of the bodies after the collision.
Frictional collisions. In frictional collisions, the impulse 𝐣 consists of both a normal component
and a tangential component that prevents or damps the relative tangential velocities of the bodies
at the point of collision.
We first describe the Coulomb friction model, which is an empirical model describing the frictional
forces that arise in sticking or sliding contact. According to the Coulomb friction model, the
magnitude of the tangential force cannot exceed 𝜇 ‖𝐟 𝑛 ‖, but may be less if the contact point is
sticking. The direction of the tangential force is directly opposing the tangential direction of motion.
The coefficient 𝜇 is called the coefficient of friction. When the contact is sliding, the tangential
force is at its maximum possible value, and is equal to
𝐟 𝑡 = −𝜇 ‖𝐟 𝑛 ‖𝐭,
where 𝐭 is the direction of motion. When the contact is sticking, the tangential force is just enough
to counteract other tangential forces. This is summarized in this plot, adapted from [Ruina and
Pratap 2009]: When the relative velocity at the contact point is positive, the frictional force is −𝜇𝑓𝑛 𝐭.
When the relative motion is negative, the frictional force is 𝜇𝑓𝑛 𝐭. When the relative velocity is zero,
the frictional force is between these two values.
The restrictions on the forces or impulses in the Coulomb friction model can be illustrated by
the friction cone, defined by the inequality
‖𝐟 𝑡 ‖ ≤ 𝜇 ‖𝐟 𝑛 ‖,
and shown here.

54
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

In [Guendelman et al. 2003], tangential frictional impulses were included in rigid body collisions
by first assuming sticking in the tangential direction, as

(𝐼 − 𝐧𝐧𝑇 )(𝐯′𝑃2 − 𝐯′𝑃1 ) = 𝟎, (235)

and solving this along with Eqs. (226)-(229) and (234). If the solution 𝐣 is in the friction cone, then
the sticking assumption is admissible and the impulse 𝐣 is used. If 𝐣 is not in the friction cone, then
sliding friction is applied. In practice, algebraic collision laws such as this one can give rise to some
nonphysical results. A detailed analysis of several collision laws is given in [Chatterjee and Ruina
1998].

REFERENCES
[Baraff 1996] David Baraff. 1996. Linear-time dynamics using Lagrange multipliers. In Proceedings
of the 23rd annual conference on Computer graphics and interactive techniques. ACM, 137–146.
[Baraff 2001] David Baraff. 2001. Physically based modeling: Rigid body simulation. SIGGRAPH
Course Notes, ACM SIGGRAPH 2, 1 (2001), 2–1.
[Baumgarte 1972] Joachim Baumgarte. 1972. Stabilization of constraints and integrals of motion in
dynamical systems. Computer methods in applied mechanics and engineering 1, 1 (1972), 1–16.
[Bender et al. 2014] Jan Bender, Kenny Erleben, and Jeff Trinkle. 2014. Interactive simulation of
rigid body dynamics in computer graphics. In Computer Graphics Forum, Vol. 33. Wiley Online
Library, 246–270.
[Bridson 2015] Robert Bridson. 2015. Fluid simulation for computer graphics. AK Peters/CRC Press.
[Catto 2011a] Erin Catto. 2011a. Box2d: A 2d physics engine for games. http://box2d.org/
[Catto 2011b] Erin Catto. 2011b. Soft Constraints: Reinventing the Spring. http://box2d.org/files/
GDC2011/GDC2011_Catto_Erin_Soft_Constraints.pdf

55
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

[Catto 2014] Erin Catto. 2014. Physics for Game Programmers: Understanding Constraints. https:
//www.youtube.com/watch?v=SHinxAhv1ZE
[Chatterjee and Ruina 1998] Anindya Chatterjee and Andy Ruina. 1998. A new algebraic rigid-body
collision law based on impulse space considerations. Journal of Applied Mechanics 65, 4 (1998),
939–951.
[Coumans 2010] Erwin Coumans. 2010. Bullet physics engine. Open Source Software:
http://bulletphysics. org 1 (2010), 3.
[Drumwright 2008] Evan Drumwright. 2008. A fast and stable penalty method for rigid body
simulation. IEEE Transactions on Visualization and Computer Graphics 14, 1 (2008), 231–240.
[Faure et al. 2008] François Faure, Sébastien Barbier, Jérémie Allard, and Florent Falipou. 2008.
Image-based collision detection and response between arbitrary volume objects. In Proceedings
of the 2008 ACM SIGGRAPH/Eurographics Symposium on Computer Animation. Eurographics
Association, 155–162.
[Featherstone 1983] Roy Featherstone. 1983. The calculation of robot dynamics using articulated-
body inertias. The International Journal of Robotics Research 2, 1 (1983), 13–30.
[Floater 2003] Michael S. Floater. 2003. Mean Value Coordinates. Comput. Aided Geom. Des. 20, 1
(March 2003), 19–27. https://doi.org/10.1016/S0167-8396(02)00002-5
[Guendelman et al. 2003] Eran Guendelman, Robert Bridson, and Ronald Fedkiw. 2003. Nonconvex
rigid bodies with stacking. In ACM Transactions on Graphics (TOG), Vol. 22. ACM, 871–878.
[Harlow and Welch 1965] Francis H. Harlow and J. Eddie Welch. 1965. Numerical Calculation of
Time-Dependent Viscous Incompressible Flow of Fluid with Free Surface. Physics of Fluids 8, 12
(1965), 2182–2189. https://doi.org/10.1063/1.1761178
[Harmon et al. 2009] David Harmon, Etienne Vouga, Breannan Smith, Rasmus Tamstorf, and Eitan
Grinspun. 2009. Asynchronous contact mechanics. ACM Transactions on Graphics (TOG) 28, 3
(2009), 87.
[Heath 2002] Michael T Heath. 2002. Scientific computing. McGraw-Hill New York.
[Jacobson et al. 2011] Alec Jacobson, Ilya Baran, Jovan Popović, and Olga Sorkine. 2011. Bounded
Biharmonic Weights for Real-time Deformation. ACM Trans. Graph. 30, 4, Article 78 (July 2011),
8 pages. https://doi.org/10.1145/2010324.1964973
[Jones et al. 2016] Ben Jones, Nils Thuerey, Tamar Shinar, and Adam W Bargteil. 2016. Example-
based plastic deformation of rigid bodies. ACM Transactions on Graphics (TOG) 35, 4 (2016),
34.
[Joshi et al. 2007] Pushkar Joshi, Mark Meyer, Tony DeRose, Brian Green, and Tom Sanocki. 2007.
Harmonic coordinates for character articulation. In ACM Transactions on Graphics (TOG), Vol. 26.
ACM, 71.
[Ju et al. 2005] Tao Ju, Scott Schaefer, and Joe Warren. 2005. Mean Value Coordinates for Closed
Triangular Meshes. ACM Trans. Graph. 24, 3 (July 2005), 561–566. https://doi.org/10.1145/
1073204.1073229
[Lacoursiere 2007] Claude Lacoursiere. 2007. Ghosts and machines: regularized variational meth-
ods for interactive simulations of multibodies with dry frictional contacts. Ph.D. Dissertation.
Datavetenskap.
[Lanczos 2012] Cornelius Lanczos. 2012. The variational principles of mechanics. Courier Corpora-
tion.
[Landau and Lifshitz 1959] LD Landau and EM Lifshitz. 1959. Course of theoretical physics. vol. 6:
Fluid mechanics. London.
[Lipman et al. 2008] Yaron Lipman, David Levin, and Daniel Cohen-Or. 2008. Green coordinates.
ACM Transactions on Graphics (TOG) 27, 3 (2008), 78.

56
An Introduction to Physics-based Animation A. Bargteil and T. Shinar.

[Marschner and Shirley 2015] Steve Marschner and Peter Shirley. 2015. Fundamentals of computer
graphics. CRC Press.
[Mirtich 1996] Brian Vincent Mirtich. 1996. Impulse-based dynamic simulation of rigid body systems.
Citeseer.
[Murray et al. 1986] R Murray, R Murray, and Spiegal. 1986. Theory and Problem of Theoretical
Mechanics. Shaum’s Outline Series.
[Museth 2013] Ken Museth. 2013. VDB: High-resolution Sparse Volumes with Dynamic Topology.
ACM Trans. Graph. 32, 3, Article 27 (July 2013), 22 pages. https://doi.org/10.1145/2487228.2487235
[Ruina and Pratap 2009] Andy L Ruina and Rudra Pratap. 2009. Introduction to statics and dynamics.
Pre-print for Oxford University Press. http://ruina.tam.cornell.edu/Book/RuinaPratap1-31-11.pdf
[Shen et al. 2005] Chen Shen, James F O’Brien, and Jonathan R Shewchuk. 2005. Interpolating and
approximating implicit surfaces from polygon soup. In ACM Siggraph 2005 Courses. ACM, 204.
[Shinar et al. 2008] Tamar Shinar, Craig Schroeder, and Ronald Fedkiw. 2008. Two-way coupling of
rigid and deformable bodies. In Proceedings of the 2008 ACM SIGGRAPH/Eurographics Symposium
on Computer Animation. Eurographics Association, 95–103.
[Sifakis et al. 2007] Eftychios Sifakis, Tamar Shinar, Geoffrey Irving, and Ronald Fedkiw. 2007.
Hybrid simulation of deformable solids. In Proceedings of the 2007 ACM SIGGRAPH/Eurographics
symposium on Computer animation. Eurographics Association, 81–90.
[Sims 1990] Karl Sims. 1990. Particle Animation and Rendering Using Data Parallel Computation.
SIGGRAPH Comput. Graph. 24, 4 (Sept. 1990), 405–413. https://doi.org/10.1145/97880.97923
[Smith et al. 2005] Russell Smith et al. 2005. Open dynamics engine. (2005).
[Tang et al. 2012] Min Tang, Dinesh Manocha, Miguel A Otaduy, and Ruofeng Tong. 2012. Contin-
uous penalty forces. ACM Trans. Graph. 31, 4 (2012), 107–1.
[Tournier et al. 2015] Maxime Tournier, Matthieu Nesme, Benjamin Gilles, and François Faure. 2015.
Stable constrained dynamics. ACM Transactions on Graphics (TOG) 34, 4 (2015), 132.
[Weinstein et al. 2006] Rachel Weinstein, Joseph Teran, and Ronald Fedkiw. 2006. Dynamic
simulation of articulated rigid bodies with contact and collision. IEEE Transactions on Visualization
and Computer Graphics 12, 3 (2006), 365–374.
[Witkin 2001] Andrew Witkin. 2001. Physically Based Modeling–Constraint Dynamics. ACM
SIGGRAPH 2001 Course Notes (2001).
[Xu et al. 2014] Hongyi Xu, Yili Zhao, and Jernej Barbic. 2014. Implicit multibody penalty-
baseddistributed contact. IEEE Transactions on Visualization & Computer Graphics 9 (2014),
1266–1279.

57

You might also like