0% found this document useful (0 votes)
85 views172 pages

SIGGRAPH22 Friction Contact Notes

Uploaded by

liuxijun599
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)
85 views172 pages

SIGGRAPH22 Friction Contact Notes

Uploaded by

liuxijun599
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/ 172

.

Contact and Friction Simulation for Computer


Graphics
SHELDON ANDREWS, École de technologie supérieure, Canada
KENNY ERLEBEN, University of Copenhagen, Denmark
ZACHARY FERGUSON, New York University, USA

Efficient simulation of contact is of interest for numerous physics-based animation applications. For
instance, virtual reality training, video games, rapid digital prototyping, and robotics simulation are all
examples of applications that involve contact modeling and simulation. However, despite its extensive
use in modern computer graphics, contact simulation remains one of the most challenging problems in
physics-based animation.
This course covers fundamental topics on the nature of contact modeling and simulation for computer
graphics. Specifically, we provide mathematical details about formulating contact as a complementarity
problem in rigid body and soft body animations. We briefly cover several approaches for contact
generation using discrete collision detection. Then, we present a range of numerical techniques for
solving the associated LCPs and NCPs. The advantages and disadvantages of each technique are
further discussed in a practical manner, and best practices for implementation are discussed. Finally, we
conclude the course with several advanced topics such as methods for soft body contact problems, barrier
functions, and anisotropic friction modeling. Programming examples are provided in our appendix as
well as on the course website to accompany the course notes.

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 ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada
© 2022 Copyright held by the owner/author(s).
ACM ISBN 978-1-4503-9362-1/22/08.
https://doi.org/10.1145/3532720.3535640

1
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

CCS Concepts: • Computing methodologies → Simulation by animation; Physical simulation;


Real-time simulation; • Applied computing → Physics.
Additional Key Words and Phrases: contact, friction, complementarity problems, Newton methods,
iterative methods, pivoting methods, splitting methods, physics-based animation
ACM Reference Format:
Sheldon Andrews, Kenny Erleben, and Zachary Ferguson. 2022. Contact and Friction Simulation
for Computer Graphics. In Special Interest Group on Computer Graphics and Interactive Techniques
Conference Courses (SIGGRAPH ’22 Courses), August 07-11, 2022. ACM, New York, NY, USA, 172 pages.
https://doi.org/10.1145/3532720.3535640

Contents
Abstract 1
Contents 2
Preface 6
Syllabus 8
1 Introduction to Contact Simulation 9
1.1 The Equations of Motion 10
1.2 Time Integration 10
1.3 Constraints 12
1.4 Non-interpenetration Contact Constraint 14
1.4.1 Non-interpenetration Jacobian 16
1.4.2 Non-interpenetration Constraint for Soft Bodies 17
1.5 The Coulomb Friction Law 18
1.5.1 Theory of Friction 20
1.6 The Linear Complementarity Problem Model 24
1.7 The Boxed Linear Complementarity Problem Model 29
1.8 The Cone Complementarity Problem Model 30
1.9 Constraint Stabilization 33
1.10 Soft vs. Rigid Body 35
1.10.1 Assembling the Matrices for a Rigid Body System 35
1.10.2 Assembling the Matrices for a Soft Body System 38
2 Contact Generation 41
2.1 Analytic Shapes 42
2.1.1 Sphere-Sphere Intersection 43
2.1.2 Sphere-OBB Intersection 43
2.1.3 OBB-OBB Intersection 45
2.2 Mesh-based Representations 48
2.2.1 Continuous Collision Detection of Mesh Features 49
2.2.2 Continuous Collision Detection of Face-Vertex Pair 51

2
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

2.2.3 Continuous Collision Detection of Edge-Edge Pair 52


2.2.4 Multivariate Style of Continuous Collision Detection 53
2.2.5 Tight-Inclusion 53
2.2.6 Implementation Notes 55
2.3 Signed Distance Fields 55
2.3.1 SDF-Point Intersection 56
2.3.2 SDF-Mesh Intersection 57
2.3.3 Implementation Notes 59
3 Numerical Methods 60
3.1 Pivoting Methods 60
3.1.1 Incremental Pivoting 63
3.1.2 Principal Pivoting Methods 65
3.1.3 Block Principal Pivoting 65
3.1.4 Implementation Notes 67
3.2 Fixed-point methods 68
3.2.1 Splitting Methods 68
3.2.2 Extending to the BLCP 75
3.2.3 Ordering of Variables 76
3.2.4 The Blocked Gauss-Seidel Method 76
3.2.5 Staggering 79
3.2.6 The Projected Gauss-Seidel Subspace Minimization Method 81
3.2.7 The Non-Smooth Nonlinear Conjugate Gradient Method 82
3.3 Non-Smooth Newton Methods 85
3.3.1 Minimum-Map Formulation 87
3.3.2 Fischer-Burmeister Formulation 88
3.3.3 Friction 89
3.3.4 Newton’s Method 89
3.3.5 Preconditioning 90
3.4 Proximal Operators 91
3.4.1 The Proximal Operator Model 92
3.4.2 Iterative Methods for the Fixed-Point Scheme 99
3.4.3 Closest Point on Ellipsoid 101
3.4.4 The 𝑟 -Factor Strategies 103
3.4.5 Time-Stepping Methods 107
3.4.6 Constraint Stabilization by Post-step Projection 107
4 Soft Body Contact Approaches 110
4.1 Equations of Motion for a Collection of Soft Bodies 110
4.2 Approaches to Time Discretization 112
4.2.1 Root-finding Approach 113
4.2.2 Position-level Minimization Approach 117
3
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

4.2.3 Velocity-level Minimization Approach 119


4.3 A Taxonomy of Preconditioners for Dual Form Approaches 119
4.3.1 Quality of a Preconditioners 121
4.3.2 Explicit Time-Discretization and Mass Lumping 121
4.3.3 Implicit Euler 123
4.3.4 Parallel Assembly using the Cholesky Factorization 124
4.3.5 Partial Evaluation using Choleskey Factorization 126
4.3.6 Splitting Method 128
5 Penalty and Barrier Methods 131
5.1 Overview of Classical Penalty Methods 131
5.1.1 Rigid Bodies 131
5.1.2 Soft Bodies 133
5.1.3 Implementation Notes 134
5.1.4 Penalty Based Friction 134
5.1.5 Other Penalty Methods 135
5.2 Barrier Methods 137
5.2.1 Asynchronous Contact Mechanics 138
5.3 Incremental Potential Contact 138
5.3.1 Consistent Distance Functions 140
5.3.2 Optimization-based Time Integration 141
5.3.3 CCD-Aware Filtered Line-Search 143
5.3.4 Variational Friction Model 143
5.3.5 Further Topics 145
6 Anisotropic Friction Modeling 146
6.1 The Matchstick Model 146
6.1.1 Friction Cone Modeling 146
6.1.2 The Matchstick Model 147
6.1.3 Fixed-point Solvers 149
6.1.4 LCP-based Solvers 150
6.1.5 NCP-based Solvers 150
6.1.6 Implementation Notes 152
6.2 Friction Tensors 153
6.3 Texture Friction 155
6.3.1 The Plowing Model 156
6.3.2 Texture Friction for Surface Patches 157
6.4 Other Anisotropic Approaches 158
A Tutorial: Programming a Rigid Body Simulator with Frictional Contact 160

4
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

References 166

5
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

PREFACE
Why a SIGGRAPH course on contact and friction simulation? The answer, quite simply, is that
it is an important topic. As a classic problem in physics-based animation, contact simulation
has been the focus on many scientific works over the past several decades in computer graphics.
Furthermore, there is a demand for friendly teaching material about the topic since it is difficult
to approach for non-specialists.
Contact and friction simulation in computer graphics field has evolved a lot since the
1980s. During this time, a lot of effort has gone into uncovering fast and robust methods,
and leveraging hardware such as GPUs. The performance and robustness of these methods
now enables techniques developed in computer graphics to be deployed into other fields. For
instance, robotics and medical simulation are two fields where computer graphics simulations
are now pushing the limits of the state-of-the-art. Digital prototyping, learning and training
are other important application contexts, and there is still a need for advances here. Currently,
differentiable physics, rich friction models, machine learning-based physics, soft-rigid and
soft-soft body contact are open topics that the research community is pursuing. We hope these
notes will give the next generation of researchers the necessary foundation to begin solving
these challenges.
These course notes have been assembled over a period of several years. Topics have been
introduced and pulled out continuously in this process, and we will likely continue to do so
in future versions of these course notes. A few topics kept coming back to us as being more
fundamental, in that they form the foundation for understanding a lot of recent work in the
field. Hence, this material makes up the core of the course notes, and they are mainly about
understanding the physical models and numerical methods. By that we mean the mathematical
equations we write up when we describe the models, along with the methods we apply to
compute solutions for our models. Ideally, we try to keep models and methods separate, as
they should be. Historically, a huge part of the field has been devoted to fast and robust
numerical methods, and in particular constraint-based approaches, such as the ones based
on complementarity problem formulations, make up a big part of the picture. Therefore, we
devote a lot of effort to give a firm understanding of this popular approach.
New additions in this version of the course include coverage of multivariate continuous
collision detection, an extended treatment of penalty-based methods to include barrier methods,
and a new chapter on implicit time integration schemes and methods for solving soft body
contact problems has been added. Additionally, we now include a more in-depth coverage of
anisotropic friction simulation, as well as a tutorial that guides the reader through the steps of
creating a rigid body simulator with frictional contact.
It is impossible to cover all topics related to contact and friction simulation in a three-hour
SIGGRAPH course, and we had to cut out many topics in order to remain relatively concise. For
instance, in this version of the course we ignore impulse-based methods that use collision laws
and event propagation. The coverage of collision detection is also limited to just the principled

6
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

ideas of how to generate contact points for common shape representations. However, we do
introduce the cone-complementarity problem formulation for modeling contact and friction,
as these are a recent very interesting addition to the field, yet only brief details about the
numerical methods related to this type of model are covered. Lastly, we do not cover position-
based and projective dynamics directly. However, solvers applied here bear a resemblance
to the proximal operators and iterative solvers, which we do cover in full details. There is a
bundle of more work that deserves mentioning here, and we apologize for not having the time
and space to give the wonderful work on those topics the attention they deserve.
We would like to acknowledge that a lot of people have been involved in the creation of
these course notes. A community of peers has helped us to generate ideas and discussion how
to best present and explain topics, given feedback, proofread the content at various stages of
development, pointed us to relevant work in the field, and much more. The list is long, but in
particular we would like to acknowledge the support and help from Miles Macklin, Paul Kry,
Mihai Francu, Eric Paquette and many others. We also thank Greg Klár, Löic Nassif, and Bin
Wang for sending us corrections to the first version of these course notes.
Finally, we hope that you will enjoy this course, and that you find contact and friction
simulation a fun topic to learn about! Please visit the course website siggraphcontact.github.io,
where you will find links to programming examples and other supplementary material related
to these notes.

Sheldon, Kenny, and Zach

7
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

SYLLABUS
Introduction to Contact Simulation. We introduce the idea of time stepping a simulation
and present the ordinary differential equations (ODE) that govern the Newton dynamics of a
simulation. Stepping in time an ODE is solved using an integrator and for this we introduce
the semi-implicit and implicit Euler methods. Kinematic and geometric constraints are added
using the method of Lagrange multipliers, and in this framework a unilateral constraint for
non-interpenetration is realized by defining a gap function between bodies. We explain how
the complementarity conditions generate constraint impulses that vanish when contact breaks.
The concept of maximal dissipation is also introduced and used to derive a model of friction.
Non-linear and linearized versions of Coulomb friction are presented. Finally, constraint
stabilization is presented as a remedy for constraint errors.
Contact Generation. This section focuses on the practicalities of generating contacts. The
primary focus is on guidelines for efficient and robust collision detection, and extracting the
contact information from various surface representations. Collision detection methods for
primitive geometric features and signed distance fields are presented. Finally, we cover both
univariate and multivariate formulations for continuous collision detection.
Numerical Methods. We focus on the underlying mathematical derivation and recast the
physical model into a problem that can be solved using various numerical techniques. First,
pivoting methods are presented for solving the contact linear complementarity problem by
estimating the index set of simulation variables. We then introduce the fixed-point methods
as a framework for solving general non-linear models, and proceed to derive the projected
Gauss Seidel, SOR, and Jacobi methods. Finally, we reformulate the problem of satisfying the
contact conditions and equations of motion as a root finding problem, providing the basis for
Newton-type methods, such as minimum-map and Fischer-Burmeister reformulations. The
importance of preconditioning and regularization are also emphasized as a way to achieve
performance and robustness.
Soft Body Contact Approaches. Various implicit time-integration schemes for soft body
contact are presented. First, root-finding approaches are covered, where both the primal and
dual forms are considered. Next, time-integration of soft bodies with contact is reformulated
as a constrained minimization problem, and velocity-level and position-level versions of the
problem formulation are given. The section concludes with an extensive treatment of methods
for computing the system matrix of the dual form, along with the implications of each approach.
Penalty and Barrier Methods. This section covers penalty and barrier methods. In particular,
the latter have demonstrated robust contact handling by applying barrier potentials within
an optimization-based implicit time integration framework. We demonstrate how projected
Newton methods can efficiently solve these optimization problems.
Anisotropic Friction. Several recent approaches for simulating anisotropic friction are
surveyed. Details about how numerical solvers may be extended to support anisotropic friction
cones are also provided.

8
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

1 INTRODUCTION TO CONTACT SIMULATION


Contact simulation is mainly concerned with computing the forces that exist at interfaces
between physical objects. Physical objects can range from rigid bodies, such as a billiard ball
or vehicle chassis, to soft bodies, such as cloth and hair. We simply refer to a collection of such
objects and the forces acting on them and between them as a physical system. The interface
forces are termed contact forces and they prevent objects from penetrating each other during
motion and deformation, and they additionally model the resistance due to objects against
each other. These course notes are primarily focused on how to model and compute contact
forces in an efficient and robust manner.
Historically, constraint based methods for computing contact forces have been used by the
graphics community for simulation of rigid bodies. Many earlier works focused on improving
performance by developing faster methods for rigid body simulations. Hence, a lot of the
notation we use in these notes are influenced by these early works. One might primarily
read these notes while thinking about contact between rigid bodies, and indeed many of the
examples demonstrate the rigid case as it is the easier case after all. Nevertheless, much of the
material we cover here applies to elastic models and soft bodies too, and we will address some
of these differences when they arise. Furthermore, a complicating factor in contact simulation
is the generation of contacts using collision detection, which is a topic that we cover briefly in
order to convey the principal ideas.
At a high-level, there are three main paradigms for contact simulation. First, contact may be
simulated by constraint based methods, and these course notes are rooted in this paradigm.
This paradigm bares a lot of resemblance to constrained optimization where constraints are
solved exactly. Another paradigm is penalty based approaches, and these tend to rely on force-
based modeling to resolve interpenetration at the interface. Often this paradigm is introduced
conceptually as small abstract springs working between objects to keep them from overlapping.
Hence, the springs "penalize" overlap which gives rise to the name for this class of methods.
There are similarities here to penalty methods in numerical optimization, in particular barrier
methods that have recently become popular for contact simulation. The last paradigm accounts
for impulse-based methods where the contact between objects is conceptualized as sequences
of micro-collisions. These notes take their outset in the constraint based approaches as these
have been dominating real-time interactive simulation for decades. Constraint-based methods
also have the nice property that they are able to guarantee solving for contact exactly, at least
in such a way that constraints are always fulfilled. However, we later explain formulations
based on penalty methods and explain best practices when using this class of approach for
modeling contact in simulation pipelines. 6
These course notes seek to not only give the reader intuition about the theoretical models
that are used as the basis for a wide variety of contact simulations, but also to highlight
some best practices for all stages of the simulation pipeline. Note that the “An Introduction
to Physics-Based Animation” SIGGRAPH course [Bargteil et al. 2020] is an excellent related

9
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

reference for an in-depth discussion of preliminaries, while this course on contact and friction
naturally picks up from where the other course wraps up.
We begin by introducing the equations of motion and numerical integration by time
stepping. Then, kinematic constraints are derived to resolve non-interpenetration and we
explain the importance of the complementarity condition. This leads into a presentation of
Coulomb friction and how it is included in the formulation of the contact problem. Finally,
the introduction ends with a discussion on how the formulation may be adapted to soft body
simulations.

1.1 The Equations of Motion


The Newton-Euler equations of motion [Goldstein et al. 2002] that govern the dynamics of a
physical system form a second-order ODE that can be written as
¤
M(𝑡) u(𝑡) = f (q(𝑡), u(𝑡), 𝑡) , (1)
where M(𝑡) are the masses, q(𝑡) are the generalized positions, u(𝑡) are the generalized velocities,
and f (𝑡, q(𝑡), u(𝑡)) are the generalized forces acting on the system, which depend on the
positions and velocities. Notice that we are agnostic about what we are simulating at this point,
and the equation can be seen as describing the motion of rigid bodies, thin shells, or elastic
solids. Also notice that all terms in Equation 1 depend on the time 𝑡. However, in computer
graphics, we are often only interested in determining the dynamical behavior at a particular
instant in time, and so the Newton-Euler equations may be written more succinctly as
M u¤ = f . (2)
The time instants for evaluating Equation 2 are determined by a numerical integrator, and
in the next section we briefly outline how to “step” the equations of motion using a popular
integration method in computer graphics.

1.2 Time Integration


Physical simulations for computer graphics are typically performed using a discrete numerical
integration with time step ℎ. There are two main types of numerical integrators: explicit and
implicit. The former evaluate the force at the beginning of the time step f (q−, u− ), while the
latter evaluate it at the end f (q+, u+ ). Note that the superscript □+ is used to indicate an implicit
quantity and □− an explicit quantity. We can denote the forces for now simply as f without
specifying whether they are implicit or explicit, and this particular choice will depend upon
the application context. However, we will drop the latter from here on since computer graphics
applications largely use implicit integration schemes due to their increased numerical stability.
A Taylor expansion of the implicit velocities gives the first-order approximation
u+ ≈ u + ℎ u¤ ,

10
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

where the change in velocities from the start of the time step to the end of the time step is
¤ Using this approximation to substitute for the accelerations
determined by the accelerations u.
in Equation 2, and by applying a simple Euler integration scheme, we can write the linear
relationship governing the motion of a system with 𝑛 degrees freedom at each time step as

Mu+ = M u + ℎ f (3)

with the mass matrix M ∈ R𝑛×𝑛 , the momentum term M u ∈ R𝑛 and applied forces f ∈ R𝑛 .
Here, the velocities u+ ∈ R𝑛 are determined at the end of the time step, and for simplicity we
will consider the mass matrix M to be constant over the time step. For a rigid body system,
the mass matrix will consist of small blocks containing the total mass of the rigid bodies and
their 3 × 3 inertia tensors, whereas for soft bodies the mass matrix can be given by a volume
integral of mass density over some elements or a diagonal matrix of nodal mass values, like in
a particle system. The specific form can vary depending on the chosen discretization method
(such as finite elements, finite volumes or mass-spring systems).
An interesting observation is that Equation 3 gives the velocity-level Newton-Euler equations
of motion, and by evaluating the dynamics over a time step ℎ this effectively transforms the
instantaneous forces into impulses. Impulses are instantaneous quantities that abruptly change
the value of the momentum due to the action of a force over a small period of time. But we
can also consider them as we do here as integrals over the period ℎ of the force f.
Solving the linear system in Equation 3 to determine the velocities is an important step in
the numerical integration of a physical system. The velocities may then be used to update the
positions in an implicit fashion by

q+ = q + ℎ H(u+ ),

where H defines a kinematic mapping between the generalized velocities u and positions
q. The kinematic mapping is needed when the generalized positions q require more than 𝑛
components. This is usually the case when using redundant parameters like quaternions or
orthogonal matrices for representing rotations.
In contact simulation, simple Euler schemes such as the one described in this section are
often considered sufficient. The reason for this is that contact models often assume a myopic
view point of a flat planar surface at the interface. This means motion with respect to these
models can be described in a linear fashion. For instance, the Coulomb model we introduce
later is for planar sliding motion only. As such, one will not get better performance or accuracy
from higher order integration schemes as they will be limited by the linear models of contact.
However, higher order integration schemes can be very efficient for simulating the free motion
of rigid bodies and elastic models without contact, and there is some work that considers
contact models for curved surfaces. In this case, higher order time integration may make sense.
Next, we consider how constraint equations may be used to couple the movement of the
degrees of freedom of a dynamical simulation.

11
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

1.3 Constraints
Kinematic constraints can be used to couple the movement of bodies in a simulation, and
indeed this is exactly the approach we will describe in this section for simulating contact. A
collection of 𝑚 constraint functions 𝜙 (q) ∈ R𝑚 implicitly define a manifold that is embedded
in the 𝑛-dimensional space of the simulation degrees of freedom, and movement of constrained
bodies is restricted to these manifolds. Observe that a constraint defines a relationship based
on the degrees of freedom of the system, q.
There are two types of constraint equations commonly found in dynamics simulation:
bilateral and unilateral. Bilateral constraint functions have the form 𝜙 (q) = 0. For instance,
hinges, ball-and-socket, and prismatic joints are modeled using bilateral constraint functions.
Whereas functions of the form 𝜙 (q) ≥ 0 are called unilateral constraints.
By assuming that constraints are initially satisfied, and that the constraint equations will
not be violated if there is no movement that leads to violation (i.e., movement is limited to
the constraint manifold), we can instead formulate the constraint equations in terms of the
𝜕𝜙 (q)
velocities by computing the gradient of 𝜙 (q) with respect to q, such that J = 𝜕q ∈ R𝑚×𝑛
contains the constraint gradients of the 𝑚 constraint equations. In rigid body systems, there
is often a dimensionality mismatch when changing from positions to velocities due to the
orientation. For instance, if quaternions are used to store body rotations, a kinematic map is
𝜕𝜙 (q)
needed. Hence, we have J = 𝜕q H ∈ R𝑚×7 𝑁 for 𝑁 bodies. We describe the kinematic mapping
in detail in Section 1.10.1. For soft bodies, typically no such mapping is required. The velocity
level constraint equations can then be written as
Ju = 0 (4)
for bilateral constraints, and
Ju ≥ 0 (5)
for unilateral constraints. The constraints can be imposed through the inclusion of constraint
forces in the dynamical equations. These are forces that act in the direction of the constraint
gradient J, which encodes the directions in which bodies may be “pushed” or “pulled” without
doing any real work on the system, but that will force bodies to remain on the constraint
manifold. Thus, the constraint forces of a system are computed as
f𝑐 = J𝑇 λ , (6)
where λ are Lagrange multipliers. These multipliers can be interpreted as the magnitudes of
the constraint forces if the constraint directions (i.e., gradients) are normalized.
In order to enforce the position constraints 𝜙 (q) = 0 or 𝜙 (q) ≥ 0, we need to integrate the
constraint forces in Equation 6 by applying the impulse ℎf𝑐 . Therefore, the notation 𝝀 ≡ ℎ λ
is used to denote constraint impulse magnitudes. Notice that lambda changes font when we
include the time step to make it an impulse magnitude. It may feel a bit confusing with two
different notations for these lambdas, but it helps underlining when we talk about a force-based

12
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

or impulse-based quantity, i.e. whether time integration has been done to get to a velocity level
form of our models. In computer graphics, the velocity-based form is dominant, and hence we
hope the reader will focus more on the mathematical and algebraic forms used for describing
the different kind of constraints.
Revising the equations of motion in Equation 3, we include the constraint impulse magnitudes
as an implicit term, such that
M u+ − J𝑇 𝝀 + = M u + ℎf, (7)

where 𝝀 + ∈ R𝑚 is a vector of constraint impulse magnitudes. Note that we have not specified
when J is evaluated, and in this course we will consider it to be explicit and constant throughout
the time step. And so, while the constraint forces are integrated explicitly, it is only in terms
of direction, as the Lagrange multipliers enforce the constraint at the end of the time step,
i.e., Ju+ . However, there are cases when J it is treated implicitly, and thus requires evaluating
the gradient of 𝜙 (q + ℎΔu+ ) and resolving for the constraint forces in an iterative fashion.
This may mean performing additional collision detection tests, which can negatively impact
performance.
For a moment, let us consider just the bilateral constraints in the simulation. The linear
system combining the equations of motion and the velocity constraint equations can be written
as
M −J𝑇 u+
    
Mu +ℎf
= . (8)
J 0 𝝀+ 0

We use the first row to solve for u+ and substitute our result into the second row to obtain a
reduced system that we can use to solve for 𝝀 + . This technique is called forming the Schur
complement of the upper left block in Equation 8 and it results in the reduced linear system
 −1 𝑇  +
J M J 𝝀 + J M−1 (Mu + ℎf) = 0 , (9)
| {z } | {z }
A b

which is a commonly used form to solve for the constraint impulses. Once 𝝀 + are known, the
motion of the degrees of freedom can be recovered using Equation 7. Note that for rigid bodies
and particle systems using lumped masses, the block diagonal form of M makes it trivial to
invert, and the resulting matrix A will also be positive semi-definite. Whereas, for implicitly
integrated elastic systems, they will have sparse damping and stiffness matrix contributions
added to the mass, leading us to choose solvers for Equation 9 that do not involve inversion of
the upper left block of Equation 8.
In the next section, we consider that contact can be modeled as a unilateral constraint with
some special complementarity conditions on the constraint impulses and the relative velocities
of bodies.

13
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝜙 0 𝜙 0 𝜙 0

𝐱
𝐱
𝐱
𝐱 𝐱 𝐱

resting separation penetration

Fig. 1. Illustration of the three contact states determined by the value of the gap function. Observe
that a single function value allows us to classify the state.

1.4 Non-interpenetration Contact Constraint


Unlike bilateral constraints, contact constraints are only active when a collision exists between
two bodies in the simulation. The state of this relationship between bodies is represented
using a gap function, 𝜙, which also happens to be the constraint function. The gap function,
measures the distance between two bodies, and a positive value 𝜙 > 0 indicates a separation
between the bodies (see Figure 1).
At locations where the gap is zero or negative, 𝜙 ≤ 0, there is a contact between the bodies.
For smooth objects, their unit surface normals will face in opposite directions at the point
of contact. This defines a contact plane containing the point of contact and having a normal
vector that is parallel to one of the surface unit normals. Both the contact point and normal
direction are determined during the collision detection phase. For discretized geometries, such
as triangle meshes, it is more tricky to define the contact plane and we discuss this later in
Section 2. For now we can continue using our idealized smooth concept of a contact plane.
An impulse with magnitude 𝜆𝑛ˆ is applied at the contact location in order to keep the bodies
from interpenetrating. The non-interpenetration impulse is applied in a direction that is
perpendicular to the contact plane. That is, in the normal direction of the surfaces. This leads
to two considerations when applying contact forces. Either the bodies are not in contact and
there is no contact force, in which case
𝜙 > 0, 𝜆𝑛ˆ = 0 ,
or the bodies are touching (for instance, there is resting contact) and a non-zero contact force
is applied at the contact location, in which case
𝜙 = 0, 𝜆𝑛ˆ > 0 .
These two cases are exclusive, and often they are succinctly written as the complementarity
conditions of contact as
0≤𝜙 ⊥ 𝜆𝑛ˆ ≥ 0 . (10)

14
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

𝐉 𝜆

contact
𝐉 𝜆 𝐱
𝐱
𝜙 0 𝜙 0
𝐱
𝐱

Fig. 2. Left: Two bodies 𝑖 and 𝑗 not in contact have a positive gap function 𝜙 > 0. Right: A non-
interpenetration constraint is created between two colliding bodies. The gap function is zero, and the
constraint is enforced by an impulse
 with
 magnitude 𝜆𝑛ˆ and the direction of the impulse is determined
by the constraint Jacobian J = J𝑖 J 𝑗 .

Notice that we have used the complementarity operator “⊥”. If 𝑎 and 𝑏 are two scalars, then
0 ≤ 𝑎 ⊥ 𝑏 ≥ 0 is defined to mean that 𝑎 ≥ 0, 𝑏 ≥ 0, and 𝑎 𝑏 = 0. The ⊥ notation is a short
hand version that means the same thing.
The Equation 10 is termed the position level non-penetration complementarity condition.
Observe that this type of condition says nothing about the tangential motion. Hence, objects
can be in sustained touching contact while sliding relative to each other. Non-sliding sustained
contact state is often referred to as a resting contact.
Figure 2 illustrates the gap function before and after collision, which is positive and zero,
respectively. Usually, when the bodies are sufficiently close to touch, a non-interpenetration
constraint is created between the two bodies in order to keep them from overlapping. The
direction of the non-interpenetration impulse is determined by the contact plane, and the
impulse J𝑇 𝜆 + is applied to both bodies involved in the collision.
Although the positions are used by collision detection to determine if two bodies are in
contact, the constraints in Equation 8 are formulated at the velocity-level . Recognizing that
contact constraints are generated only when 𝜙 = 0, we can reason about conditions on the
velocities of bodies during contact.
Recall that with semi-implicit and implicit integration techniques, the velocities at the end
of a time step are used to advance the simulation. Therefore, if two bodies are touching in the
current time step, they will not be touching in the subsequent time step if 𝜙¤ > 0. This is because
the two bodies will separate due to a positive relative velocity at the contact location. In this
case, there is no need to apply a contact force, and 𝜆𝑛ˆ = 0. However, if the relative velocity
is zero, 𝜙¤ = 0, then a force is needed to prevent the bodies from further interpenetrating,
i.e., 𝜆𝑛ˆ > 0. Therefore, the velocity level non-penetration complementarity condition may be
formally stated as
0 ≤ 𝜙¤ ⊥ 𝜆𝑛ˆ ≥ 0. (11)

15
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Here, we note that 𝜙¤ is the normal component of the relative velocity between the bodies at a
specific contact point. Hence, we use the notation 𝜙¤ = 𝑣𝑛ˆ for the constraint velocities in the
remainder of the notes. This means that if there is a separation velocity 𝑣𝑛ˆ > 0 in the normal
direction, then there can be no normal contact impulse. On the other hand, if there is a normal
contact impulse such that 𝜆𝑛ˆ > 0, then there is a resting contact and therefore 𝑣𝑛ˆ = 0.
Observe that Equation 11 is the result of approximating Equation 10 by substituting the first
order Taylor expansion for the gap function, 𝜙 + ≈ 𝜙 +ℎ 𝑣𝑛ˆ , and applying the knowledge that 𝜙 =
0. Changing the expansion point leads to different schemes and can be used to foresee contact
as well as correcting drifting error that arise during simulation from computing approximate
solutions or numerical precision. Detecting and adding constraints prior to touching contact
would result in the scheme using the non-penetration complementary condition
0 ≤ (𝜙 + ℎ𝑣𝑛ˆ ) ⊥ 𝜆𝑛ˆ ≥ 0 , (12)
where 𝜙 > 0 since contact has not yet happened. This is essentially an explicit first order
approximation of the gap function. This form is popular to avoid tunneling artifacts of objects
as it anticipates future contact points, and this idea is further discussed in Section 2 of these
notes.
1.4.1 Non-interpenetration Jacobian. Next, let us consider how to compute 𝑣𝑛ˆ . We will first
present the ideas for the case of rigid bodies and following this we will demonstrate how
¤ and by
to work with soft bodies. Noting that 𝑣𝑛ˆ is the rate of change of the gap function, 𝜙,
applying some straightforward calculus, we get
𝜕𝜙 𝜕𝜙 𝜕q 𝜕𝜙
𝑣𝑛ˆ = 𝜙¤ ≡ = = H u = Ju. (13)
𝜕𝑡 𝜕q 𝜕𝑡 𝜕q
|{z}
J
In the last step, we have used the kinematic relationship for rigid bodies q¤ = H u from
Equation 1.2. This gives us a mathematical understanding of J. Looking more closely we notice
that the role of the Jacobian matrix is to map body-space velocities into a velocity for the gap
function. That is, we map from body-space to measure how fast the gap function is changing.
Using this insight, J for the non-penetration constraints may be constructed more precisely.
Consider two rigid bodies, 𝐴 and 𝐵, with centre of mass positions x𝐴 and x𝐵 that are colliding
at contact point p with unit contact normal 𝑛ˆ pointing from 𝐴 towards 𝐵. The relative velocity
in the normal direction 𝑣𝑛ˆ is then given by
𝑣𝑛ˆ = 𝑛ˆ · Δv , (14)
where Δv is the relative contact point velocity given by
Δv = (v𝐵 + 𝜔 𝐵 × (p − x𝐵 )) − (v𝐴 + 𝜔𝐴 × (p − x𝐴 )) . (15)
Here, v𝐴 and v𝐵 are the linear velocities of center of masses and 𝜔𝐴 and 𝜔 𝐵 are the angular
velocities. This notation is illustrated in left side of Figure 3.

16
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

rigid bodies soft bodies


𝜔
𝑛
𝐯
𝐵
𝐩 𝐫 𝑖
𝜔 𝐵
𝐫 𝐱 𝐴 𝑙 𝐩
𝐯 𝑘 𝑚
𝐱 𝑗
𝐴 𝑛

Fig. 3. Left: the notation involved in computing the relative contact point velocity of two rigid bodies
are depicted. Right: The normal and vector arms and barycentric coordinates are the information
needed to evaluate the contact Jacobian for two soft bodies modeled by tetrahedral elements.

Using the shorthand r𝐴 = (p − x𝐴 ) and r𝐵 = (p − x𝐵 ), the definition of the skew-symmetric


 𝑇
cross product matrix of a vector r = 𝑥 𝑦 𝑧 is
 0 −𝑧 𝑦 
×

r ≡  𝑧 0 −𝑥  . (16)
−𝑦 𝑥 0 
 
The relative velocity in the normal direction can then be written as the matrix-vector product
 v𝐴 
 
 𝜔𝐴 
𝑣𝑛ˆ = −𝑛ˆ𝑇 𝑛ˆ𝑇 r𝐴× 𝑛ˆ𝑇 ×

−𝑛ˆ r𝐵   .
𝑇
(17)
| {z }  v𝐵 
J
𝜔 𝐵 
 
|{z}
u
This two-body system may be extended to include more body velocities in the system general-
ized velocity vector u and by adding corresponding zero-blocks to J. Extending to multiple
contact points means we get multiple rows in the Jacobian. Each one will have a structure
similar to Equation 17, but with kinematics that are specific to each contact.
1.4.2 Non-interpenetration Constraint for Soft Bodies. The case of a soft body can be derived
similar to the rigid body case. Often, a computational mesh is used to model the surface or
volume of a soft body (e.g., a linear tetrahedral mesh). We will use this as our working example
without loss of generality. Imagine a node of soft body 𝐴 touches a face of a tetrahedron from
soft body 𝐵. Let the position and velocity of the node from body 𝐴 be given by x𝑙,𝐴 and v𝑙,𝐴
where 𝑙 is the node index from body 𝐴. Let the four nodes defining the tetrahedron from body
𝐵 be given by x𝑖,𝐵 , v𝑖,𝐵 , x 𝑗,𝐵 , v 𝑗,𝐵 , x𝑘,𝐵 , v𝑘,𝐵 , x𝑚,𝐵 , and v𝑚,𝐵 where 𝑖, 𝑗, 𝑘, and 𝑚 are the node

17
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

indices in body 𝐵. At the point of contact p we have


p = x𝑙,𝐴 = 𝑤𝑖 x𝑖,𝐵 + 𝑤 𝑗 x 𝑗,𝐵 + 𝑤𝑘 x𝑘,𝐵 + 𝑤𝑚 x𝑚,𝐵 , (18)
where 𝑤𝑖 , 𝑤 𝑗 , 𝑤𝑘 , and 𝑤𝑚 are the barycentric coordinates of p with respect to the tetrahedron.
See the right side of Figure 3 for an illustration of the concepts. The relative contact point
velocity in the contact normal direction is then given by

𝑣𝑛ˆ = 𝑛ˆ · 𝑤𝑖 v𝑖,𝐵 + 𝑤 𝑗 v 𝑗,𝐵 + 𝑤𝑘 v𝑘,𝐵 + 𝑤𝑚 v𝑚,𝐵 − v𝑙,𝐴 , (19)
and this can again be rewritten as a matrix-vector product, such that
 v𝑙,𝐴 
 
 v𝑖,𝐵 
   
𝑣𝑛ˆ = −𝑛ˆ𝑇 𝑤𝑖 𝑛ˆ𝑇 𝑤 𝑗 𝑛ˆ𝑇 𝑤𝑘 𝑛ˆ𝑇 𝑤𝑚𝑛ˆ𝑇  v 𝑗,𝐵  . (20)
| {z }  v𝑘,𝐵 
J
 
v𝑚,𝐵 
 
| {z }
u
Here, only the nodes involved in the contact are include in the Jacobian matrix J and the
vector of node velocities u. However, soft bodies usually contain many more nodes that need
to be included into the system velocity vector u, and thus corresponding zero blocks should
be added to the Jacobian. As with the rigid body case, adding more contact points results in
adding more rows of similar pattern to the system Jacobian. One may derive other specific
formulas for the Jacobian in cases of contact between two nodes only, or two tetrahedra, or
one node from soft body and one rigid body, and so on.

1.5 The Coulomb Friction Law


Friction is an important phenomena we must simulate in graphics applications. This introduces
additional constraints on the movement of bodies in the simulations and the forces generated
within the plane of contact.
In order to describe friction we will define a local contact frame for a single point of contact.
This is called the contact frame and it consist of two orthogonal unit vectors that span the
contact plane, let us call them 𝑡ˆ and 𝑏,ˆ the contact plane can be viewed as the shared tangent
plane between two smooth surfaces at a point of contact, p. Orthogonal to the contact plane we
have the contact normal direction. One can think of this as the direction where one at myopic
scale must prevent motion to avoid penetration, we denote this direction by 𝑛. ˆ There are two
choices for which the direction of the normal could point in. If the two surfaces in contact are
labelled 𝐴 and 𝐵 then we adopt the convection that the normal points from 𝐴 towards 𝐵, and
that 𝑡ˆ, 𝑏ˆ and 𝑛ˆ forms a right handed coordinate system. This local coordinate system is used to
describe the contact physics in. The contact frame is illustrated in Figure 4. Sometimes the
frame is referred to as the contact basis, contact coordinate system or contact space. Observe

18
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

𝐵
𝑛

𝐩
𝑏
𝑡̂
𝐴 contact plane

Fig. 4. The contact frame defines a right-handed coordinate system and is defined by the two tangent
plane vectors 𝑡ˆ and 𝑏ˆ and the plane normal vector 𝑛.
ˆ

that the normal can be defined from the spatial derivative of the gap function we introduced
in Section 1.4. There exist infinite many choices for generating the tangent vectors 𝑡ˆ and 𝑏. ˆ
When working with isotropic friction model it is from the model viewpoint not important how
these vectors are generated but for anisotropic friction their choice is critical in aligning the
friction cone properly between the two surfaces. We treat this in more detail in Section 3.4.
When describing friction forces in the contact space then we need to know the relative
velocity of the surfaces in our contact frame. Let Δv be the relative velocity of the surfaces in
world space. Then, the contact space version is:
v = 𝑛ˆ 𝑡ˆ 𝑏ˆ Δv
 𝑇
(21)
| {z }
C𝑇
Notice that we picked the normal as the first basis vector in this transformation. This is just a
convenient convention when we would like to have the normal part of the contact problem
solved before the tangential components.
Realizing that the relative contact point velocity in world space between two rigid bodies is
given by Equation 15, we can now write the contact space velocity as
 v𝐴 
 
𝑇
 × ×
 𝜔𝐴 
v = C −I3×3 r𝐴 I3×3 −r𝐵   , (22)
| {z }  v𝐵 
J
𝜔 𝐵 
 
|{z}
u
where I3×3 is the 3-by-3 identity matrix. We see here that J has simply been extended with
the tangent vectors compared to our previous non-frictional case. The J is called the contact
Jacobian and from above equation we observe that is role is simply to map body-velocities
from world-space into the contact space velocity. We have now explained how the Jacobian

19
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

from Equation 17 can be extended to include tangential velocities and the same extension can
trivially be done for the soft body Jacobian in Equation 20. In the following we let 𝑣𝑛ˆ denote
the normal component of the contact space velocity and v𝑡ˆ the tangential component spanned
ˆ similar notation is used for the contact impulse, where 𝜆𝑛ˆ ∈ R is the normal impulse
by 𝑡ˆ and 𝑏,
and 𝝀𝑡ˆ ∈ R2 is the tangential impulse (i.e., friction force between two surfaces). In this section
we present a physical law that describes this force.
1.5.1 Theory of Friction. Coulomb friction couples the normal impulse 𝜆𝑛ˆ and tangential
impulses. The exact isotropic planar Coulomb friction cone constraint, for tangential friction
force 𝝀𝑡ˆ applied to colliding bodies, can be written as
∥𝝀𝑡ˆ ∥ 2 ≤ 𝜇𝜆𝑛ˆ . (23)
The non-linear inequality in Equation 23 defines a quadratic cone. The coefficient 𝜇 is called
the coefficient of friction and is a unit-less non-negative value that relates friction force to the
normal force. The coefficient of friction is specific in regards to the two types of materials that
are in contact. When setting up simulations one often have to specify its value which can be
bound measured data. We added a small table below with common values. The 𝜇-coefficient is
from a practical viewpoint considered to be a material-parameter only. We list some typical
values for the coefficient of friction in Table 1
Table 1. Coefficients of friction for various pairs of materials from “The Engineering Toolbox” (https:
//www.engineeringtoolbox.com/). Observe that the coefficient of friction depends on environmental
changes.

Materials and Material Surface Conditions Frictional Coefficient


Combinations
Static Kinetic (sliding)
Aluminum - Aluminum Clean and Dry 1.05 - 1.35 1.4
Aluminum - Aluminum Lubricated and Greasy 0.3
Cast Iron - Cast Iron Clean and Dry 1.1 0.15
Car tire - Asphalt Clean and Dry 0.72
Car tire - Grass Clean and Dry 0.35
Ice - Wood Clean and Dry 0.05
Leather - Oak Parallel to grain 0.61 0.52
Rubber - Dry Asphalt Clean and Dry 0.9 0.5 - 0.8
Steel - Steel Clean and Dry 0.5 - 0.8 0.42
Steel - Steel Lubricated and Greasy 0.16
Steel - Steel Castor oil 0.15 0.081

The Coulomb model is an empirical model, meaing that it has been derived from observations
from measurements. The field of tribology is, among other things, concerned with explaining

20
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

the physical cause to the friction force. It turns out that friction is a quite complicated matter
and many factors influence its behavior, and friction is essentially a system response. The
causes of friction are explained from theory of asperities. At micro-scale level the asperities are
sticking out of the material surfaces and when objects come into contact the asperities deform,
break and plow through the surfaces thereby causing "resistance" to motion. It is this resistance
that we humans perceive as the friction force. Besides the micro-scale geometry many other
factors influence the behavior such as lubrication, electrostatic effects, third-party obstacles
like small grains or dust, humidity and temperature, elastic and plastic micro-deformations of
the surfaces, tear and wear and many more effects. The coefficient of friction can be understood
as boiling all that complexity down to a single number. This is convenient from a modeling
viewpoint as it makes it feasible for us to simulate many objects with complex shapes subject to
frictional contact interaction. The Coulomb model is not perceived as being very accurate, but
its simplicity makes it very appealing and thus is has wide-scale adoption for contact simulation.
It is generally accepted that the coefficient of friction changes value when a transition from
static friction (sticking) to dynamic friction (sliding) happens. It may be explained from bonding
of asperities breaking when sliding happens and the dynamic coefficient of friction is therefore
lower than that static one. The actual transition from sticking to sliding is called the onset of
friction.
Let us return to setting up our model of friction that we use in multibody simulations for
rigid and soft bodies in the field of computer graphics. The isotropic Coulomb friction law is
in fact a two-part law:
• Slip: If the bodies are sliding relative to each other, then the direction of the friction force
is opposed to the tangential relative velocity and its magnitude is 𝜇𝜆𝑛ˆ .
• Stick: If the objects are not moving relative to each other, then the friction force can have
any direction as long as the inequality in Equation 23 holds.
We can express both cases mathematically as follows
√︁
𝜇 · 𝜆𝑛ˆ − 𝝀𝑡ˆ · 𝝀𝑡ˆ ≥ 0 , (24a)
 √︁ 
∥v𝑡ˆ ∥ 𝜇𝜆𝑛ˆ − 𝝀𝑡ˆ · 𝝀𝑡ˆ = 0 , (24b)
∥v𝑡ˆ ∥∥𝝀𝑡ˆ ∥ = −v𝑡ˆ · 𝝀𝑡ˆ . (24c)
Observe here how the term ∥v𝑡ˆ ∥ act as a switch for selecting between the cases of slipping or
sticking. If ∥v𝑡ˆ ∥ = 0 then the last two conditions are trivially fulfilled and the first condition
essentially only tells us that the friction force must belong to the friction cone. On the other
hand, if ∥v𝑡ˆ ∥ > 0 then the two last conditions kick in. The first one ensures the friction
force is maximized, and the last one ensures that the friction force is opposing the sliding
direction. This is illustrated in Figure 5. This form of the isotropic Coulomb friction model is
frequently used for modeling frictional contact, and it represents a non-linear complementarity
problem (NCP) formulation of frictional contact. However, in Section 1.6 and Section 1.7,

21
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

normal normal
friction cone friction cone

𝑛 𝑛
1
𝜇
𝐯 0 𝐯 0

contact contact
𝑡̂ 𝑏 plane 𝑡̂ 𝑏 plane
𝛌 𝛌

𝐯 0 𝐯 0

𝑏 𝑏
𝜇𝜆 𝛌 𝛌
𝑡̂ 𝑡̂

Fig. 5. Graphical illustration of the isotropic Coulomb law. Left: the case of slipping is depicted with a
unique solution. Right: the case of sticking is shown to have multiple solutions. The bottom row shows
the cone as seen from the top. Observe how the circular shape of the cone makes it particular easy to
compute the friction force.

we present details on how to linearize the Coulomb friction model into the standard linear
complementarity problem (LCP) and Boxed-LCP forms, which are the origin for the many LCP
numerical methods we cover in Section 3.
The stick-slip conditions can be written up in a more general form as they are related to
energy dissipation. If one assumes that the friction force maximally dissipates energy, then in
the case of an isotropic circular friction cone this principle of maximum dissipation reduces to
the stick-slip conditions we introduced above. For the more general force, we start by writing
up the definition of the friction cone using a set notation:

F (𝜇𝜆𝑛ˆ ) ≡ 𝛾 ∈ R2 ∥𝛾 ∥ 2 ≤ 𝜇𝜆𝑛ˆ .

(25)

This set denotes all feasible friction forces for the case of isotropic planar Coulomb friction.
One can define the friction cone differently all dependent on the type of materials. For instance,
an elliptical shaped cone can be used to model anisotropic friction. The principle of maximum
dissipation can now be written as a minimization problem,

𝝀𝑡ˆ = arg min v𝑡ˆ · 𝛾 . (26)


𝛾 ∈F (𝜇𝜆𝑛ˆ )

22
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

That is to say the friction force is given by the force that instantaneously removes most (i.e.
maximum dissipation) energy from the system.
If the friction cone F is a strict convex set then the minimization problem has an unique
solution that are characterized by the first order necessary optimality conditions. If we
momentarily denote the objective function as 𝑓 (𝛾) ≡ v𝑡ˆ · 𝛾 and the convex set as Ω = F (𝜇𝜆𝑛ˆ )
then these conditions can be written as

− ∇𝛾 𝑓 (𝜆𝑡 ) ∈ NΩ (𝝀 t̂ ) (27)

where NΩ (𝝀 t̂ ) is the normal cone of F (𝜇𝜆𝑛ˆ ) at the position 𝝀𝑡ˆ. The normal cone of a convex
set can be defined as follows,

NΩ (𝝀 t̂ ) ≡ z z · 𝛾 − 𝝀 t̂ ≤ 0, ∀𝛾 ∈ Ω .
 
(28)

If the set Ω is strictly convex, then we have NΩ (𝝀𝑡ˆ) ≡ −v𝑡ˆ. If the set Ω is only convex, then the
normal cone may be a multi-set. This first order optimality condition can be written concisely
as the condition
∀𝛾 ∈ F (𝜇𝜆𝑛ˆ ) and (𝛾 − 𝝀𝑡ˆ) · v𝑡ˆ ≥ 0 . (29)

This form is known as a variational inequality (VI) and is often the mathematical form
of principle of maximum dissipation that is used as starting point for deriving nonlinear
complementarity problem (NCP) formulations of the frictional contact problem. These NCP
problems can be solved quite nicely with Newton type of methods. The VI-form given above
can be used more directly in a numerical method without needing to do the linearizations
we cover below in Sections 1.6 and 1.7. It offer one with a trade-of between a more "difficult"
to solve nonlinear problem or an "easier" to solve linear version. The nonlinear form is more
compact than the linear form in the sense that much fewer variables are needed. Due to its
capability to inherently express the non-linearity the VI-form generalizes easily to an-isotropic
friction and proximal operators allow for quite general shaped convex cones.
Above we have covered the most typical and classical models for planar dry friction. There
exist other friction models. The above models can be extended trivially to include torsional
(Coulomb–Contensou friction) and rolling friction by incorporating angular counter parts, we
show this for torsional friction when we introduce proximal operators in Section 3.4. There
are many more models as described by Sheng Chen and Liu [2016]. Like the Tresca friction
which limits the friction force to a constant magnitude or the Stribek friction model which
is dependent on the velocity magnitude to model effects of lubrication. Some models seek
inspiration in micro-scale geometry interaction such as the bristle friction model. In Section 6
we present a new friction model that has originated in the graphics field that take a micro-scale
modeling approach to present more interesting friction phenomena that go beyond the typical
isotropic Coulomb friction model.

23
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

normal
friction cone

𝑡̂ 𝑡̂

𝑡̂ 𝑡̂ tangent

Fig. 6. A friction cone approximated by normal direction 𝑛ˆ and four friction directions {𝑡ˆ1, 𝑡ˆ2, 𝑡ˆ3, 𝑡ˆ4 }
that are tangent to the contact plane.

1.6 The Linear Complementarity Problem Model


A linear friction model is preferred for many applications due to their efficiency and compati-
bility with a wide variety of numerical solvers. Hence a linearized approximation of the friction
cone introduced in the previous section is often used. Stewart and Trinkle, Anitescu and Potra,
among others, linearize the 3D friction model using a polyhedral cone [Anitescu and Potra
1997; Stewart and Trinkle 1996]. The polyhedral cone is given by a span of 𝑘 + 1 unit vectors
ˆ 𝑡ˆ1, . . . , 𝑡ˆ𝑘 }, where 𝑛ˆ is the normal direction of the contact plane and {𝑡ˆ1, . . . , 𝑡ˆ𝑘 } all lie in
{𝑛,
the contact plane (see Figure 6). We use a positive span for the tangent vectors {𝑡ˆ1, . . . , 𝑡ˆ𝑘 },
which means that each tangent vector has a twin vector that is oriented in the exact opposite
direction. For instance, notice in Figure 6 that 𝑡ˆ2 is opposite 𝑡ˆ1 . The advantage of using tangent
vectors that point in opposite directions is that it allows the friction force to be written with
all non-negative numbers in this basis. The disadvantage, from a computational viewpoint, is
that one needs more numbers.
One advantage of the non-negative numbers is that they help us couple the sliding direction
to the friction force direction. Let us just show a 1D example to make this modeling trick more
clear. Assume we have some friction force measure 𝑐 along the axis 𝑡ˆ. We can express this
measure instead using two numbers 𝑎 ≥ 0 and 𝑏 ≥ 0, such that

𝑐 𝑡ˆ = 𝑎 𝑡ˆ − 𝑏 𝑡ˆ . (30)

Notice that 𝑐 can be both a positive and negative number depending on the friction force
direction and that 𝑐 is now replaced by two non-negative numbers 𝑎 and 𝑏. In the above

24
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

𝑘 4 𝑘 6 𝑘 8

Fig. 7. The accuracy of the polyhedral cone approximation – light blue shading – increases as the
number of tangential directions increases. The improvement in accuracy is at the cost of an increasing
problem size.

example, the positive span is made of the two vectors {𝑡ˆ, −𝑡ˆ}. Observe also that we must have
0≤𝑎 ⊥ 𝑏 ≥ 0. (31)
From this it is obvious that 𝑎 is the positive part of 𝑐 and 𝑏 is the negative part of 𝑐, and as 𝑐
can not be both positive and negative at the same time then 𝑎 and 𝑏 must be complementary.
The positive span approximation allows us to rewrite Equation 23 as
!
∑︁
0 ≤ 𝜇 𝜆𝑛ˆ − 𝜆𝑡ˆ𝑖 , (32)
𝑖
 𝑇
where 𝝀𝑡ˆ = 𝜆𝑡ˆ1 · · · 𝜆𝑡ˆ𝑘 is a vector of friction impulses along the tangent directions. In
this way, the nonlinear Euclidean norm from the Coulomb model is replaced with the linear
form in Equation 32. In principle, one can add as many tangent directions as wanted to get a
better approximation to the exact cone as illustrated in Figure 7.
One challenge with this model is to correctly formulate the stick-slip transitions. We have
introduced 𝑘 possible directions for measuring a slipping velocity and we need just one scalar
value– the slack variable– to determine the correct stick-slip behavior. The idea here is that we
do not need to measure the exact slipping velocity. We only need information about whether
there is slipping or not. Hence, one idea is to simply identify the direction of maximum slipping
velocity. If we let the maximum slipping velocity along any direction denoted by 𝛽 ≥ 0 then
we must have
0 ≤ (𝛽 e + v𝑡ˆ) (33)
 
where v𝑡ˆ = 𝑣𝑡ˆ1 . . . 𝑣𝑡ˆ𝑘 is the sliding velocity measured along each tangent vector and
where e is a 𝑘 dimensional vector of ones. Observe here that 𝛽 can only be zero if v𝑡ˆ is zero. If
𝛽 is positive, then it will have the same value of the maximum component of v𝑡ˆ. Hence, we
say 𝛽 is an estimate of the maximum sliding velocity along the directions of the positive span
of tangent vectors.

25
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

We next observe that if there is slipping, then the friction force must have its maximum value
in the opposite direction according to the principle of maximum dissipation. This translates
into saying that the friction force should work such that it removes the maximum amount Í of
energy from the system. To ensure this we will make sure that when 𝛽 > 0 then 𝜇 𝜆𝑛ˆ − 𝑖 𝜆𝑡ˆ𝑖
becomes zero. This means the friction force will have its maximum allowed value when sliding.
However, to get the direction of the friction correct we will force (𝛽 e + v𝑡ˆ) to become zero
when we have a friction component. This means when 𝝀𝑡ˆ > 0 then (𝛽 e + v𝑡ˆ) = 0.
Historically, the variable 𝛽 for switching between the slip and stick regimes is called a “slack”
variable. This name may appear non-intuitive at first, but consider it a measure of the amount
of sliding that is present during the current state. It is these stick-slip transitions that make
the frictional problem difficult, and hence why specialized numerical solvers are required to
deal with complementarity conditions (as we will see in Section 3).
We may now summarize the four ingredients that went into stating a linear model for
isotropic Coulomb friction:
• The non-penetration constraints that turn on and off whether we have sustained contact
or separation.
• Linearization of the friction cone to remove the non-linear terms.
• Replace the measure of slipping velocity with the measure of maximum direction of
slipping velocity, to give us a single switching variable to model stick-slip transitions.
• Using the principle of maximum dissipation to pick a unique friction direction when
slipping occurs.
Finally, we can write up the complete mathematical model for our derivation. Letting 𝝀𝑡ˆ =
 𝑇
𝜆𝑡ˆ1 · · · 𝜆𝑡ˆ𝑘 be a vector of friction impulses, the linearized model, including complemen-
tarity conditions, can be formally stated as
0 ≤ 𝑣𝑛ˆ ⊥ 𝜆𝑛 ≥ 0, (34a)
0 ≤ (𝛽 e + v𝑡ˆ) ⊥ 𝝀𝑡ˆ ≥ 0, (34b)
!
∑︁
0 ≤ 𝜇𝜆𝑛ˆ − 𝜆𝑡ˆ𝑖 ⊥ 𝛽 ≥ 0. (34c)
𝑖

The first complementarity constraint in Equation 34 models the non-penetration constraint


as before. The second equation makes sure that in case we do have friction 𝜆𝑡ˆ𝑖 > 0 for some
𝑖, then 𝛽 will estimate the maximum sliding velocity along the 𝑡ˆ𝑖 ’s directions. Observe that
Equation 34b is a 𝑘-dimensional vector equation whose main purpose is to choose the direction
𝑡ˆ𝑖 that is best for the direction of maximum dissipation. The last equation makes sure the
friction force is bounded by the Coulomb friction cone. Notice that if 𝛽 > 0, the last equation
will force the friction force to lie on the boundary of the polyhedral friction cone. If 𝛽 = 0,
then the two last equations model static friction. That is, no sliding can occur and any friction
force inside the friction cone is feasible.

26
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

normal
friction cone
λ

λ λ
𝑡̂ 𝑡̂
tangent
λ λ

Fig. 8. The friction cone approximated by a box, where the limits of friction impulses in each tangential
direction t𝑖 are determined by the box limit equation 𝜆𝑡𝑙𝑜𝑖 ≤ 𝜆𝑡𝑖 ≤ 𝜆𝑡ℎ𝑖𝑖 .

For a general system consisting of 𝑝 contacts, we can assemble the global Jacobian matrices
containing the non-interpenetration and tangential frictional constraints for all contacts. The
non-interpenetration Jacobian has a similar form to Equation 22, but with a single row per
contact. For example, the 𝑖th contact with normal 𝑛ˆ𝑖 is

 𝑇 𝑇 × ×

ˆ = −𝑛ˆ𝑖
J𝑛,𝑖 𝑛ˆ𝑖 r𝑖,𝐴 𝑛ˆ𝑇𝑖 −𝑛ˆ𝑇𝑖 r𝑖,𝐵 , (35)

h i𝑇
J𝑇
and for all 𝑝 contacts we have J𝑛ˆ = 𝑛,1
ˆ . . . J𝑇
ˆ
𝑛,𝑝 . Here the Jacobian is shown in its concise
form, but in practice care must be taken so that the dimensions of the global matrix match the
degrees of freedom of the dynamical system.
The frictional Jacobian is assembled in a similar way, but with 𝑘 rows per contact that
correspond to the friction basis in Figure 7, such that for contact 𝑖 the matrix is

−𝑡ˆ𝑇 𝑡ˆ𝑇 r× 𝑡ˆ𝑇 −𝑡ˆ𝑇 r× 


 𝑖,1 𝑖,1 𝑖,𝐴 𝑖,1 𝑖,1 𝑖,𝐵 
 .. . . ..  ,
J𝑡ˆ,𝑖 =  . .. .. .  (36)
−𝑡ˆ ˆ × ˆ ˆ ×
 𝑇
 𝑖,𝑘 𝑡𝑖,𝑘 r𝑖,𝐴 𝑡𝑖,𝑘 −𝑡𝑖,𝑘 r𝑖,𝐵 
𝑇 𝑇 𝑇

27
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝑇 𝑇
h i
and for all 𝑝 contacts we have J𝑡ˆ = J𝑡ˆ,1 . . . J𝑡ˆ,𝑝 . Finally, the constrained equations of
𝑇

motion for the system (i.e., in the form of Equation 8) may be written as
M −J𝑇 −J𝑇 0   u+  −Mu − ℎf   0 
 𝑛ˆ 𝑡ˆ   +    
J𝑛ˆ 0 0 0  𝝀   0  s𝑛 
   𝑛+ˆ  +  =  (37a)
 Jˆ 0 0 E  𝝀   0  s 𝛽 
 𝑡 ˆ
  𝑡    
 0 𝝁¯ −E𝑇 0   𝛽   0  s𝜆 
      
0 ≤ s𝑛 ⊥ 𝝀𝑛+ˆ ≥ 0 (37b)
0 ≤ s𝛽 ⊥𝝀𝑡+ˆ≥0 (37c)
0 ≤ s𝜆 ⊥ 𝛽 ≥ 0 (37d)
 
where 𝝁¯ = diag 𝜇1 . . . 𝜇𝑝 is a diagonal matrix containing friction coefficients of each
 
contact, and E = diag e𝑇1 . . . e𝑇𝑝 is a block diagonal matrix containing 𝑘 dimensional
vectors of ones. The auxiliary variables s𝑛ˆ , s𝛽 and s𝜆 are introduced here, which helps to write
the complementarity problem in a more concise way. By applying the Schur complement
“trick”, we can compute the reduced system
+
  𝝀𝑛ˆ  s𝑛ˆ 
C + GM−1 G𝑇 𝝀𝑡+ˆ  + GM−1 (Mu + ℎf) =
 
s𝛽  , (38)
 
| {z }  𝛽  | {z } s𝜆 
b  
A |{z}
x

where
0 0 0 
  
C = 0
 0 E , and G𝑇 = J𝑇𝑡ˆ J𝑇𝑛ˆ 0 .
𝝁¯ −E𝑇 0 
 
Then, Equation 37a can be written concisely and compactly in the form of a standard LCP:

0 ≤ Ax + b ⊥ x≥0 (39)

This illustrates how powerful the LCP model really is. By simply assembling the A matrix and
b vector, we can call our favorite LCP solver to compute x. The system may be slightly reduced
by noting that the first row in the system can be used to eliminate u+ . This rewrite is similar
to how Equation 8 was transformed in Equation 9 using the Schur complement. Another
important observation here is that A is asymmetric for the LCP model. This has consequences
with regards to the solvers than can be applied to this model. However, the boxed model we
derive in the next section breaks the coupling of the tangent directions and this leads to a
matrix A that is symmetric. .

28
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

1.7 The Boxed Linear Complementarity Problem Model


An alternative for discretizing the friction cone can be seen in Figure 8. Using two orthogonal
tangent directions, one can write independent inequalities in each friction direction to have
the sliding force limited by the coefficient of friction, 𝜇, times the normal force, 𝜆𝑛ˆ . That is,

𝜆𝑡lo hi
ˆ ≤ 𝜆𝑡ˆ𝑖 ≤ 𝜆𝑡ˆ (40a)
1 1

𝜆𝑡lo hi
ˆ ≤ 𝜆𝑡ˆ2 ≤ 𝜆𝑡ˆ (40b)
2 2

ˆ𝑖 = −𝜇𝜆𝑛ˆ and 𝜆𝑡ˆ𝑖 = 𝜇𝜆𝑛ˆ . Some iterative solvers update these friction bounds during the
where 𝜆𝑡𝑙𝑜 ℎ𝑖

solve based on the magnitude of the normal forces, yielding a four-sided pyramidal cone that is
larger than the true friction cone (in contrast to the approximation in Figure 6 which is inside
the true cone). A further approximation is made by other solvers: using a preliminary solve of
the normal forces, the bounds can be set and the system can be solved with box friction limits.
The bounds on friction impulses in Equations 40a-40b requires us to develop a numerical
method for a problem class which is slightly more general than the classic LCP. Problems in
this more general class are called boxed linear complementarity problems (BLCP).
One appealing notational benefit of writing the contact and friction models as a BLCP is
that both the non-penetration constraints and friction bounds can be expressed with the same
algebraic notation simply by changing how the lower and upper bounds are defined. For
instance, normal impulses have lower and upper bounds 𝜆𝑛loˆ = 0 and 𝜆𝑛hi ˆ = ∞. We demonstrate
this by allowing the index 𝑖 to refer to a friction variable or a normal impulse, and then make
appropriate changes to the bounds. Given 𝜆𝑖 , 𝑣𝑖 , 𝜆𝑖lo, 𝜆𝑖hi ∈ R, the following three conditions
must be satisfied:

𝑣𝑖 > 0 ⇒ 𝜆𝑖 = 𝜆𝑖lo (41a)


𝑣𝑖 < 0 ⇒ 𝜆𝑖 = 𝜆𝑖hi (41b)
𝑣𝑖 = 0 ⇒ 𝜆𝑖lo ≤ 𝜆𝑖 ≤ 𝜆𝑖hi (41c)

The variables 𝜆𝑖lo and 𝜆𝑖hi are the lower and upper bounds on 𝜆𝑖 , and usually it is assumed that
𝜆𝑖lo < 𝜆𝑖hi . We note that by decomposing the residual velocity as 𝑣𝑖 = +𝑣 − −𝑣 𝑖 , the BLCP can be
written as three separate LCPs:

0 ≤ +𝑣 𝑖 ⊥ (𝜆𝑖 − 𝜆𝑖lo ) ≥ 0 (42a)


0 ≤ −𝑣 𝑖 ⊥ (𝜆𝑖hi − 𝜆𝑖 ) ≥ 0 (42b)
− +
0 ≤ 𝑣𝑖 ⊥ 𝑣𝑖 ≥ 0 (42c)

Similar to the polyhedral cone version of the LCP from Section 1.6, a linear system for 𝑝
contacts can be assembled. We begin with the Jacobian matrix for a single contact 𝑖, which is

29
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

given by
×
 −𝑛ˆ𝑇𝑖 𝑛ˆ𝑇𝑖 r𝑖,𝐴 𝑇 × 
 𝑇 𝑇 × 𝑛ˆ𝑇𝑖 −𝑛ˆ𝑇𝑖 r𝑖,𝐵
𝑇
× 

J𝑖 = −𝑡ˆ𝑖,1 𝑡ˆ𝑖,1 r𝑖,𝐴 𝑡ˆ𝑖,1 −𝑡ˆ𝑖,1 r𝑖,𝐵  . (43)
−𝑡ˆ𝑇 𝑡ˆ𝑇 r× 𝑡ˆ𝑇 −𝑡ˆ𝑇 r× 
 𝑖,2 𝑖,2 𝑖,𝐴 𝑖,2 𝑖,2 𝑖,𝐵 
ˆ The global
This is in fact the same Jacobian matrix from Equation 22, where 𝑡ˆ1 = 𝑡ˆ and 𝑡ˆ2 = 𝑏.
𝑇
Jacobian matrix can then be written as J = J1 . . . J𝑇𝑝 ∈ R3𝑝×𝑛 . Finally, we write global
𝑇 
BLCP of the constrained equations of motion as:
M −J𝑇 u+
      
−Mu − ℎf 0
+ + = , (44a)
J 0 𝝀 0 v
| {z } | {z }
A b
0 ≤ v ⊥ 𝝀 + − 𝝀 lo ≥ 0 ,
+
(44b)
0 ≤ − v ⊥ 𝝀 hi − 𝝀 + ≥ 0 , (44c)
− +
0 ≤ v ⊥ v ≥ 0. (44d)
Note that in the above formulation, the constraint impulses are ordered according to the rows of
𝑇
J, such that 𝝀 + = 𝜆𝑛ˆ1 𝜆𝑡ˆ1,1 𝜆𝑡ˆ1,2 . . . 𝜆𝑛ˆ𝑝 𝜆𝑡ˆ𝑝,1 𝜆𝑡ˆ𝑝,2 . The Schur complement may be used


to eliminate the variable u+ from this system, similar to how Equation 8 was transformed in
Equation 9, and we need only solve for 𝝀 + . From top row we obtain u+ = M−1 J𝑇 𝝀 + + u + ℎM−1 f
and substitution into the bottom row yields
JM−1 J𝑇 𝝀 + + −Ju − ℎJM−1 f = v ,

(45a)
| {z } | {z }
A b
0 ≤ v ⊥ 𝝀 + − 𝝀 lo ≥ 0 ,
+
(45b)
0 ≤ − v ⊥ 𝝀 hi − 𝝀 + ≥ 0 , (45c)
0 ≤ −v ⊥ +v ≥ 0 . (45d)

1.8 The Cone Complementarity Problem Model


The Coulomb friction model we introduced in Section 1.5 combined with the non-penetration
constraint from Section 1.4 is essentially a nonlinear combinatorial problem. It is by its very
nature really not an optimization problem. In this section we will introduce a relaxation
technique that changes the original model but in such a way that we obtain a convex mini-
mization problem. We will start our rewrite of the contact force model by changing the normal
non-penetration constraint to the form [Anitescu and Hart 2004]
√︃
0 ≤ ℎ1 𝜙 + 𝑣𝑛ˆ − 𝜇 𝑣𝑡2ˆ + 𝑣 2ˆ ⊥ 𝜆𝑛 ≥ 0 . (46)
𝑏

30
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Here v = {𝑣𝑛ˆ , 𝑣𝑡ˆ, 𝑣𝑏ˆ } is the contact space velocity. Usually we have 𝜙 = 0 for touching contacts
and then the equation simplifies to
√︃
0 ≤ 𝑣𝑛ˆ − 𝜇 𝑣𝑡2ˆ + 𝑣 2ˆ ⊥ 𝜆𝑛ˆ ≥ 0 . (47)
𝑏
This is essentially the only change we are making, everything else we keep the same. What
remains is a bit of mathematical convenience in rewriting everything into a simple form. We
will now combine this relaxed normal non-penetration constraint with the isotropic planar
Coulomb model from previously. This time we will write up both the normal and friction parts
simultaneously into one single equation. To do so we need to recall a few definitions from
math. The dual cone to a convex cone K is defined as
K ★ ≡ {y | y · x ≥ 0, ∀x ∈ K} . (48)
The polar cone to a convex cone K is defined as
K ◦ ≡ {y | y · x ≤ 0, ∀x ∈ K} . (49)
Observe we have K◦ −K ★.
= We now have enough cone-formalism to proceed with putting
our model together. Recall that the isotropic Coulomb friction law stated that 𝜇𝜆𝑛ˆ ≥ 𝝀 t̂ ,
where 𝝀𝑡ˆ = (𝜆𝑡ˆ, 𝜆𝑏ˆ )𝑇 . This we can rewrite into 𝜇 2𝜆𝑛ˆ − 𝜆𝑡2ˆ − 𝜆 2ˆ ≥ 0. Now let us define the convex
𝑏
friction cone as follows,
n √︃ o
F𝜇 ≡ 𝝀 = (𝜆𝑛ˆ , 𝜆𝑡ˆ, 𝜆𝑏ˆ )𝑇 ∈ R3 𝜆𝑡2ˆ + 𝜆 2ˆ ≤ 𝜇𝜆𝑛ˆ . (50)
𝑏
This is a little different from the previous meaning of F (𝜇𝜆𝑛ˆ ) where 𝜆𝑛ˆ was seen as an input
parameter that generates a specific cone. The new notation allow us to write 𝜆 ∈ F𝜇 to express
the bound of the Coulomb friction law. We now write the combined normal and friction
constraints simply as a cone complementarity problem (CCP),
F𝜇★ ∋ v ⊥ 𝜆 ∈ F𝜇 , (51)
or equivalently,
F𝜇◦ ∋ −v ⊥ 𝜆 ∈ F𝜇 . (52)
The cone complementary notation means that
− v ∈ F𝜇◦ , 𝝀 ∈ F𝜇 , and −v·𝝀 = 0. (53)
For the isotropic Coulomb friction cone we see that the dual cone is defined as
n √︃ o
F𝜇◦ ≡ v = {𝑣𝑛ˆ , 𝑣𝑡ˆ, 𝑣𝑏ˆ } ∈ R3 𝑣𝑡2ˆ + 𝑣 2ˆ ≤ 𝜇1 𝑣𝑛ˆ . (54)
𝑏
Figure 9 illustrates the difference between the nonlinear complementarity problem (NCP)
formulation of the friction contact we have presented previously and the new cone comple-
mentarity problem (CCP) model we just presented.
As the figure illustrates the CCP model can be written quite compact and that the sliding
velocity v has been relaxed. That is we have given it more “freedom” not to be confined to the

31
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝛌∗ ℱ 𝛌∗ ℱ

𝐯 𝐯
ℱ∘

Fig. 9. On the left the solution from the classical complementary problem formulation is shown. Here
the sliding velocity is confined to be in the 2D contact plane. On the right the cone-complementarity
formulation (CCP) is shown. Observe that the sliding velocity is now orthogonal to the contact force.

2D contact plane. Furthermore, the polar cone keeps the velocity orthogonal to the contact
force. Combined those traits give this model many numerical benefits in terms of having
very fast iterative solvers with sub-linear convergence rates. Projected gradients methods was
initially explored and are similar in spirit to the project Gauss-Seidel methods we cover in this
work [Anitescu and Tasora 2010]. The accelerated  projected
 gradient descent method (APGD)
1
is another such method with convergence rate O 𝑘 2 where 𝑘 is the iteration number [Mazhar
et al. 2015]. In comparison to the proximal operator methods we present in Section 3.4 for the
1

NCP type of model they have O 𝑘 . A modified Fischer-Burmeister function can be used to
rewrite the CCP model into a root finding problem and by applying a splitting strategy one
may develop Gauss-Seidel type solvers from this setting too [Daviet et al. 2011].
Hence, there are obvious performance benefits from this formulation of the contact forces.
The catch is that the “physics” is different from the classical model. As Figure 9 clearly shows,
as the tangential sliding velocity grows large the model will gain a positive normal component
based on the relative contact velocity, 𝑣𝑛ˆ > 0. In other words, if one has a stack of blocks and
pushes a block very fast, then it will try to lift of from the other blocks. The effect can be
limited with adding an adhesion term to the model, but it does not completely remove the
effect and adhesion will also further change the physical behavior.
Whether the physics of the NCP versus the CCP model is right or wrong is debatable as
friction is a system response and surface material interactions are therefore quite a complicated
matter to model and there is huge variation. The CCP are disliked by some as it feels like
a mathematical rewrite to the physics to get nice numerical properties, and it is loved by
others because the numerical traits the CCP model gains results in very fast solvers. Work has
been done on validating the CCP model in context of granular flows and here it shows good
agreement with reality [Mazhar et al. 2015].

32
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Recalling the Schur complement reduction technique we used to derive the reduced form in
Equation 9, then from
v = Ju+ , (55a)
Mu+ = J𝑇 𝝀 + Mu + ℎf (55b)
one can derive the linear relationship between sliding velocity and contact forces as
v = A𝝀 + b . (56)
Substituting this equation into the CCP model, we observe that the model is equivalent to the
first order optimality conditions of a second order cone problem (SOCP), which is given by
𝝀 ∗ ≡ arg min 12 𝝀𝑇 A𝝀 + 𝝀𝑇 b . (57)
𝝀∈F𝜇

Notice here that both the objective function and the constraints are written as convex second
order cones. This insight opens up for the application of a vast majority of numerical methods
for solving the CCP model, such as alternating direction method of multipliers (ADMM) [Tasora
et al. 2021]. One may alternatively have used the Schur complement to reduce to a quadratic
objective function in v instead of 𝝀 as was done in [Acary et al. 2011]. The ADMM method
may be used on this alternative velocity form of the CCP model too [Daviet 2020].
We do not cover solvers for CCP frictional contact models in these notes. However, with the
material presented later on iterative methods for NCPs, LCPs, BLCPs and proximal operators,
the reader should be off to a good start to implement numerical methods for CCP type models
too.

1.9 Constraint Stabilization


The system in Equation 8, and its reduced form in Equation 9, are linear approximations
of a non-linear dynamical systems. Therefore, they are prone to numerical drift, especially
when combined with the low-order numerical integration methods that are commonplace
in computer graphics applications. Also, an exact numerical solution of the linear system
is practically impossible, which again contributes to the drift. In the context of contact
simulation, this results in both position and velocity level artifacts. At the position level,
the interpenetration between bodies will increase since non-interpenetration constraints
cannot be exactly resolved, whereas at the velocity level, bodies will begin to slide rather than
stick. Furthermore, if discrete collision detection is used to generate contact constraints, this
means that collision events may not be detected at the time of impact and hence we cannot
assume that bodies will be in a non-interpenetrating state at the start of a time step.
The issues described above will cause a multibody system to gradually violate the constraint
manifold. Recall that the manifold is an invariant set defined by the gap function, where
𝜙 (q) ≥ 0. An approach to solve this problem would be to use a feedback rule to bring the
system back to a valid state, where the constraints are not violated. Giving some physical

33
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

meaning to this idea, a spring in the constraint space may be used to “push” or “pull” the
multibody system back to the constraint manifold. If there is no constraint violation, then
this constraint spring generates no forces. However, if there is a constraint violation (e.g.,
𝜙 (q) < 0), then the spring generates a force to restore the configuration back to the constraint
manifold. Essentially, the spring force stabilizes the constraint.
To realize this behavior, let us assume that all constraint forces are generated by an implicit
Hookean spring, such that
λ+ = −𝑘𝜙 + − 𝑏𝑣 + . (58)
Here, 𝜙 is the gap function for a single constraint, 𝑣 is the relative velocity in constraint space,
and 𝑘 and 𝑏 are the stiffness and damping coefficients of the spring. Note that we again adopt
the convention that □+ is an implicit variable.
Equation 58 is in fact an example of the well known Baumgarte stabilization [Baumgarte
1972] technique. Approximating the constraint error term by 𝜙 + = 𝜙 + ℎ𝑣 + , the spring equation
can be rewritten as
λ+ + (ℎ𝑘 + 𝑏) 𝑣 + = −𝑘𝜙,
which is further simplified by dividing both sides by (ℎ𝑘 + 𝑏), such that
1 𝑘
𝑣+ + λ+ = − 𝜙.
ℎ𝑘 + 𝑏 ℎ𝑘 + 𝑏
Finally, recall that 𝑣 + = Ju+ , and further simplification of the above equation yields:
   
+ 1 + ℎ𝑘 −𝜙
Ju + 2 𝜆 = . (59)
ℎ 𝑘 + ℎ𝑏 ℎ𝑘 + 𝑏 ℎ
| {z } | {z }
𝜖 𝜐

Note that Equation 59 resembles Equation 4, but introduces a feedback term on the right-hand
side of the equation. This term attempts to reduce the constraint violation 𝜙 by applying a
constraint-space spring impulse in order to resolve the error by end of the time step. However,
the portion of the constraint error being reduced at each step is modulated according to
𝜐, which is commonly known as the error reduction parameter (ERP). Observe that setting
𝜐 = 1 will encourage the feedback rule to produce a constraint velocity that reduces all of the
constraint error in a single step. Also, observe that a portion of the implicit constraint force 𝜆 +
is now being mixed with the kinematic constraint in Equation 59, and it is often referred to as
the constraint force mixing (CFM) term.
The 𝜖 and 𝜐 parameters may be specified directly, which is intuitive from a numerical
standpoint. Whereas adjusting 𝑘 and 𝑏 and then generating 𝜖 and 𝜐 from the spring coefficients
is perhaps a more physically intuitive approach, since there is some notion that these behave like
material properties of the contact. Additionally, parameters 𝑘 and 𝑏 may be tuned independent
of the time step ℎ.

34
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

The stabilization parameters can be tuned differently for each of the 𝑚 constraints and
assembled into the diagonal matrices:

𝜖1  𝜐 1 
   
𝜖2 𝜐2
Σ =   ,Υ=
   
..  .  .
 . 


 . . 

 𝜖𝑚   𝜐𝑚 
 

Reassembling the linear system from Equation 8 and accounting for the new stabilization
terms gives a multibody system with constraint stabilization:

u+
    
M −J𝑇 Mu +ℎf
= 𝝓 . (60)
J Σ 𝝀+ −Υ ℎ

The system in Equation 60 includes not only a feedback term to reduce the positional errors
for each constraint, which are stored in 𝝓 + ∈ R𝑚 , but also the diagonal matrix Σ in the lower
right block. This has the added benefit of improving the conditioning of the matrix, which is
especially beneficial during simulations involving complex contact where the linear system
would otherwise become degenerate due to redundant rows in the Jacobian matrix. It can also
be shown that the linear system in Equation 60 is positive definite, assuming that 𝜖 > 0 for all
constraints.

1.10 Soft vs. Rigid Body


Many of the methods we cover for solving the frictional contact problem can be extended
from rigid bodies to soft bodies. For this introductory text on solvers we have taken the typical
approach and presented the ideas using rigid body notation. Below we will first describe how
equation and matrices of a full rigid body system look and afterwards we will describe the
changes for a soft body system. The most important differences is that for soft bodies one
typically use more implicit time discretizations and the number of variables are much larger.

1.10.1 Assembling the Matrices for a Rigid Body System. We will here for completeness explain
how to construct the matrices M and J and the vector f that holds external and gyroscopic
force terms when considering a rigid body system with multiple rigid bodies and multiple
contacts. This section can be skipped if reader is already familiar with those aspects.
Let us consider the 𝑘 th contact point. The contact normal is given by 𝑛ˆ𝑘 and the two
orthonormal vectors spanning the contact plane are 𝑡ˆ𝑘 and 𝑏ˆ𝑘 . The indices of the two bodies
meeting at the contact is 𝑖 and 𝑗, where we assume that 𝑖 < 𝑗. We will adopt the convention
that 𝑛ˆ𝑘 is pointing from body 𝑖 to body 𝑗. The vector arms from the center of mass of the
bodies to the point of contact is given by r𝑘𝑖 and r𝑘 𝑗 respectively. The relative contact point

35
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

velocity can now be written as follows


𝑣𝑛ˆ𝑘  "
   𝑇 #  v𝑖 
× r𝒌𝒋 × C𝑘
𝑇
 𝑘  = −C𝑘 − r𝒌 𝒊 C𝑘 C𝑇𝑘
 𝑣𝑡ˆ  𝑇 𝜔𝑖 
𝑣 ˆ 
 
v𝑗  (61)
 𝑏𝑘  0𝑇 −𝑛ˆ𝑇𝑘 0𝑇 𝑛ˆ𝑇𝑘  
𝑣𝜏  𝜔 𝑗 
 𝑘  
where
C𝑘 = 𝑛ˆ𝑘 𝑡ˆ𝑘 𝑏ˆ𝑘 .
 
(62)
In the equations above we included the angular spin around the normal axis, 𝑣𝜏𝑘 , to demonstrate
how this term can be included. If one only cares about planar friction then the bottom row of
our equation can be dropped. Observe we can get the rolling spin around the tangent vectors
included by replacing the 𝑛ˆ𝑇𝑘 with C𝑇𝑘 in the last row. Doing this the left-hand side contact
velocity vector would gain two more components being the spin-velocities around 𝑡ˆ𝑘 and 𝑏ˆ𝑘 .
The tangent plane directions 𝑡ˆ𝑘 and 𝑏ˆ𝑘 are often computed by picking 𝑡ˆ𝑘 to be in the direction
of sliding and letting 𝑏ˆ𝑘 be orthogonal to 𝑡ˆ𝑘 . For isotropic friction modeling it does not matter
much how the vectors are computed. In Section 6 we discuss other approaches for computing
these vectors in the case of anisotropic friction.
Defining the block notation
𝑣𝑛ˆ𝑘 
     
 𝑣𝑡ˆ  v𝑖 v
v𝑘 =   , u𝑖 =
 𝑘
, u𝑗 = 𝑗 , (63)
𝑣𝑏ˆ𝑘  𝜔𝑖 𝜔𝑗
𝑣𝜏 
 𝑘
and
 𝑇  "  𝑇 #
−C𝑇𝑘 − r𝒌 𝒊 × C𝑘 C𝑇 r𝒌𝒋 × C𝑘
J𝑘,𝑖 = , J𝑘,𝑗 = 𝑘 (64)
0𝑇 −𝑛ˆ𝑇𝑘 0𝑇 𝑛ˆ𝑇𝑘
and assembling a full system of all 𝐾 contacts and 𝑁 bodies we have
 u1 
 
 v1   .. 
 .   . 
 .   .. .. .. .. ..   u 
 .   . . . . .   𝑖
 v𝑘  = 0 · · · 0 J𝑘,𝑖 0 · · · 0 J𝑘,𝑗 0 · · · 0  ...  . (65)
   
 .   . .. .. .. ..   u 
 ..   .. . . . .   𝑗
  
v𝐾  | {z }  .. 
 
J  . 
|{z} u 𝑁 
v  
|{z}
u

36
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

The 𝑖 th rigid body has the center of mass position x𝑖 and the orientation given by the unit
quaternion 𝑄𝑖 ≡ (𝜙𝑖 ,𝜓𝑖 , 𝜃 𝑖 , 𝜉𝑖 ) together with the mass 𝑚𝑖 and local body-frame inertia tensor
𝑏 I . The local body frame inertia tensor must be updated to reflect the world-frame inertia
𝑖
tensor
𝑤
I𝑖 = R𝑖𝑏 I𝑖 R𝑇𝑖 (66)
where R𝑖 is the rotation matrix corresponding to 𝑄𝑖 . Defining the mass-block notation
 
𝑚𝑖 I3×3 0
M𝑖 = 𝑤I . (67)
0 𝑖

Now the assembled mass matrix reads


M1 . . . 0 
 ..  .
M =  ... . . . .  (68)
 0 ... M 
 𝑁

Let fext𝑖 and 𝜏ext𝑖 be the force and torque accumulators of all external force types acting on the
𝑖 th body. Using the block-notation
 
fext𝑖
f𝑖 = (69)
𝜏ext𝑖 − 𝜔𝑖 × 𝑤 I𝑖 𝜔𝑖

for the external and gyroscopic forces we assemble the f vector,


h i𝑇
f = f 𝑇 ... f 𝑇 . (70)
1 𝑁

Defining the blocked notation


 𝑇
q𝑖 = x𝑇𝑖 𝑄𝑇𝑖 (71)
then the global assembled version reads
 𝑇
q = q𝑇1 . . . q𝑇𝑁 . (72)
Notice that the dimension of q and u mismatch due to the use of a quaternion for body rotations,
and this causes a problem for the generalized kinematic relation, q¤ = u. The problem can be
solved by introducing the matrix
−𝜓𝑖 −𝜃 𝑖 −𝜉𝑖 
 
1  𝜙𝑖 𝜉𝑖 −𝜃 𝑖 
H𝑖 =  , (73)
2  −𝜉𝑖 𝜙𝑖 𝜓𝑖 
 𝜃 𝑖 −𝜓𝑖 𝜙𝑖 
 
37
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

and defining the block matrix


I3×3 0 
H𝑖
 
 
 .. 
H =  .  .
 (74)

 I3×3 

 0 H 
 𝑁
The discretized kinematic relation leading to the position update is now given by
q+ = q + Δ𝑡Hu , (75)
which must always be followed by a normalizing of all 𝑄𝑖 ’s to keep them a proper rotation.
1.10.2 Assembling the Matrices for a Soft Body System. For simulation of soft bodies the
equations of motion changes slightly as we need to add elastic forces. Elastic forces can be
computed using many different approaches ranging from particle systems to finite element
methods. A rather large collection of works devoted to elastic body simulation exist in the
field of computer graphics. Below we merely recap a few simple ideas that suffices for us to
talk about contact forces for soft bodies and how this is different from the rigid bodies. For a
more in depth treatment we refer the interested reader to the SIGGRAPH courses by Sifakis
and Barbic [2012] and Kim and Eberle [2020]. For a soft deformable model, the finite element
method results in the second order differential equation
M¥q + B¤q + Ku = f + J𝑇 λ. (76)
Here q is the concatenation of the positions of all the nodes in the mesh, u is the displacement
given by the difference from current deformed nodal positions q and undeformed positions q0 ,
and f is the external forces acting on the soft body. The matrix M is the mass matrix of the soft
body, B is the damping matrix and K is the stiffness matrix, and J is the contact Jacobian and
λ contains the Lagrange multipliers for the contact forces. Observe that if we are in 3D and
have 𝑁 nodes in a linear tetrahedral mesh, then the dimensions of the introduced quantities
are q, u, f ∈ R3 𝑁 and M, B, K ∈ R3 𝑁 ×3 𝑁 . If there are 𝐾 contacts, then we have J ∈ R3 𝐾×3 𝑁 and
λ ∈ R3 𝐾 .
We now already observe several differences compared to the rigid body case namely that
there are no orientation or angular spin present in these equations, as such they are simpler as
we do not need to deal with things such as quaternions. On the downside the dimensionality of
the equation has exploded compared to the rigid body case. A small simple soft body can easily
have more than 1000 nodes, hence the dimensionality of the equations is at least 2-3 orders of
magnitude larger. Hence, solving the free motion of soft bodies is much more demanding than
the rigid body case simply because there are more variables. Lastly we see a new force-type in
the equations, the elastic forces. In our simple setup, we used the most simple type of elastic
force, namely a linear isotropic elastic model. Proper elastic modeling is difficult and there
exist many different elastic models, which one to pick and use is a whole subject in itself. The

38
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

elastic forces can be tricky to compute too, but the good news is that the soft elastic nature of
the forces numerically dampen the response between nodes in the mesh. That is deformations
in a soft body propagate like a wave through the body. This means that the effect of contact
forces too are subject to this wave propagation nature. This is actually how real objects bounce.
The nice thing compared to rigid bodies is that the numerics often gets better whereas in rigid
bodies all forces in contact are instantly affecting each other, in soft bodies there is a delay,
one can say the contact forces act more locally compared to rigid bodies where the effect is
more global on the whole system.
We will now perform a typical time discretization using finite difference approximations.
First we observe that time derivative of the velocity is the acceleration, u¤ = q¥ , and so using
first order Euler,
u+ − u
u¤ ≈ , (77)

where u and u+ are the generalized velocities at time 𝑡 and 𝑡 + ℎ, respectively. Similarly,
integrating the generalized positions gives:
q+ ≈ q + ℎu+ . (78)
Substituting the above finite difference approximations produces a velocity-level formulation
of the dynamics equations, such that
u+ − u
+ K q+ − q0 + Bu+ = f + J𝑇 λ .

M (79)

Further manipulation, and converting forces to impulses by 𝝀 ≡ ℎλ, gives the form,
Mu+ − Mu + ℎK q + ℎu+ − q0 + ℎBu+ = ℎf + J𝑇 𝝀 .

(80)
Finally,
A u+ = b + J𝑇 𝝀, (81)
where
A = M + ℎB + ℎ 2 K, (82a)
b = Mu + ℎ (f − Kq + Kq0 ) . (82b)
The A matrix is sparse block symmetric and positive definite matrix. Thus, if we ignore contact
forces momentarily then the linear system can be solved effectively using a numerical method
such as the conjugate gradient method. Having found u+ we may do the position update
q+ = q + ℎu+ . (83)
Adding contact forces to this is straightforward done by adding non-penetration constraint
and Coulomb friction law as we have outlined previously. For instance, when setting up the
LCP model, we will have the system matrix defined as W ≡ JA−1 J𝑇 , and the right-hand-side
vector will be w ≡ JA−1 b. Historically the W-matrix is called the Delassus operator. If we
compare the equations to the rigid body counter part we see that the change is that M in the

39
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

rigid body case is replaced with A in the soft body case. What does this imply? Clearly A is
of much higher dimension, and the stiffness matrix K may be computational heavy to actual
assemble, further the inverse of A is wanted. One remedy is to use a lumped mass matrix
and explicit time-discretization of the elastic forces in which case K drops out from A and A
becomes a diagonal matrix. This however is often too limited as large time-step sizes causes
instabilities in such a semi-implicit time-discretizaton approach. Section 4.2 elaborates deeper
on other time-discretization approaches as well as a few of the numerical variations that make
soft bodies contact a little different than rigid bodies contact.
So far, our treatment of the soft body simulation only contained a single soft body when
adding multiple soft bodies to the system the equation of motion is replicated for each soft
body. The tricky thing is that different soft bodies can have a different number of nodes and this
means the block-size will vary when assembling all matrices into one system. As an example
imagine we are given three soft bodies and their mass matrices are M0 , M1 , and M2 then the
system mass matrix will be
M0 0 0 

M ≡  0 M1 0  . (84)
0
 0 M 2
Here the blocks will be of different size if the number of nodes in the soft bodies are different.
Note that if consistent mass matrices are used the assembled mass matrix is not a diagonal
matrix. Similar for the damping and stiffness matrices. The contact Jacobian matrix is slightly
different if there are 𝐾 contacts and the number of nodes in the soft bodies are 𝑁 0 , 𝑁 1 , and 𝑁 2
then J ∈ R3 𝐾×3 (𝑁0 +𝑁1 +𝑁2 ) . Each blocked row will have a form similar to Equation 20.

40
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

2 CONTACT GENERATION
Contact occurs when pairs of bodies touch inside a physics simulation. However, rather than
simply touching, more likely is the scenario where the bodies actually intersect due to some
overlap between their collision geometries. In this section, we discuss methods for generating
contact points and normals for a variety of geometries.
The geometry used to determine whether there is a collision (or not) between two bodies
can have a significant impact on the behavior of contact simulations. Often, performance is
a principal consideration when selecting the type of shape used to represent the geometry
of a simulation body, in which case simple shapes may be used to approximate the overall
shape. We cover those in Section 2.1. However, accuracy and fidelity are also important
considerations for certain applications, in which case geometrical representations with more
detail are required, and for such cases we cover mesh-based representations and signed
distances fields in Section 2.2 and Section 2.3 respectively.
The algorithms used to detect collisions between shape representations are specific to a pair
of geometries. Throughout this section, we also provide algorithmic details about tests for
various geometry combinations. In addition to determining whether or not a collision exists,
the algorithms must also be extended to compute a contact normal and position. The contact
position is a location that represents the overlapping volume of the two bodies, whereas the
contact normal is the direction of a restorative force that is applied to separate the two bodies.
In the case of the normal, it is typically useful to decide on a convention with respect to the
order of bodies. For instance, we assume that contact normals are always directed from the
first body toward the second body.
Essentially a contact point models proximity information between two objects. We label
the objects A and B. Contact points are often used to model touching contact states as well as
separation and penetrating states. The touching state is ideal for giving an intuitive description
of the information associated with a contact point. Hence, we will use this state to introduce
concepts. Conceptually a contact point provides three different kinds of information: a position,
a normal, and a penetration (gap) measure. For continuous contact regions between two
touching objects there are infinitely many points of contact. Therefore, a contact point can
in general be considered as a sample point of those infinitely many points of contact. For
mesh-based methods the intersection points between the local mesh features of the two objects
are often used as the contact points.
Position: In a touching state a contact point has a reference to the two objects in contact,
and specifies the actual points of the two objects in contact. We describe the common touching
point, p ∈ R3 of the two surface points with respect to two objects on the surface of each
object, p𝐴, p𝐵 ∈ R3 . At the ideal touching state, one has p = p𝐴 = p𝐵 . In case of separation or
penetration this equality breaks and one may define p = 21 (p𝐴 + p𝐵 ) or use some weighting of
p𝐴 or p𝐵 based on volume or size of the objects. Positions are used as the point of action when

41
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

applying contact forces, and a consequence of using p𝐴 and p𝐵 is that ghost torques may be
introduced if p𝐴 ≠ p𝐵 .
Normal: In a touching state, the surfaces of two smooth objects will have unique parallel
outward unit normals at any shared point on their respective surfaces. Let the two normals be
𝑛ˆ𝐴, 𝑛ˆ𝐵 that are oriented in opposite directions, such that 𝑛ˆ𝐴 = −𝑛ˆ𝐵 . Often only one normal 𝑛ˆ
is associated with a contact point. Typically, implementations use a convention to use either
𝑛ˆ = 𝑛ˆ𝐴 or 𝑛ˆ = 𝑛ˆ𝐵 as the normal associated with a contact point. For the case of penetration,
the concept of a normal is perhaps less intuitive. Ideas such as using the minimum distance
vector or minimum translational distance may instead be used to define 𝑛. ˆ To make matters
worse, for non-smooth surfaces, 𝑛ˆ𝐴 and 𝑛ˆ𝐵 become indeterminate. Even if they are well-
defined, one may not have 𝑛ˆ𝐴 = −𝑛ˆ𝐵 . Nevertheless, the normal is computed and used to apply
non-interpenetration forces in the correct direction.
Penetration Measure: The penetration is defined to be zero for touching, positive for
separation, and negative for intersection. This follows the same convention of the gap function
𝜙 introduced in Section 1. Conceptually, penetration is the distance one would need to move
along 𝑛ˆ to bring the two objects into a touching state. The measure is often used to add
stabilization terms to counter drift errors. Hence, it need not be a distance measure, but some
monotone function that penalizes the constraint violation. For instance, volume overlap could
alternatively be one such measure.

2.1 Analytic Shapes


Simple shapes may be used as an approximate representation for the
surface of an object. While they are often used as elements in a hierarchical
data structure, like bounding volume hierarchies, to perform cheap and
conservative intersection tests, they are also commonly used as the
fundamental geometry for many collision detection tasks. Implicit surface 𝐜

representations are common examples of collision proxies, such as spheres 𝑟


and planes. Whereas related surface representations may be used in other
cases, such as capsules or boxes. In this section, we consider some of these
simple shapes– spheres and boxes– and how to generate contacts using
𝐡
them.
Spheres are perhaps the most efficient 3D shapes for collision tests, both 𝐜
in terms of storage and computational efficiency. A sphere is defined by a
center point c ∈ R3 and radius 𝑟 ∈ R, as shown in the figure on the right.
𝐡
Boxes are also popular due to their efficiency. Specifically, oriented 𝐡
bounding boxes (OBBs) that follow the local coordinate system of the
object can be adjusted to give a good approximation of the visual geometry
of an object. An OBB can be defined by center point c ∈ R3 , rotation matrix R ∈ 𝑆𝑂 (3) and
half-width extents along the local axes h ∈ R3 , as shown in the figure on the right.

42
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

𝐜 𝑟

Fig. 10. A sphere-sphere intersection.

2.1.1 Sphere-Sphere Intersection. Assuming that the center position of two spheres share
common reference frame, the intersection test involves simply computing the distance between
the two centers positions, c1 and c2 , and checking if the distance is less than the sum of the
radii 𝑟 1 and 𝑟 2 . In other words, if the gap function is negative or zero, such that
𝜙 = ∥c2 − c1 ∥ − (𝑟 1 + 𝑟 2 ) ≤ 0 ,
and if the above condition is true, a contact is generated. The contact normal for a sphere-
sphere intersection is aligned with the vector between the two centers, and the unit length
normal is computed as
c2 − c1
𝑛ˆ = .
∥c2 − c1 ∥
Note that special consideration should be given to the degenerate case where c1 = c2 , and in
this case a good option is to simply specify an axis-aligned normal vector. The contact point is
located anywhere along the line connecting the two centers. A common choice is the center of
the overlapping region:
1 1
p = (c2 − 𝑟 2𝑛)ˆ + (c1 + 𝑟 1𝑛)
ˆ
2 2
Other options for computing the contact point include using a radius-weighted sum of the
distance between the centers, or a point on the surface of either sphere.
2.1.2 Sphere-OBB Intersection. The intersection test between a sphere and an OBB requires
first transforming the center of the sphere into the local coordinate system of the box:
−1
clocal = ROBB (csphere − cOBB )
Then, the closest point g on the box is found by considering the extents h in each axially
aligned direction, and each coordinate 𝑖 ∈ {𝑥, 𝑦, 𝑧} of the closest point is compute as

43
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝐜 𝐜 𝐑 𝐜 𝐜
𝑛
𝐠
𝐡 𝐡
𝑛
𝐜 𝐠 𝐜
𝐜

𝐡 𝐡

shallow penetration deep penetration

Fig. 11. Sphere-OBB intersection showing the shallow (left) and deep (right) penetration. Note that
the 𝑧-dimension is not shown.

 −h𝑖 , −h𝑖 > clocal,𝑖





g𝑖 = h𝑖 , h𝑖 < clocal,𝑖 (85)
 clocal,𝑖 , otherwise


If the distance from the closest point to the sphere center is less than the radius of the sphere,
such that ∥g − clocal ∥ < 𝑟 , then there is an intersection. However, special consideration must
be given to the scenario where the sphere center is entirely inside the box, in which case
g = clocal based on Equation 85. Thus, there are two cases to consider when computing the
contact normal: shallow and deep penetration.
Shallow penetration occurs if the transformed sphere center lies outside the box extents in
at least one dimension. The penetration 𝜙 is computed as the difference between the distance
∥g − clocal ∥ and the sphere radius:
𝜙 = ∥g − clocal ∥ − 𝑟
The normal may be simply computed as the unit vector that points from the sphere center to
the closest point transformed in the global reference frame:
g − clocal
𝑛ˆ = ROBB
∥g − clocal ∥
Deep penetration is the case when the transformed sphere center lies entirely inside the
box. This is somewhat of an extreme scenario for contact simulation, but nonetheless should
be handled if robust collision is desired. The collision detection algorithm must determine
which of the box faces is closest to clocal . This is easily tested since the sphere center has been
transformed to the local coordinate system of the box, and the test reduces to determining

44
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

which axis-aligned distance test returns the minimum penetration:



𝜙 = −min |h𝑥 − clocal,𝑥 |, |h𝑦 − clocal,𝑦 |, |h𝑧 − clocal,𝑧 |
It is trivial to determine the closest face by considering the sign of the term that minimizes the
above function. The point g is then computed by projecting the local sphere center onto the
closest face. For example, in Figure 85, the closest point on the box surface is computed by
moving the sphere center to the −𝑥 face, such that
 𝑇
g = −h𝑥 clocal,𝑦 clocal,𝑧 .
Similarly, the normal of the closest box face also determines the contact normal. For example,
in the case of the deep penetration example from Figure 85, the local contact normal is
 𝑇
𝑛ˆ = −1 0 0 ,
and the world space normal is computed as ROBB𝑛. ˆ Finally, the contact point for both the
shallow and deep penetration case may be located anywhere in the overlapping region between
the OBB and the sphere. For simplicity, the closest point on the box is transformed to the
global coordinate system:
p = ROBB g + cOBB .
2.1.3 OBB-OBB Intersection. Testing for intersection between two OBBs is a special case of
testing for intersection between two convex hulls. There are several algorithms that can be
considered here, such as the Gilbert–Johnson–Keerthi (GJK) distance algorithm [Gilbert et al.
1988] and the separating axis theorem (SAT) [Boyd and Vandenberghe 2004]. The latter is
often preferred since the SAT allows efficient identification of the contact surfaces, as well as
the penetration depth. Although, GJK may be combine with the expanding polytope algorithm
(EPA) [Van Den Bergen 2003] to compute the overlap.
The first step is to determine if an intersection exists between the boxes. The SAT states
that two convex objects do not intersect if a plane, onto which the geometry of each convex
shape is projected, can be found where they do not overlap. Recall that the orientation of a
plane is determined by a normal vector that is perpendicular to the plane. For the OBB-OBB
intersection test, the following cases are considered for the separating plane orientation:
• The 3 face normals from box A ;
• The 3 face normals from box B ;
• The 9 normals formed by computing the cross-product of all edge pairs combining box A
with box B.
Given two OBBs A and B, the tests involve projecting the vector between the box centers,
d𝐴𝐵 = c𝐵 − c𝐴 , onto the separating axis of the plane, 𝑙.ˆ Then, we check if the sum of the
projected box extents exceeds the length of d𝐴𝐵 . Due to symmetry, additional tests can be

45
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝐜
𝐡
𝐡
𝐝 𝐵
𝐜
𝐡 ⋅𝑙 𝐡 ⋅𝑙
𝑙
𝐝 ⋅𝑙

Fig. 12. A separating axis test applied to two boxes in 2D. The vector between the box centers, d𝐴𝐵 , is
projected onto the axis 𝑙,ˆ and similarly for the box extents h𝐴 and h𝐵 . Since the sum of the absolute
values of the projected extents is less than |d𝐴𝐵 · 𝑙ˆ|, there is a separation and hence no collision.

avoided by using the absolute value of the projections, which results in the separation equation
 
𝑠 = |d𝐴𝐵 · 𝑙ˆ| − |h𝐴 · 𝑙ˆ| + |h𝐵 · 𝑙ˆ| . (86)
If an axis can be found such that 𝑠 > 0, then there is no intersection and thus there is no need
to continue. Otherwise, if 𝑠 ≤ 0 for all SAT tests, then an overlap exists and a contact will be
generated.
The next step in OBB-OBB intersection requires determining which of the tests resulted in
the shallowest penetration. For this purpose, specific edge pairs and faces giving a minimum
separation are carefully tracked during the overlap tests. Once the test case has been identified,
there are two cases to consider for computing the contact normal and point: i) an edge-edge
intersection, or ii) a face intersection.
Edge-edge intersection occurs if the shallowest separation is due to a separating plane
computed from an edge-edge pair. In this case, the contact normal is computed as the cross-
product of the edges. That is, for edge eA from body A and edge eB from body B, the contact
normal is computed as
e𝐴 × e𝐵
𝑛ˆ = . (87)
∥eA × eB ∥
Note that here we use that convention that edges are vectors between edge vertices. The
normal is computed assuming all edge vertices are expressed in the global coordinate system,
and otherwise the normal must be rotated from the local coordinate system. Only a single
contact point is generated for an edge intersection. The contact point is computed by finding
the closest points on each edge, such that
p𝐴, p𝐵 ← ClosestPoints (e𝐴, e𝐵 ) .

46
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Finally, the penetration is then computed as the distance between the closest edge points:
𝜙 = −∥p𝐴 − p𝐵 ∥
Alternatively, the contact point may be computed as the midpoint of the overlapping region:
1
p = (p𝐴 + p𝐵 )
2
Face intersection occurs between a face of one box and a combination of geometrical features
from the other box (vertices, edges, or faces). However, rather than a single contact point, a face
intersection can generate up to eight contacts depending on the configuration of the bodies.
The first step in this case is to determine which of the faces, from either box, resulted in the
shallowest penetration. This can be done efficiently by carefully tracking the separation values
during the SAT tests and choosing the face that maximizes 𝑠, assuming that all tests return a
negative separation. The responsible face is denoted as the reference face, and so it remains to
determine the incident face on the other box that intersects it. Without loss of generality, let
us assume that the reference face belongs to box A. The incident face 𝑓 is found by searching
the faces of box B for the one that most opposes the reference face. This is achieved by finding
the face on box B whose normal 𝑛ˆ 𝑓 minimizes the dot product with the reference face normal,
𝑛ˆ ref , such that
𝑓 = arg min 𝑛ˆ𝑖 · 𝑛ˆ ref ,
𝑖∈𝐹 B
where 𝐹 B are the faces of the box from body B. The incident face is then clipped to the sides
of the reference plane using a polygon clipping algorithm (such as the Sutherland-Hodgman
algorithm [Sutherland and Hodgman 1974]). For this purpose, a transformation of box B into
the local coordinate system of box A is recommended, since in this reference frame the clipping
planes are all axis aligned. Each clipped edge vertex on the incident face that lies below the
reference face plane generates a contact. A 2D example is shown in Figure 13.
The normal for each generated contact 𝑗 is the normal of the reference face:
𝑛ˆ 𝑗 = 𝑛ˆ ref
The contact point is found by projecting the clipped edge vertices onto the reference plane,
but only for those edges that intersect the plane. Recall that if clipping occurs in the local
coordinate frame of the reference box, then projection simply requires changing one of the
coordinates of the clipped edge vertex to match the position of the reference face. For example,
if the reference face normal is +𝑦 from box A, then for clipped edge vertex x̄, the vertex
projected onto the reference face has position
 𝑇
p = x̄𝑥 hA,𝑦 x̄𝑧 ,
where the 𝑦 coordinate is assigned h𝑦 from the half-width extend vector of box A. The
penetration is then computed as the projection distance, which for the +𝑦 face is:
𝜙 = −| x̄𝑦 − h𝑦 | .

47
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

𝑛
reference face 𝑦

𝐩 𝐩
incident
𝐱
face
𝐱
𝑛

clip plane 𝑥 clip plane 𝑥

Fig. 13. Generation of contacts for OBB-OBB face intersection. This 2D example shows a collision
between an edge of the grey box and the +𝑦 face of the blue box. The edge vertices are clipped to the
extents of the reference plane, and the clipped vertices are then projected to the reference plane to
generate the contact points p1 and p2 .

2.2 Mesh-based Representations


In computer graphics, objects are often represented by polygonal meshes and in particular
triangle meshes are very popular for representing the shape of objects. This section briefly
presents how to compute contact points for such representations.
In practical implementations, mesh-based contact generation is done in several stages. In a
first stage, a broad phase collision detection method determines triangles that are sufficiently
close and which pair-wise triangles need further processing. Often, bounding volume hierar-
chies or spatial hashing are the common tools applied in this stage. For the remainder of our
discussion on mesh-based contact generation, we assume that these initial stages have been
completed and instead focus on how the actual contact points are generated.
For the mesh-based contact point generation the positions and normals are defined directly
from mesh features such as vertices (𝑉 ), edges (𝐸) or faces (𝐹 ) of the mesh surfaces. For instance,
pA and pB can be computed as intersection points of mesh features, or from closest points
between mesh features. As we saw with box-box collisions, normals can be computed from
a face normal or as a cross product of two edge vectors. Hence, the types of mesh features
are often associated with the contact point and used to classify the type of the contact point.
For instance, one may write a contact as (𝑉 , 𝐹 ) or (𝐸, 𝐸) to identify a vertex-face generated
contact point or edge-edge generated contact point, respectively.

48
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

𝐸, 𝐸

𝑉, 𝐹

Fig. 14. Corner points of polygonal contact areas can be represented by pairs for mesh features. The
vertex-face (𝑉 , 𝐹 ) and edge-edge (𝐸, 𝐸) combinations forms a sufficient set of pair-types.

The illustration in Figure 14 on the right shows the concept of feature pairs. The blue contact
points are defined by intersection points of mesh vertices, edges and faces from the two objects
A and B. The drawing has two contact points of type (𝑉 , 𝐹 ) and two contact points of type
(𝐸, 𝐸). There is a total of six possible types. They are rarely all used as some of them can
be considered sub-types of each other. For instance, a (𝐹, 𝐹 ) type can be broken down into
multiple (𝑉 , 𝐹 ) type contact points. Associating the mesh features with a contact point has the
benefit of being able to track a contact point over time simply by using labels of features and
objects. Feature labels are convenient to test for redundancy without having to use floating
point comparisons.
Figure 14 illustrates the ideal case where there is no penetration or separation between
the two objects; they are simply touching. However, due to the nature of the discrete time
stepping scheme we introduced earlier in Section 1, it is expected that objects will be slightly
separated or that penetrations will exist. Hence, it becomes tricky to define what constitutes a
contact point. In many practical implementations, it is common to simply take mean positions
of closest points between vertex and face pairs or between edge and edge pairs. The distance
between closest points is then used as a measure of penetration.

2.2.1 Continuous Collision Detection of Mesh Features. Rather than dealing with the difficulties
that arise from using a discrete collision detection scheme, a more intelligent approach is to
use continuous collision detection (CCD). This type of method processes every collision event
that might occur for a given time span (i.e., a time-step). There are two flavors of continuous
collision detection: (i) look forward in time, from the current instance of invocation to the

49
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

next expected instance, or (ii) look backward in time, from the current instance of invocation
to the previous instance.
The initial stages of CCD often use a time-swept volume around the geometric features of
the mesh-based objects. If the volumes intersect, then a more detailed computation is initiated
to find the time of first contact, at which point one can simply compute normals and contact
points as outlined above.
The CCD can be used in the discrete time-stepping method in many ways. The smallest
computed time-of-impact can be used as a limit on how big a time-step one can use. Alterna-
tively, one can take the CCD computed normals and points and warp them to the start of the
time-step. In the case of the latter, a heuristic is required to measure the penetration depth of
an earlier instant.
When looking backward in time we are actually seeking the first point of contact. This point
in space is attractive for simulation methods, since it implies the point in time to which we
should “rewind” the simulation in order to avoid penetration. Let us dig a bit deeper into how
to predict this point using geometric features of the mesh.
Assuming that the time-step is small, it is justifiable that the motion between two instances of
time may be considered linear. However, the errors based on this assumption increase with the
size of the time-step, or O (ℎ). From a convergence theory point of view, we can simply let the
time-step go to zero and the approximation would be exact. In practice, this is impossible, but
the error can be made so small that it is negligible compared to errors coming from numerical
inaccuracies and round off. Other assumptions about the motion can sometimes be made, such
that it is a screw motion, which is commonly done for rigid bodies and can allow for larger
time-steps in practice. However, we limit the assumption to linear motion for small time-steps
since the method we outline should be sufficiently general to work for both rigid and soft
bodies.
We can compute the space swept by a single triangle over the time-step. Consider that the
three vertices of a triangle move with velocities u0 , u1 , and u2 . Then, for a forward prediction
scheme and based on the linear motion assumption, the triangle will have candidate positions
at the next time step given by

x′0 = x0 + ℎu0, (88a)


x′1 = x1 + ℎu1, (88b)
x′2 = x2 + ℎu2 . (88c)

However, for a backward prediction scheme, the candidate positions would be

x′0 = x0 − ℎu0, (89a)


x′1 = x1 − ℎu1, (89b)
x′2 = x2 − ℎu2 . (89c)

50
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

In the case of backward prediction, we know the exact candidate position without having to
compute them as above. Instead, the linear velocity may be computed as
x0 − x′0
u0 = , (90a)

x1 − x′1
u1 = , (90b)

x2 − x′2
u2 = . (90c)

A simple preliminary test would be to create two axis aligned bounding boxes (AABBs) that
enclose the triangles– one using the current positions and the other using the candidate
positions– and test them for overlap. Only if the bounding boxes overlap can there be a contact
that occurred between the mesh features during the interval ℎ.
The next step is to examine all possible contact types for the triangle pair. Specifically, (𝑉 , 𝐹 )
and (𝐸, 𝐸) contacts. In some approaches, like the ones based on bounding volume hierarchies,
the triangle pairs are split into sub-types. Whereas for other approaches, like spatial hashing,
they work directly with the mesh feature pairs.
Due to our assumption of linear motion over the time interval, ℎ, the time of contact is
characterized by either: (i) the vertex lying in the face plane in the case of a (𝑉 , 𝐹 ) contact, or
(ii) by two edges being co-planar in the case of an (𝐸, 𝐸) contact. Regardless of the case, we
seek a point in time where four points all lie in the same plane.
2.2.2 Continuous Collision Detection of Face-Vertex Pair. The idea is to use three points to
compute a plane normal, and then use one of the three points to find a distance between
the plane and the origin. Finally, the fourth point is used for a point in the plane test. For
convenience, in the case of the (𝑉 , 𝐹 ), let us label the points of the triangle in counterclockwise
order: x1 , x2 , and x3 and the point of the vertex x4 . In the case of an (𝐸, 𝐸) type, we label the
end-points of the first edge x1 and x2 , and the end-points of the second edge x3 and x4 . The
corresponding velocities are in both cases labeled u1 , u2 , u3 , and u4 . Now we’ll set up two
vectors x2 − x1 and x3 − x1 , and take the cross product of these two to obtain a plane normal
𝑛ˆ = (x2 − x1 ) × (x3 − x1 ) . (91)
The point x1 must lie in the plane, so the distance, 𝑑, to the origin is given by
𝑑 = 𝑛ˆ · x1 . (92)
In order for the last point to lie in the plane, then its distance to the plane must be zero, that is,
𝑛ˆ · x4 − 𝑑 = 0 . (93)
Substitution leads to
((x2 − x1 ) × (x3 − x1 )) · (x4 − x1 ) = 0. (94)

51
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Whenever this equation is fulfilled, the four points will lie in the same plane. The last thing to
consider is the motion of the points whose positions change with time, such that

((x2 (𝑡) − x1 (𝑡)) × (x3 (𝑡) − x1 (𝑡))) · (x4 (𝑡) − x1 (𝑡)) = 0 . (95)

Here, the objective is to determine the smallest non-negative value 𝑡 < ℎ that makes the above
equation true. From the linear motion assumption, the trajectory of each point may be written
as

x1 (𝑡) = x1 + u1𝑡, (96a)


x2 (𝑡) = x2 + u2𝑡, (96b)
x3 (𝑡) = x3 + u3𝑡, (96c)
x4 (𝑡) = x4 + u4𝑡 , (96d)

and by substitution we obtain

(((x2 − x1 ) + (u2 − u1 ) 𝑡) × ((x3 − x1 ) + (u3 − u1 ) 𝑡)) · ((x4 − x1 ) + (u4 − u1 ) 𝑡) = 0 . (97)

This is a cubic polynomial in 𝑡 with an analytical solution. Once the three roots are found, the
positions of the vertices can also be found at the specific values of 𝑡.
Having found the points in time where the four points are co-planar, we will finally compute
the candidate for the contact point p = x4 + u4𝑡, if this point is inside the triangle face at the
time of contact then a contact point is reported with position p, normal n = (x2 (𝑡) − x1 (𝑡)) ×
(x3 (𝑡) − x1 (𝑡)) and penetration depth of 𝜙 = 0. In most simulation approaches the state will
be reset to the earliest point in time where a collision is found hence the penetration depth
will always be zero.
2.2.3 Continuous Collision Detection of Edge-Edge Pair. As in the (𝑉 , 𝐹 ) case, the (𝐸, 𝐸) case
requires finding the roots of a polynomial equation, and then examining the geometries in
ascending temporal order. For simplicity, let x1 , x2 , x3 , and x4 denote the edge geometry
positions at the instant in time corresponding to a root. First, we test whether the edges are
parallel. This is the case when

(x2 − x1 ) × (x4 − x3 ) = 0 . (98)

In practice, an equality test will not work, so we use a threshold test instead. If the test succeeds,
then a dimension reduction technique can be used by projecting the vertices of one edge onto
the line running through the edge. However, one could also simply drop this case, since if
a touching contact exists, it could just as well be represented by two (𝑉 , 𝐹 ) type contacts.
Therefore, we will only consider the case where the two edges are touching at exactly one
point.

52
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Parameterization of the two edges with the 𝑎 and 𝑏 parameters, yields


x1 + 𝑎 (x2 − x1 ) , (99a)
x3 + 𝑏 (x4 − x3 ) . (99b)
The touching point between the two lines must also be the closest point, and the closest point
is characterized by the minimum distance, so we seek the values of 𝑎 and 𝑏 that minimizes
∥ (x1 + 𝑎 (x2 − x1 )) − (x3 + 𝑏 (x4 − x3 )) ∥ 2 . (100)
Taking the derivative with respect to 𝑎 and 𝑏 yields the so-called normal equations:
    
(x2 − x1 ) · (x2 − x1 ) − (x2 − x1 ) · (x4 − x3 ) 𝑎 (x2 − x1 ) · (x3 − x1 )
= . (101)
− (x2 − x1 ) · (x4 − x3 ) (x4 − x3 ) · (x4 − x3 ) 𝑏 − (x4 − x3 ) · (x3 − x1 )
Solving for 𝑎 and 𝑏 computes the closest points between the two lines running through the
two edges. If 𝑎 and 𝑏 both are both in the range [0, 1], then a contact point can be reported at
location p = (x1 − x3 ) + 𝑎 (x2 − x1 ) − 𝑏 (x4 − x3 ). The normal will be given by the edge cross
products similar to Section 2.1.3. Except here we are using CCD so the penetration depth is
trivially zero.
2.2.4 Multivariate Style of Continuous Collision Detection. Alternatively, the CCD functional
can be expressed in a multivariate form [Brochu et al. 2012; Wang et al. 2021]. For the (𝑉 , 𝐹 )
case, this is
((1 − 𝑢 − 𝑣)x1 (𝑡) + 𝑢x2 (𝑡) + 𝑣x3 (𝑡)) − x4 (𝑡) = 0 , (102)
where 𝑢 and 𝑣 are the Barycentric coordinates of the triangle and a domain of 𝑡 ∈ [0, ℎ] and
𝑢 ≥ 0, 𝑣 ≥ 0, and 𝑢 + 𝑣 ≤ 1. Similarly, for the (𝐸, 𝐸) case, the multivariate form is
(x1 (𝑡) + 𝑎(x2 (𝑡) − x1 (𝑡))) − (x3 (𝑡) + 𝑏 (x4 (𝑡) − x3 (𝑡))) = 0 , (103)

with a domain of 𝑡 ∈ [0, ℎ] and 𝑎, 𝑏 ∈ [0, 1]. In both cases, these functions map from R3 ↦→ R3
and involve root-finding with a system of three quadratic equations. Geometrically, this is
equivalent to determining if the origin is contained inside the co-domain of the function.
The advantage of this form is that it eliminates the need to do post check on the computed
solution. These checks are particularly problematic in degenerate cases where the univariate
formulation has infinite roots. The disadvantage of this form is that it requires finding the
roots of a multivariate equation, which is more challenging and time consuming than solving
a univariate equation.
2.2.5 Tight-Inclusion. Wang et al. [2021] introduce a method for solving the system of equa-
tions using inclusion-based root-finding [Redon et al. 2002; Snyder 1992]. From a one dimen-
sional interval 𝑖 = [𝑎, 𝑏], we can define an 𝑛-dimensional interval as 𝐼 = 𝑖 1 × · · · × 𝑖𝑛 , where 𝑖𝑘

53
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

are intervals. The width of an interval is defined as 𝑤 ([𝑎, 𝑏]) = 𝑏 − 𝑎. Similarly, the width of
an 𝑛-dimensional interval is
𝑤 (𝐼 ) = max 𝑤 (𝑖𝑘 ).
𝑘={1,...,𝑛}
Given an 𝑚-dimensional interval 𝐷 and a continuous function 𝑔 : R𝑚 ↦→ R𝑛 , an inclusion
function for 𝑔, written □𝑔, is a function such that
∀𝑥 ∈ 𝐷 𝑔(𝑥) ∈ □𝑔(𝐷) .
In other words, □𝑔(𝐷) is a 𝑛-dimensional interval bounding the range of 𝑔 evaluated over
an 𝑚-dimensional interval 𝐷 bounding its domain. We call the inclusion function □𝑔 of a
continuous function 𝑔 convergent if, for an interval 𝑋 , we have
𝑤 (𝑋 ) → 0 =⇒ 𝑤


𝑔(𝑋 ) → 0 .
Data: 𝐼 0, 𝑔, 𝛿
Result: res
1 res ← ∅;
2 𝑆 ← {𝐼 0 };
3 while 𝑆 ≠ ∅ do
4 𝐼 ← pop(𝑆);
5 𝐼𝑔 ← □𝑔(𝐼 );
6 if 0 ∈ 𝐼𝑔 then
7 if 𝑤 (𝐼 ) < 𝛿 then
8 res ← res ∪ 𝐼 ;
9 else
10 𝐼 1, 𝐼 2 ← split(𝐼 );
11 𝑆 ← 𝑆 ∪ {𝐼 1, 𝐼 2 };
12 end
13 end
14 end
Algorithm 1: Bisection Inclusion-based Root-finding
Using an convergent inclusion function, Snyder [1992] show how to define a simple inclusion-
based root-finding method using bisection as outlined in Algorithm 1. This amounts to
evaluating the inclusion function and determining if the origin is contained in the inclusion
function. If it is either split the domain interval and repeating the process on each sub interval
or terminating when the domain is sufficiently small. If the origin is not contained and there
are no other sub-intervals to evaluate then we can be sure the function does not have a root in
the initial domain provided.
In general, building these inclusion functions can be done by using interval arithmetic [Snyder
1992]. For our particular functions (Equation 102 and Equation 103), Wang et al. [2021] propose

54
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

a closed form inclusion function. Which is to construct a bounding box around the corner
vertices of the codomain.
2.2.6 Implementation Notes. The above methods assume the computation is done under
infinite precision (i.e., real numbers) in order to provide an exact time of impact. However,
when computed using floating-point numbers, numerical error and round-off can result in
missing true collisions (false negative) and detecting false collisions (false positive). To address
these inaccuracies, both Brochu et al. [2012] and Tang et al. [2014] propose “exact” methods
for CCD. That is, they claim their methods are robust to numerical error and produce zero
false positives and false negatives.
Brochu et al. [2012] propose a geometric approach to solving the problem. At a high level,
they take the multivariate formulations (Equation 102 and Equation 103) and, in order to
determine if the origin is contained within the co-domain, they shoot rays from the origin
outwards. Wang et al. [2022] improved upon this by both fixing some degenerate-cases are
handled and proposing a approach that is able to use floating-point computation directly
instead of having to rely on expensive
Tang et al. [2014] instead propose an algebraic method in which they decompose the cubic
polynomial given by the univariate formulations (Equation 97 and Equation 98) into quadratic
and linear functions. They then use sign classification of the coefficient of these functions to
determine if there exists a root in the time interval.
Unfortunately, as Wang et al. [2021] showed, each of these methods can produce false
positives and false negatives. While not providing an exact method, Wang et al. [2021] (as
we outlined above) propose a conservative method that avoids false negatives at the cost of
potential false positives. This area of exact CCD remains an open problem.

2.3 Signed Distance Fields


Signed distance fields (SDFs) represent the shape of an object by an implicit function 𝑠 (x) :
R3 → R. Unlike mesh-based representations, which use explicit geometry, SDFs give the
signed distance of some point x from the surface of an object. The sign (positive or negative)
indicates whether the point lies outside or inside of the object. Specifically, points interior to
the shape have 𝑠 (x) < 0, whereas exterior points have 𝑠 (x) > 0, and points on the surface
satisfy 𝑠 (x) = 0. For example, the SDF of a circle is shown on the left side of Figure 15, and
different colors are used to draw regions with positive and negative distances and the zero-level
isosurface.
In this section, we present some details about performing collision detection and generating
contacts using SDFs. Specifically, we show how polygonal meshes can be tested for intersection
using SDFs. This offers an alternative to the mesh-mesh based collision detection outlined in
Section 2.2, since it is straightforward to generate an SDF from a polygon mesh that can then
be used for efficient collision detection. However, we do not cover how to generate SDFs, and
instead refer the reader to related work on this topic [Jones et al. 2006].

55
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

∇𝑠 𝐱
𝐱
𝐱
𝑠 𝐱

Fig. 15. Left: a 2D example showing the SDF of a circle. Locations with positive distances are drawn
in light grey, whereas negative distances are drawn in light blue; the zero-level isosurface is draw
in black. Right: the same SDF stored on a 4 × 4 grid. The signed distance 𝑠 (x) and gradient ∇𝑠 (x)
may be computed from adjacent grid cells (i.e., using bilinear interpolation). The grid resolution can
be increased to improve the approximated shape and recover finer scale details, but at the cost of
increased complexity.

In addition to computing a scalar field of signed distances, is it also common to compute


its gradient, ∇𝑠 (x) ∈ R3 . Observe that the gradient function returns a 3D vector that gives
direction of the closest point on the surface from x. A desirable property of the gradient
function is that the returned vector is unit length, such that
∥∇𝑠 (x)∥ = 1 .
Therefore, ∇𝑠 (x) gives the vector field of outward facing unit normal vectors. However, this
property of the field may not always be true, for instance if the closet point is not unique
(e.g., the center of a sphere), but in practice the gradient function can be constructed so as to
preserve this property.
2.3.1 SDF-Point Intersection. The canonical intersection test using an SDF is with a point. The
first step is to determine if 𝑠 (x) ≤ 0 is true, which means that either x is an interior point or
touching the surface. If true, the gap function 𝜙 is simply the signed distance provided by the
field function:
𝜙 = 𝑠 (x) (104)
Next, let us consider how to compute the contact normal. Generally speaking, the normal is
given by the forcing direction that will most quickly move x outside the field. This is in fact
the gradient evaluated at x, and so the contact normal may be computed as:
𝑛ˆ = ∇𝑠 (x)𝑇 (105)

56
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Note again that special care should be taken to orient the normal based on the convention
used by the collision system (e.g., from the first body toward the second body).
Finally, there are two obvious choices for computing the contact position. One option is to
situate the contact point p at the surface of the SDF, which is computed by projecting x along
the gradient:
p = x − ∇𝑠 (x)𝑇 𝑠 (x) (106)
Conversely, the query point may be used, such that

p = x. (107)
2.3.2 SDF-Mesh Intersection. Generating a contact for the SDF and point intersection provides
a useful building block for collision with more complex geometries, such as polygonal meshes.
Collision detection between meshes can be computationally costly, as we saw in Section 2.2.
However, a common use case of SDFs is accelerating mesh-mesh collision detection by
computing a signed distance field for each mesh and then performing approximate intersection
tests using the SDF of one object versus the mesh of the other. Luckily, there are robust methods
for building an SDF from arbitrary polygonal soups [Xu and Barbič 2014].
In Section 2.3.1, we saw that it is straightforward to generate contacts for the case of a
point intersecting an SDF. This naturally leads to an intersection test with a polygonal mesh,
whereby each vertex x ∈ 𝑉 is tested. Let us assume that we want to test a vertex from the
mesh of body B with the signed distance field of body A. The first step is to transform vertex v
into the local coordinate system of body A, since it is often more efficient to transform the
mesh vertices into the field coordinate frame, rather than the other way around. A local vertex
position is computed, such that

xlocal = RA−1 (RB (x + cB ) − cA ) , (108)

where cA ∈ R3 , RA ∈ 𝑆𝑂 (3) and cB ∈ R3 , RB ∈ 𝑆𝑂 (3) are the positions and rotation matrices
of bodies A and B respectively. Then, if 𝑠 (xlocal ) < 0, an intersection exists and Equation 104-
Equation 107 may be used to generate the depth, contact normal and position. This process is
summarized in Algorithm 2.
However, testing only against the vertices of the polygonal mesh can lead to missed collisions
and other artifacts. For instance, this is likely if the mesh geometry is coarse and the SDF
surface contains thin features. These issues can be mitigated by adding more vertices to the
mesh, although theoretically this will never fully eliminate penetration artifacts and may also
impact performance.
Recently, Macklin et al. [2020a] proposed a refinement technique to compute exact collision
between SDFs and polygonal meshes. Rather than considering each vertex of the mesh, each
face is considered. Assuming a triangle mesh, each face is defined by vertices x1, x2, x3 ∈ R3 . A
point on the interior or boundary of the face can be described by its barycentric coordinates

57
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Input: mesh 𝐹, 𝑉 , SDF 𝑠, gradient field ∇𝑠


Result: List of contacts C
1 ∀x ∈ 𝑉
2 compute xlocal by transforming x (Equation 108)
3 if 𝑠 (xlocal ) < 0 then
4 𝜙 = 𝑠 (xlocal )
5 𝑛ˆ = ∇𝑠 (xlocal )𝑇
6 p=x
7 transform 𝑛ˆ and p to world coordinates
8 C ← C ∪ {𝑛, ˆ p, 𝜙 }
9 end
Algorithm 2: SDF-Mesh contact generation

𝑢, 𝑣, 𝑤, such that
x(𝑢, 𝑣, 𝑤) = 𝑢x1 + 𝑣x2 + 𝑤x3 , (109a)
subject to 𝑢, 𝑣, 𝑤 ≥ 0 , (109b)
𝑢 +𝑣 +𝑤 = 1. (109c)
The closest point on the face can then be found by a minimization over the barycentric
coordinates:
arg min 𝑠 (𝑢x1 + 𝑣x2 + 𝑤x3 ) (110)
𝑢,𝑣,𝑤
The minimization in Equation 110 is a non-linear optimization problem, and thus requires an
iterative approach. For instance, a projected gradient descent method. However, this requires
computing the derivative of the distance field at each candidate solution with respect to the
barycentric coordinates, which is
 𝜕s  ∇𝑠 (x)x1 
 𝜕𝑢   
𝜕s 
d =  𝜕𝑣 = ∇𝑠 (x)x2  .
  
 𝜕s  ∇𝑠 (x)x3 
 𝜕𝑤   
At the 𝑘th iteration of the gradient descent algorithm, the candidate solution to Equation 110
is then updated by a fixed-point iteration, such that
x (𝑘+1) ← ProjBarycentric(x (𝑘) ) − 𝛼d .
Here, 𝛼 is a fixed step size and ProjBarycentric projects the solution 𝑢, 𝑣, 𝑤 to the manifold
defined by Equation 109b-Equation 109c. After the solver terminates, if 𝑠 (x(𝑢, 𝑣, 𝑤)) < 0 then
a contact is generated.

58
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

2.3.3 Implementation Notes. In practice, an SDF is often represented by a discrete data


structure, such as a dense or sparse voxel grid. Each grid cell (𝑖, 𝑗, 𝑘) stores the signed distance,
and thus 𝑠 (x) is computed by first identifying the grid cell containing x and then performing
an interpolation using the neighboring grid cells (see the right side of Figure 15). In the case
of the gradient, ∇𝑠 (x), it may be computed on-demand using finite differences, by analytic
gradients, or precomputed and stored alongside distance values on the grid.
The grid cell size will have an effect on the quality of the collision detection, and often the
grid cell size is determined based on the smallest features of the source geometry. However,
this may result in heavy memory consumption if a uniform grid is used to store complex
surfaces. Frisken et al. [2000] proposed an adaptive SDF to address this problem, where an
octree subdivision is used to recursively refine the grid until the interpolated field values
closely match the original surface. Similarly, Koschier et al. [2016] improved the accuracy of
SDFs for complex geometry by adaptively refining the resolution of the grid, as well as the
polynomial degree used to represent local field details.
It is trivial to extend the contact generation techniques presented in this section to analytical
shapes, such as spheres. However, in the case that the field is stored using a discrete grid, it is
important that the grid is extended by a margin around the zero-level isosurface of the source
geometry to avoid discontinuities and ensure that valid field data exists for possible query
points.

59
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

3 NUMERICAL METHODS
In this section, we present a collection of numerical methods for solving the frictional contact
problems. These can be roughly classified into two general approaches: i) pivoting methods
and ii) iterative methods. Pivoting methods focus on determining a labeling of variables
based on the complementarity conditions. Once the labeling is known, an exact solution
to the complementarity problem may be computed if a direct solver is used to solve the
resulting subproblem. Conversely, iterative methods make incremental progress toward the
exact solution, with better approximations being obtained at each iteration. Additionally, there
are hybrid approaches that combine these schemes.
The fundamental goal of applying these numerical methods is to solve for the constraint
impulses 𝜆, while also ensuring that the feasibility and complementarity conditions of the
various contact models are met. However, some of the frictional contact models from Section 1
require computing other parameters that are important for producing the correct behavior,
such as the slack 𝛽 parameter used by the polyhedral LCP. Therefore, we depart from earlier
convention and now use x to denote the vector of unknowns that is computed by each numerical
method, rather than just the constraint impulses 𝝀.
We have chosen to cover the topic of proximal operators as these are a quite general and
powerful framework for expression the contact physics as well as with ease provide a simple
way to derive numerical methods. Our treatment is extensive and show many facets of how to
use proximal operators in a simulator.
Table 2 gives a high level classification road map of the methods we cover in this chapter. We
cover methods for a wide range of models. One would often have to first decide upon which
model to use in a simulator before carefully picking the numerical method. When choosing
the numerical method it is often trade offs in terms of performance, accuracy and robustness
that must be considered. The application context often dictates which trade offs that can
be acceptable. For instance, in a gaming context accuracy may not be necessary, but high
performance and robustness would be extremely important, in digital prototyping high fidelity
may be more of a concern and hence accuracy may out weight performance considerations.
Many methods and ideas can be used in combination as well to create hybrid methods. We
will not cover this aspect in these course notes. In general there is not a single one method
that is better than all the rest. The right choice really depends on the modeling needs and the
context at hand.

3.1 Pivoting Methods


Pivoting methods exploit the combinatorial nature of complementarity problems to find a
labeling of the variables based on the complementarity and feasibility conditions imposed by
the model. With this labeling, which is sometimes referred to as the index set, it is possible to
identify constraint variables as being free or tight, and the latter case is further decomposed
into tight lower and tight upper variables. This labeling permits a partitioning of a linear system

60
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Table 2. This table presents an overview of the main numerical methods covered in this chapter as
well as a summary of some their traits.

Model Methods Benefits Disadvantages Sec.


(B)LCP Incremental High accuracy and Computational expensive. 3.1,
Pivoting, Block supports large mass ratios. 3.1.2,
Principal 3.1.3.
Pivoting.
(B)LCP Splitting Methods: Fast performance and very Inaccurate and poor large 3.2,
Projected Jacobi, robust. mass ratio handling, linear 3.2.1.
Gauss-Seidel convergence rate.
(PGS), Successive-
Over-Relaxation
(PSOR).
(B)LCP Staggering. Converts LCP into two No convergence proof 3.2.5.
simpler coupled quadratic exist.
programming (QP)
problems.
(B)LCP Subspace- Improved accuracy of Solving linear subsystem 3.2.6.
Minimization. active contacts. can be expensive.
(B)LCP Non-Smooth Improved accuracy at two May need many iterations 3.2.7.
Nonlinear times cost of PGS and before benefit kicks in, and
Conjugate better handling of large may not improve over PGS
Gradient. mass ratios. in all cases.
NCP Non-Smooth Quadratic convergence rate Assembling and solving a 3.3.
Newton Method. and support for nonlinear linear sub-system in every
friction models. Newton iteration can be
computational expensive.
Proximal PROX Gauss- Supports exact Difficult to select 3.4.
opera- Seidel and PROX regularization, strong regularization parameter
tor Jacobi methods. convergence guarantee, values.
and supports nonlinear
friction models. Can
achieve super-linear
convergence rate.

61
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

based on the index set. For instance,


 AF,F AF,L AF,U   xF   bF   vF 

 AL,F AL,L AL,U   xL  +  bL  =  vL  , (111)
      
      
AU,F AU,L AU,U  xU  bU  vU 

where F is the set of free variables, L is the set of tight lower variables, and U is the set of tight
upper variables. Each sub-block of A in Equation 111 thus corresponds to selecting rows and
columns of the lead matrix that correspond to the rows and columns of each set. For instance,
AF,L contains row indices from F and column indices from L. The rows of vectors b, x, and v
may be similarly partitioned according to the index set labels.
For contact problems, the index set of each variable is determined by inspection of each 𝑣𝑖
and 𝑥𝑖 . Variables in 𝑖 ∈ F are those for which the value of x𝑖 is not restricted by the feasibility
condition of the constraint (e.g., the lower and upper bounds). Whereas tight variables 𝑖 ∈ L∪U
have a value which is determined by the feasibility conditions.1
To better understand how this partitioning works, let us consider the BLCP formulation,
where x = 𝝀 are the constraint impulses. From Equation 41, we can define the index sets based
on the feasibility and complementarity conditions of the BLCP based on three cases:
{∀𝑖 ∈ F : 𝜆𝑖lo < 𝜆𝑖 < 𝜆𝑖hi and 𝑣𝑖 = 0} , (112a)
{∀𝑖 ∈ L : 𝜆𝑖 = 𝜆𝑖lo and 𝑣𝑖 > 0} , (112b)
{∀𝑖 ∈ U : 𝜆𝑖 = 𝜆𝑖hi and 𝑣𝑖 < 0} . (112c)
For non-interpenetration constraints, which are only lower bounded, this labeling implies that

𝑖 ∈ F ⇒ 𝜆𝑖 > 0 and 𝑣𝑖 = 0 , (113a)


𝑖 ∈ L ⇒ 𝜆𝑖 = 0 and 𝑣𝑖 > 0 . (113b)
Whereas for frictional constraints with box limits, the free and tight labels imply that
{𝑖 ∈ F ⇒ −𝜇𝜆𝑛ˆ < 𝜆𝑖 < 𝜇𝜆𝑛ˆ and 𝑣𝑖 = 0} , (114a)
{𝑖 ∈ L ⇒ 𝜆𝑖 = −𝜇𝜆𝑛ˆ and 𝑣𝑖 > 0} , (114b)
{𝑖 ∈ U ⇒ 𝜆𝑖 = +𝜇𝜆𝑛ˆ and 𝑣𝑖 < 0} , (114c)
where 𝜆𝑛ˆ is the non-interpenetration impulse corresponding to frictional impulse 𝜆𝑖 .
Extending the conditions in Equations 112a-112c to the general case, we observe that the
residual velocity is zero for all variables in the free set. That is,
∀𝑖 ∈ F : 𝑣𝑖 = 0 .
1 The variables our contact models are mostly limited by inequality conditions. So, “tight” describes a variable
that is directly against the hyperplane defining an inequality constraint, whereas “free” variables are not and
they have some room on all sides.

62
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Furthermore, we note that the value of tight variables is determined by a boundary condition
(i.e., they are known). This allows us to simplify Equation 111 to a version that involves only
the unknown free variables:

AF,F xF = −bF − AF,L xlo hi


L − AF,U xU (115)

Hence, computing xF simply requires solving an unconstrained linear system. The objective
of pivoting methods is therefore to correctly determine the index set of constraint variables
that solves the complementarity problem. Essentially, a solution is found by "guessing" an
index set for the constraint variables and then confirming that a candidate solution is correct
with respect to the complementarity and feasibility conditions. We note that a brute force
approach for determining the correct index set would be inefficient since it requires guessing
2𝑚 possibilities for an 𝑚 variables system. Rather, most pivoting methods use a systematic
approach to change the index set of individual variables. In the next sections, we will explore
some popular algorithms that use various strategies to pivot variables between the free and
tight sets to find a solution.

3.1.1 Incremental Pivoting. Lemke’s algorithm [Lloyd 2005] is a well-known pivoting method
that incrementally pivots variables between the tight and free set in order to find a basis that
solves the LCP. The simplex method proposed by Cottle and Dantzig [Cottle 1968] has likewise
been used to find the index set. Baraff [Baraff 1994] used an incremental pivoting approach
based on Dantzig’s algorithm to solve for contact forces. Their method incrementally computes
a solution by making change to the index sets while keeping the complementarity constraints
as invariants. We consider the case of solving a traditional LCP with the index sets following
Equation 113.
The algorithm begins with sets F and L empty; set U is ignored. It is presumed that, at
each pivoting step, the complementarity conditions of all previously processed variables are
maintained. The algorithm proceeds at each step by selecting the candidate variable with index
𝑗 from the unprocessed set P that minimizes 𝑣 𝑗 ∈ R, since this corresponds to an index with
the most violated complementarity condition. At the 𝑘 th iteration, the following partitioning
of the system is used:

v𝑘  AF,F AF,L AF,𝑗  x𝑘  bF 


 F    F  
vL  = AF,L AL,L AL,𝑗  x𝑘L  + bL  .
 𝑘  𝑇    
      
𝑣 𝑘   A𝑇 A𝑇 A 𝑗,𝑗   0  𝑏 𝑗 
 𝑗   F,𝑗 L,𝑗    

Initially, it is assumed that 𝑥 𝑗 = 0. Knowing that x𝑘 of the processed indices respects the
complementarity conditions, we focus on computing an update of the variables based on a

63
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

change of the unprocessed variable Δ𝑥 𝑗 , such that


ΔvF  AF,F AF,L AF,𝑗  ΔxF 
    
ΔvL  AF,L AL,L AL,𝑗  ΔxL  .
=
   𝑇  
    
 Δ𝑣 𝑗   A𝑇 A𝑇 A 𝑗,𝑗   Δ𝑥 𝑗 
   F,𝑗 L,𝑗  
The method takes advantage of the invariants vF = 0 and xL = 0, which logically leads to the
assumption that ΔvF = 0 and ΔxL = 0. For a unit increase Δ𝑥 𝑗 = 1, we can write the linear
system as:
 0  AF,F AF,L AF,𝑗  ΔxF 
    
ΔvL  = AF,L AL,L AL,𝑗   0  . (116)
   𝑇  
    
 Δ𝑣 𝑗   A
  F,𝑗 AL,𝑗 A 𝑗,𝑗   1 
𝑇 𝑇  

The first block row of Equation 116 allows us to compute changes in the free variables by
solving
AF,F ΔxF = −AF,𝑗 .
The change in residual velocity of tight variables vL is then given by
ΔvL = A𝑇F,L ΔxF + AL,𝑗 ,
and likewise
Δ𝑣 𝑗 = A𝑇F,𝑗 ΔxF + A 𝑗,𝑗 .
However, we note that our assumptions are valid only if the index set of variables does not
change. For some 𝑖 ∈ F where Δ𝑥𝑖 < 0, it is possible that 𝑥𝑖 will be driven to zero, in which
case 𝑖 should be pivoted from F → L. Similarly, for some 𝑖 ∈ L where Δ𝑣𝑖 < 0, it is possible
the residual velocity 𝑣𝑖 is driven to zero, in which case the variable 𝑖 should be pivoted from
L → F.
Essentially, the idea here is to increase 𝑥 𝑘+1𝑗 as much as possible without breaking the
complementarity or feasibility conditions. At each iteration, it is therefore necessary to compute
a maximum step size 𝛼 up to the point that the index set of one of the variables changes (pivots).
Starting with the unprocessed variable 𝑗, the largest step we can take without forcing 𝑥 𝑘+1 𝑗
negative is
!
−𝑣 𝑘𝑗
𝛼𝑗 = . (117)
Δ𝑣 𝑗
For each 𝑖 ∈ F, if Δ𝑥𝑖 < 0, the minimum step size that can be taken without forcing 𝑥𝑖𝑘+1
negative is
!
−𝑥𝑖𝑘
𝛼 F = min . (118)
𝑖∈F ∧ Δ𝑥𝑖 <0 Δ𝑥𝑖

64
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Finally, for each 𝑖 ∈ L, if Δ𝑣𝑖 < 0, the minimum step size that can be taken without forcing
𝑣𝑖𝑘+1 negative is
!
−𝑣𝑖𝑘
𝛼 L = min . (119)
𝑖∈L ∧ Δ𝑣𝑖 <0 Δ𝑣 𝑖

The step size is computed as 𝛼 = min 𝛼 F, 𝛼 L, 𝛼 𝑗 . The constraint impulses are then increased
h i𝑇
by 𝛼Δx = 𝛼 ΔxF 0 1 , which causes 𝑣 to change by 𝛼Δ𝑣 = A(𝛼Δx). If the blocking
constraint index is not 𝑗, this causes a change in the index set and the variable is pivoted to
maintain the complementarity conditions. The process of updating the constraint variables and
increasing Δ𝑥 𝑗 continues until 𝑣 𝑗 is driven to zero. Pseudo-code for the incremental pivoting
algorithm is provided in Algorithm 3.
3.1.2 Principal Pivoting Methods. Unlike Baraff’s incremental pivoting approach, other pivot-
ing algorithms initialize variables with a specific label. The Bard-type method proposed by
Murty [Murty 1974; Murty and Yu 1988] is one such algorithm, and it uses principal pivots at
each iteration to change the index set whenever a variable at index 𝑖 violates the feasibility or
complementarity conditions.
The algorithm begins with an initial “guess” for the index sets, and at each step the principal
sub-problem in Equation 115 is solved in order to determine xF, and thus vL and vU too. If
a variable violates its feasibility or complimentarity conditions, then the algorithm stops
since the current index set is a solution to the LCP. Otherwise, Murty’s algorithm chooses an
infeasible variable with the smallest index 𝑖 and pivots it into the complementary set. That is,
variables are pivoted according to the rules:


 F ← F − {𝑖} L = L ∪ {𝑖}, if 𝑖 ∈ F and 𝑥𝑖 ≤ 𝑥𝑖lo
 F ← F − {𝑖} U = U ∪ {𝑖}, if 𝑖 ∈ F and 𝑥𝑖 ≥ 𝑥 hi



𝑖 . (120)

 U = U − {𝑖} F ← F ∪ {𝑖}, if 𝑖 ∈ U and 𝑣𝑖 ≥ 0

 L = L − {𝑖} F ← F ∪ {𝑖}, if 𝑖 ∈ L and 𝑣𝑖 ≤ 0


It can be proven that if the lead matrix A ∈ R𝑛×𝑛 is a P-matrix then the system will find
a solution in 𝑛 pivots. However, for degenerate systems, it can be shown that the pivoting
algorithm may lead to cycling, which occurs whenever the same index set is encountered
twice by the pivoting algorithm. Robust implementations of principal pivoting algorithms
often require some way to detect and break cycles.
3.1.3 Block Principal Pivoting. Both the incremental pivoting and the Bard-type algorithm
proceed at each step by updates that are based on a single variable. While single pivoting
schemes have good convergence guarantees, computation times are protracted due to only
changing a single variable at each step. However, in practice, it is often possible to pivot more
than one variable to achieve faster convergence.

65
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: A: The LCP coefficient matrix, b: The right hand side vector.
Result: x: The LCP solution, F,L: The index sets of the free and tight variables.
1 x=0
2 v=b
3 initialize F = L = ∅
4 while ∃𝑗 such that 𝑣 𝑗 < 0 do
5 repeat
6 solve AF,F ΔxF = −AF,𝑗
7 ΔvL = A𝑇F,L ΔxF + AL,𝑗
8 Δ𝑣 𝑗 = A𝑇F,𝑗 ΔxF + A 𝑗,𝑗
9 compute 𝛼 according to Equation 117-Equation 119
10 store blocking constraint index 𝑙
11 xF ← xF + 𝛼ΔxF
12 vL ← vL + 𝛼ΔvL
13 𝜆𝑗 = 𝛼
14 if 𝑙 ∈ F then
15 F ← F − {𝑙 }
16 L ← L ∪ {𝑙 }
17 else if 𝑙 ∈ L then
18 L ← L − {𝑙 }
19 F ← F ∪ {𝑙 }
20 else
21 F ← F ∪ {𝑙 }
22 until 𝑙 = 𝑗;
23 end
Algorithm 3: Incremental pivoting for an LCP.

Judice and Pires [Júdice and Pires 1994] proposed a block version of Murty’s algorithm
whereby all variables in violation of the feasibility or complementarity conditions are pivoted
together at each step, rather than just the least indexed variable. Therefore, at each algorithm
step, a pass over all variables check if any violate the condition, and if so the pivoting
rules in Equation 120 are applied to all variables in violation simultaneously. The algorithm
terminates with success if the index sets between two consecutive pivoting steps do not change.
Pseudocode for the block principal pivoting algorithm is provided in Algorithm 4.
In practice, the BPP algorithm can converge to the correct index set after only a small number
of iterations. However, cycling in the index set can occur even when A is positive definite. In
such cases, one strategy proposed by Judice and Pires [Júdice and Pires 1994] is to temporarily

66
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: 𝑁 : The total number of pivoting steps to perform, A: The coefficient matrix, b:
The right hand side vector.
Result: x: The BLCP solution for all 𝑛 variables, F,L,U: The index sets of the free and
tight variables.
1 initialize F = {1, . . . , 𝑛} , L = ∅ , U = ∅
2 𝑘=1
3 while (𝑘 ≤ 𝑁 and F, L, U changed) do
4 ∀ 𝑖 ∈ L : 𝑥𝑖 ← 𝑥𝑖lo
5 ∀ 𝑖 ∈ U : 𝑥𝑖 ← 𝑥𝑖hi
6 solve AF,F xF = −bF − AF,L xlo hi
L − AF,U xU
7 v = Ax + b
8 update F, L, U according to Equation 120
9 𝑘 =𝑘 +1
10 end
Algorithm 4: Block principal pivoting (BPP) for BLCPs.

revert to a Murty single pivoting scheme by choosing an infeasible variable with the least
index. However, in general, robust implementations of pivoting algorithm require some sort of
cycle breaking strategy.

3.1.4 Implementation Notes. Observe that both the incremental pivoting and the block princi-
pal pivoting methods require a solution involving the linear system AF,F xF . We assume that
A is symmetric positive definite (PD), and therefore A−1 FF exists. However, Baraff reported
that even when A is positive semi-definite (PSD), which is often the case in practice due to
redundant contact constraints, then A−1 F,F could still be computed. Applying the constraint
stabilization techniques presented in Section 1.9 can improve the conditioning of AF,F and
alleviate problems related to degenerate matrices.
In practice, forming and solving the linear system uses a Cholesky decomposition. Baraff
noted that for complex systems, an incremental factorization is preferred for efficiency, although
an implementation is potentially non-trivial. Enzenhoefer et al. [2019] proposed an efficient
version of Judice’s block pivoting algorithm that re-uses an initial factorization of AF,F xF
and downdates the factorization based on indices in L ∪ U. For complex simulations, they
observed a 1.5 to 3 times reduction in the computation time of the BPP algorithm when using
a downdated factorization, with the caveat that the approach is more efficient only when a
nominal percentage of variables is pivoted. Furthermore, parallelization of pivoting methods is
challenging, especially if a factorization is used to solve the principal sub-problem. However,
there is some work that has addressed this problem. For instance, Peiret et al. [2019] introduced

67
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

a parallelization technique for pivoting solvers using a domain decomposition technique, and
their method is capable of producing exact solutions for the contact BLCP.

3.2 Fixed-point methods


In this section we will focus on a popular class of methods for solving contact problems that
are commonly referred to as fixed-point methods. Specifically, we focus on the projected
Gauss-Seidel (PGS) algorithm and its variants. Furthermore, this section focuses entirely on
contact models that originate from the complementary problem formulations introduced in
Sections 1.6-1.8. First, we introduce the idea of splitting up the contact problem in order to get
a group of more manageable problems, which we can then solve iteratively. This naturally
leads to a frictional contact formulation that can be solved using the PGS method. Then, in
Section 3.2.4, the idea of splitting in a recursive fashion is used to derive the blocked Gauss-
Seidel method. The staggering method is presented in Section 3.2.5. Blocking and staggering
are general concepts that can be applied in other problem domains, as they serve as a general
scheme for combining different numerical solvers into one overall solver. The PGS type of
methods are interesting building blocks for many other types of numerical methods such as
sub-space minimization [Silcowitz et al. 2010b] and non-smooth non-linear conjugate gradient
(NNCG) method [Silcowitz et al. 2010a]. We cover these higher-level solvers once we have
created a strong foundation for the PGS type of methods.
3.2.1 Splitting Methods. We begin with the general concept of splitting methods. This class of
methods is well known in numerical optimization, and includes methods such as Gauss-Seidel,
Jacobi and successive over-relaxation (SOR). Splitting methods are iterative methods, which
unlike the pivoting methods described in Section 3.1, are practically incapable of computing
the exact solution to the LCP. Iterative methods approximate the solution, but do so in a much
more efficient way, both computationally and storage wise. The traditional form of the LCP is

Ax + b ≥ 0 , (121a)
x ≥ 0, (121b)
x𝑇 (Ax + b) = 0 , (121c)

which corresponds to the LCP introduced using the polyhedral cone in Section 1.6. Splitting
methods start with the decomposition of the lead matrix such that A = M − N. Note that
M here is not the mass matrix, and we leave M and N unspecified for now. Using the new
definition of A, Equation 121 becomes

Mx − Nx + b ≥ 0 , (122a)
x ≥ 0, (122b)
x𝑇 (Mx − Nx + b) = 0 . (122c)

68
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Let us next assume that we will use an iterative method where x𝑘 → x𝑘+1 for 𝑘 → ∞. This
assumes there is an accumulation or limiting point for the system. We can then rewrite Equa-
tion 121 using the decomposition and in terms of the current and next iterate:
Mx𝑘+1 − Nx𝑘 + b ≥ 0 , (123a)
x𝑘+1 ≥ 0 , (123b)
 𝑇  
x𝑘+1 Mx𝑘+1 − Nx𝑘 + b = 0 . (123c)

In the 𝑘 th iteration of the iterative method, we let c𝑘 = b − Nx𝑘 , and the LCP Equation 123
becomes
Mx𝑘+1 + c𝑘 ≥ 0 , (124a)
x𝑘+1 ≥ 0 , (124b)
(x𝑘+1 )𝑇 (Mx𝑘+1 + c𝑘 ) = 0 . (124c)
This is a fixed-point formulation and, for a suitable choice of M and N, we hope that the
complementarity sub-problem Equation 124 might be easier to solve than the original prob-
lem Equation 121. Imagine, for instance, letting M be the diagonal of A. This choice decouples
all variables and we have a sub-problem of 𝑛 independent 1D LCPs. The general splitting
method can be summarized as follows:
Step 1 Initialization: set 𝑘 = 0 and choose an arbitrary non-negative x0 ≥ 0.
Step 2 Given x𝑘 ≥ 0 solve the LCP Equation 124.
Step 3 If x𝑘+1 satisfies the termination criteria then stop, otherwise set 𝑘 ← 𝑘 + 1 and go to
Step 2.
The splitting is often chosen such that M is a Q-matrix, meaning that M belongs to the
class of matrices where the corresponding LCP has a solution. Clearly, if x𝑘+1 is a solution
to Equation 123 and we have x𝑘+1 = x𝑘 , then by substitution into the sub-problem given
by Equation 123 we see that x𝑘+1 is a solution to the original problem Equation 121.
We use the minimum map reformulation to realize the LCP sub-problem in Equation 123c,
such that
min(x𝑘+1, Mx𝑘+1 + b − Nx𝑘 ) = 0 , (125)
and subtracting x𝑘+1 and multiply by minus one, we get
max(0, −Mx𝑘+1 − b + Nx𝑘 + x𝑘+1 ) = x𝑘+1 . (126)
Here, we re-discover a fixed-point formulation. Now, let us perform a case-by-case analysis of
the 𝑖 th component. If we assume
 
x𝑘+1 − M x𝑘+1 − b + Nx𝑘 < 0 , (127)
𝑖

69
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: 𝑁 : Number of sweeps to perform, x: Initial iterate, M: First part of the matrix
splitting, N: Second part of the matrix splitting, b: The LCP right hand side vector.
Result: x: The numerical solution of the LCP.
1 for 𝑘 ← 1 to 𝑁 do
z𝑘 ← M−1 Nx𝑘 + b ;

2

3 x𝑘+1 ← max 0, z𝑘 ;
4 end
Algorithm 5: Splitting method. Generic projected method given matrix splitting A =
M − N. Notice that the key to an efficient method is to find an in-expensive to compute the
effect of the matrix multiplication by M−1 .

then we must have x𝑘+1


𝑖 = 0. Otherwise, our assumption is false and we must have
 
x𝑘+1 − M x𝑘+1 − b + Nx𝑘 = x𝑘+1
𝑖 . (128)
𝑖
That is,
(M x𝑘+1 )𝑖 = −c𝑘𝑖 . (129)
Here we have defined c𝑘 = b − Nx𝑘 . For a suitable choice of M we can rewrite (Mx𝑘+1 )𝑖 = −c𝑘𝑖
as
x𝑘+1
𝑖 = −(M−1 c𝑘 )𝑖 . (130)
Not all splittings will make this rewrite possible. A trivial example that allows this is to let M
to be the diagonal of A. Other common choices that allow this rewrite are listed in Table 3. A
simple rearrangement of terms gives an expression to update x at each iterate, such that
  
−1
M Nx − b = x𝑘+1
𝑘
𝑖 , (131)
𝑖
and combining it all we have derived the closed form solution for the complementary sub-
problem:
   
max 0, M−1 Nx𝑘 − b = x𝑘+1 . (132)
Iterative schemes like these are often termed
 projection methods. The reason for this is that if
𝑘 −1
we introduce the vector z = M Nx − b then
𝑘
 
x𝑘+1 = max 0, z𝑘 . (133)

That is, the 𝑘 + 1 iterate is obtained by projecting the vector z𝑘 to be positive. The pseudo-code
for splitting methods with projection is given in Algorithm 5 and this framework applies to a
variety of algorithms which are distinguished according to their splitting. Table 3 lists some of
the popular splittings used by specific variants of the algorithm.

70
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Table 3. Splittings for the three methods: Jacobi, projected Gauss-Seidel (PGS) and projected successive
over-relaxation (PSOR). The matrix D is the diagonal part of the original A matrix. The matrix U is the
strict upper part of the original A matrix. The matrix L is the strict lower part of the original A matrix.
The relaxation parameter should be chosen such that 0 < 𝜔 < 2.

Method M −N
Jacobi D L+U
PGS L+D U
PSOR D + 𝜔L (1 − 𝜔) D − 𝜔U

It should be noted that A must at least have nonzero diagonal values for these splittings to
work. As far as we know there exist no convergence proofs in the general case of A being
arbitrary. However, given appropriate assumptions on A such as being a contraction mapping
or symmetric, global convergence can be proven [Cottle et al. 1992; Murty and Yu 1988]. The
projected Successive Over Relaxation (PSOR) method is interesting as it has the free parameter
𝜔 that helps control the convergence rate. Further, we see that the projected Gauss–Seidel
(PGS) method pops out as the special case for 𝜔 = 1. In practice one would tune the value of 𝜔.
To see how to solve Equation 133 in an actual implementation, let us look at the specific
case of PSOR splitting as given in the Table 3. The principle is a for-loop which sweeps over
the vector components and updates the x vector in place. When we use the PSOR splitting, it
is useful to note that

M − N = D + 𝜔L − ((1 − 𝜔)D − 𝜔U) , (134)


= 𝜔 (L + D + U) , (135)
= 𝜔A . (136)

This is equivalent to a relaxation of the LCP by replacing A x + b ≥ 0 with 𝜔 (A x + b) ≥ 0.


For now we assume 𝜔 is a positive real number. The relaxed LCP is then,

𝜔 (Ax + b) ≥ 0 , (137a)
x ≥ 0, (137b)
x𝑇 𝜔 (Ax + b) = 0 . (137c)

The factor 𝜔 can be interpreted as a scaling of the term A x + b. We now rewind the derivation
of the projection method to Equation 129. For the specific case of PSOR this will result in
   
(𝜔 L + D) x𝑘+1 = ((1 − 𝜔) D − 𝜔U) x𝑘 − 𝜔b (138)
𝑖 𝑖

71
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Next we replace matrix multiplications with index notation


𝑛
∑︁ 𝑛
∑︁ 𝑛
∑︁ 𝑛
∑︁
𝑘+1 𝑘+1 𝑘
𝜔 L𝑖 𝑗 x 𝑗 + D𝑖 𝑗 x 𝑗 = (1 − 𝜔) D𝑖 𝑗 x 𝑗 − 𝜔 U𝑖 𝑗 x𝑘𝑗 − 𝜔b𝑖 . (139)
𝑗=1 𝑗=1 𝑗=1 𝑗=1

We can use the fill pattern of the matrices L, D, and U to optimize the summation operations,
𝑖−1
∑︁ 𝑛
∑︁
𝜔 L𝑖 𝑗 x𝑘+1
𝑗 + D𝑖𝑖 x𝑘+1
𝑖 = (1 − 𝜔) D𝑖𝑖 x𝑘𝑖 −𝜔 U𝑖 𝑗 x𝑘𝑗 − 𝜔b𝑖 . (140)
𝑗=1 𝑗=𝑖+1

Then we isolate x𝑘+1


𝑖 on the left hand side of the equation
Í𝑖−1 𝑘+1 − 𝜔D x𝑘 − 𝜔 Í𝑛
𝑘+1
−𝜔b 𝑖 − 𝜔 𝑗=1 L𝑖 𝑗 x 𝑗 𝑖𝑖 𝑖 𝑗=𝑖+1 U𝑖 𝑗 x 𝑗 + D𝑖𝑖 x𝑖
𝑘 𝑘
x𝑖 = . (141)
D𝑖𝑖
Reducing this slightly, we get
Í 𝑘+1 + D x𝑘 + Í𝑛
𝑘+1 𝑘
b𝑖 + 𝑖−1 𝑗=1 L𝑖 𝑗 x 𝑗 𝑖𝑖 𝑖 𝑗=𝑖+1 U𝑖 𝑗 x 𝑗
𝑘
x𝑖 = x𝑖 − 𝜔 . (142)
D𝑖𝑖
We assume a sweep over the indices 𝑖 th in increasing order. Due to this particular sweep order
we will have solved for all x𝑘+1
𝑗 with 𝑗 < 𝑖 when we start updating the 𝑖 th index. Hence there
are no unknowns on the right hand side of Equation 142. We can exploit this knowledge to
allow in-place updating of the x-iterate,
Í Í𝑛
b𝑖 + 𝑖−1
𝑗=1 L𝑖 𝑗 x 𝑗 + D𝑖𝑖 x𝑖 + 𝑗=𝑖+1 U𝑖 𝑗 x 𝑗
x𝑖 ← x𝑖 − 𝜔 . (143)
D𝑖𝑖
Noting that
𝑖−1
∑︁ 𝑛
∑︁ 𝑛
∑︁ 𝑛
∑︁ 𝑛
∑︁
L𝑖 𝑗 x 𝑗 + D𝑖𝑖 x𝑖 + U𝑖 𝑗 x 𝑗 = L𝑖 𝑗 x 𝑗 + D𝑖𝑖 x 𝑗 + U𝑖 𝑗 x 𝑗 (144)
𝑗=1 𝑗=𝑖+1 𝑗=1 𝑗=1 𝑗=1
𝑛
∑︁
= A𝑖 𝑗 x 𝑗 , (145)
𝑗=1

and defining r = b + Ax our derivation is reduced to


r𝑖
x𝑖 ← x𝑖 − 𝜔 . (146)
D𝑖𝑖
All that remains is to substitute the expression into the re-written minimal map reformulation
from Equation 133. We obtain the final update scheme,
 
r𝑖
x𝑖 ← max 0 , x𝑖 − 𝜔 for 𝑖 = 1 to 𝑛 . (147)
D𝑖𝑖
72
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: 𝑁 : The total number of sweeps to perform, 𝜔: SOR relaxation parameter value, x:
Initial iterative, A: The LCP coefficient matrix, b: The right hand side vector.
Result: x: The LCP numerical solution.
1 for 𝑘 ← 1 to 𝑁 do
2 foreach 𝑖 do
3 r𝑖 ← A𝑖∗ x +  b𝑖 ; 
4 x𝑖 ← max 0, x𝑖 − 𝜔 Ar𝑖𝑖𝑖 ;
5 end
6 end
Algorithm 6: Projected successive over-relaxation (PSOR). Observe that this method
essential builds on sparse blocked matrix products. This can be exploited in actual
implementations.

Notice that the sweep order of the 𝑖 th index is important. A pseudo code version of this practical
approach can be found in Algorithm 6. Note that PGS is a special case of where 𝜔 = 1.
On a side note, observe that if the reverse sweep order is wanted such that 𝑖 = 𝑛 to 1, then
this is possible too. The original fixed-point formulation Equation 123 will then be
Mx𝑘 − Nx𝑘+1 + 𝜔 b ≥ 0 , (148a)
𝑘+1
x ≥ 0, (148b)
 𝑇
x𝑘+1 𝜔 (Mx𝑘 − Nx𝑘+1 + b) = 0 . (148c)
All steps in the derivations are similar for this version of the fixed-point problem. However,
instead of forward PSOR update rule Equation 147 we now have a backward update rule
 
r𝑖
x𝑖 ← max 0 , x𝑖 − 𝜔 for 𝑖 = 𝑛 to 1 . (149)
D𝑖𝑖
In some applications, it can be convenient to let a full forward sweep be followed by a full
backward sweep. This variant of the projection method is known as a symmetric projection
method. The idea of symmetry applies to both PSOR and PGS, but is pointless for Jacobi. We
note that in some applications the sweep order may cause side-effects and the symmetric
variant can potentially alleviate this order-dependency issue to some extent.
In the splitting algorithms derived so far, we have applied a simple maximum iteration count
to guard against infinite looping. For many real-time applications such a termination criteria
will be sufficient. However, for more accurate applications it could result in inaccurate results.
It is quite easy to extend the algorithm to use merit functions for both absolute and relative
convergence testing or detecting divergence. Convergence of projection methods requires that
the update rule – such as Equation 147 – is a contraction mapping. As an example, we can use

73
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

the infinity norm of x as a merit function. The infinity norm merit function is defined as
𝜃 ∞ (x) ≡ ∥x∥ ∞ = arg max |x𝑖 | . (150)
𝑖
This particular norm is very attractive, as it is easily calculated during the sweeping of the
indices, shown in Algorithm 7.

Data: 𝑁 : The total number of sweeps to perform, x : Initial solution estimate, A : The
coefficient matrix, b : The right hand side vector, 𝜀 relative > 0 : relative
convergence threshold.
Result: x: The LCP numerical solution.
1 𝛿 ← ∞; /* Merit-value of current iterate */
2 𝛾 ← ∞; /* Merit-value of previous iterate */
3 for 𝑘 ← 1 to 𝑁 do
4 𝛾 ← 𝛿;
5 𝛿 ← 0;
6 foreach 𝑖 do
7 x𝑖 ← update scheme;
8 𝛿 ← max(𝛿, x𝑖 );
9 end
10 if 𝛿 > 𝛾 then
11 return divergence
12 end
𝛿−𝛾
13 if 𝛾 < 𝜀 relative then
14 return relative convergence
15 end
16 end
Algorithm 7: Projection method testing for contraction and divergence using infinity
norm of iterate as merit function. Notice how divergence and relative convergence can be
easily tested for.

Another possibility for convergence testing is to use a measurement for the complementary
condition as a merit function:
𝜃 compl. (x) ≡ x𝑇 (Ax + b) . (151)
In the case of x = 0 it is important to also make sure that the constraint Ax + b ≥ 0 is not
violated.
Any of the complementary reformulations can in principle be used as a merit function,
but be careful not to choose a merit function which dominates the computational cost of the

74
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

iteration of the projection methods itself. The cost of a projection method iteration is O (𝑛𝑘),
where 𝑘 ≤ 𝑛 is the maximum number of non-zeros in any given row of A.
3.2.2 Extending to the BLCP. As we saw in Section 1.7 the frictional problem could be recast
from an LCP model into a boxed LCP model (BLCP). Hence, we will extend the splitting ideas
from solving an LCP model to solving a BLCP model as well. Our starting point for deriving a
splitting method for the BLCP is the minimum map reformulation. From this we can write the
𝑖 th component as follows
min(𝑢𝑖 − x𝑖 , max(𝑙𝑖 − x𝑖 , −y𝑖 )) = 0 . (152)
By adding x𝑖 we get a fixed point formulation
min(𝑢𝑖 , max(𝑙𝑖 , x𝑖 − (Ax + b)𝑖 )) = x𝑖 . (153)
What follows now, is quite similar to what we derived in the LCP case. Once again, we introduce
the splitting A = M − N and the iteration index 𝑘. Then we define c𝑘 = b − Nx𝑘 . Using this we
have
min(𝑢𝑖 , max(𝑙𝑖 , (x𝑘+1 − Mx𝑘+1 − c𝑘 )𝑖 )) = x𝑘+1
𝑖 . (154)
When x𝑘 converges, then Equation 154 is equivalent to Equation 152. Next we perform a
case-by-case analysis. Three cases are possible,
(x𝑘+1 − Mx𝑘+1 − c𝑘 )𝑖 < 𝑙𝑖 ⇒ x𝑘+1
𝑖 = 𝑙𝑖 , (155a)
𝑘+1 𝑘+1 𝑘
(x − Mx − c )𝑖 > 𝑢𝑖 ⇒ x𝑘+1
𝑖 = 𝑢𝑖 , (155b)
𝑙𝑖 ≤ (x𝑘+1 − Mx𝑘+1 − c𝑘 )𝑖 ≤ 𝑢𝑖 ⇒ x𝑘+1
𝑖 = (x𝑘+1 − Mx𝑘+1 − c𝑘 )𝑖 . (155c)
Case Equation 155c reduces to,
(Mx𝑘+1 )𝑖 = −c𝑘𝑖 , (156)
which for a suitable choice of M and back substitution of c𝑘 gives,
x𝑘+1
𝑖 = (M−1 (Nx𝑘 − b))𝑖 . (157)
Thus, our iterative splitting scheme becomes,
min(𝑢𝑖 , max(𝑙𝑖 , (M−1 (Nx𝑘 − b))𝑖 )) = x𝑘+1
𝑖 . (158)
Now let x′ = M−1 (Nx𝑘 − b) then we have the projection method
x𝑘+1 = min(u, max(l, x′)) , (159)
where the (𝑘 + 1) th iterate obtained by projecting the vector x′ onto the box given by l and u.
Valid splittings of A are the same as in Table 3. By comparing Equation 158 to Equation 133,
we notice the the relationship between LCP and BLCP for splitting methods.

75
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

2 0.07
10
Default
0 Best 0.06
10 Worst

-2 0.05

% permutations
10

LCP residual
0.04
-4
10
0.03
-6
10
0.02
-8
10
0.01

-10
10 0
0 10 20 30 40 50 60 70 80 90 100 0 10 20 30 40 50 60 70 80 90 100
Iterations Iterations

Fig. 16. Left: A stack of two boxes with 8 non-interpenetration constraints. Middle: The LCP residual
versus the iteration count when solving non-interpenetration constraint of the two box stack example.
The convergence of the best, worst, and default orderings are shown. Right: The distribution of iterations
required to achieve 10−4 residual. From Andrews et al. [2017].

3.2.3 Ordering of Variables. The convergence of PGS and related fixed-point algorithms
depends on the order in which variables x1...𝑛 are updated. This can easily be seen by inspecting
Equation 143, where the update of variable x𝑖 depends on the values of the previous 1 . . . (𝑖 − 1)
variables and hence the order in which they are updated.
Fratarcangeli and Pellacini [2015] used an algorithm based on sequential vertex coloring
to partition constraints of a particle simulation into a 𝑘-partite graph. They observed that
the residual error in Gauss-Seidel iterations depends on the order in which the equations are
solved, and that it can possibly introduce bias.
Andrews et al. [2017] evaluated convergence behavior of the PGS algorithm for simple
contact problems, where all permutations for updating individual x𝑖 values were evaluated.
For example, with the two box stack shown in Figure 16, there are 8 non-interpenetration
constraints, which gives 40320 permutations of the constraint variables. Their work shows
that the best ordering can converge to a solution in less than half the iterations compared to
the worst ordering. Furthermore, a wide range of convergence behavior is observed when
evaluating the number of iterations that are required to achieve a certain accuracy.
In [Poulsen et al. 2010], a PGS variant of the splitting algorithm in Equation 158 is applied to
a BLCP model. In this work, l and u are affine functions of x. The algorithm framework we
outlined can easily deal with this, simply by updating the l and u vectors whenever a change is
made to x. Figure 17 shows typical convergence plots from Poulsen et al. [2010] using different
heuristics for permuting the order inside the PGS loop. Notice the non-monotone behavior of
the greedy strategy, which strongly suggests the missing convergence guarantees of the BLCP
contact model from Section 1.7.
3.2.4 The Blocked Gauss-Seidel Method. The matrix splitting approach we have used to derive
the presented Gauss-Seidel methods, imply that they can not be used for the LCP contact
model presented in Section 1.5 due to a zero diagonal values and nonsymmetry of A. However,
the splitting idea can be applied in a blocked version. This results in a numerical method that is
very easy to implement and still preserves the good numerical properties of the PGS method.

76
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

−1 −1
10 10
PGS PGS
Impulse Impulse
−2
10 Coordinate −2 Coordinate
Greedy Staggered 10
Greedy Staggered
Extreme Staggered Extreme Staggered
−3
10
−3
10
Error

Error
−4
10
−4
10
−5
10

−5
−6 10
10

−7 −6
10 10
0 20 40 60 80 100 0 20 40 60 80 100
Iterations Iterations

Fig. 17. Convergence rates taken from Poulsen et al. [2010]. On left is a box stack and on right a card
house. Different heuristics are applied for permuting the order of variables inside the PGS loop. In this
specific test example on left the Impulse curve is on top of the PGS curve. This specific study is for
dense structured rigid body scenes, such as brick walls. Notice the non-monotone behavior.

To illustrate the blocking idea, we will – without loss of generalization – use the multiple
contact problem as an example. Here, a block may be defined as all variables connected to a
single contact point. When using a four-sided friction pyramid to model the friction constraints,
the 𝑖 th block of x will consist of the normal impulse 𝜆𝑛,𝑖ˆ , four friction impulses 𝜆𝑡ˆ1,𝑖 , 𝜆𝑡ˆ2,𝑖 , 𝜆𝑡ˆ3,𝑖 ,
𝜆𝑡ˆ4,𝑖 and one slack variable 𝛽𝑖 . The structure of the 𝑖 th block of x will then be defined as
h i h i𝑇
x = 𝜆𝑛,𝑖
ˆ 𝜆𝑡ˆ1,𝑖 · · · 𝛽𝑖 , observe that we overload the square bracket notation to indicate
𝑖 h i
blocks. Similarly, A is the block of A corresponding to the 𝑖 th and 𝑗 th contact point variables.
𝑖𝑗
Thus, the blocked LCP can be written
h i ∑︁ h i h i h i
v = A x + b ≥ 0 ∀𝑖 , (160a)
𝑖 𝑖𝑗 𝑗 𝑖
𝑗
h i
x ≥ 0 ∀𝑖 , (160b)
𝑖
h i𝑇 h i
v x = 0 ∀𝑖 . (160c)
𝑖 𝑖

In practice, the blocks can be defined however suits the problem or solver best.
We next apply the Gauss-Seidel splitting to the blocked LCP. The result is a blocked Gauss-
Seidel (BGS) method (see Algorithm 8). The intuition behind this numerical method is that
all contact point variables other than the 𝑖 th block are momentarily frozen while solving for
the variables of the block. The BGS approach is also known as a sweeping process or as the
non-smooth contact dynamics (NSCD) method [Jean 1999; Moreau 1999].

77
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: 𝑁 : Maximum number of sweeps/iterations, x: Initial starting iterate, A: The


coefficient matrix of the LCP, b: The right hand side vector of the LCP.
Result: x: The solution for the LCP.
1 for 𝑘 ← 1 to 𝑁 do
2 foreach block 𝑖 doÍ
3 [b] 𝑖′ ← [b] 𝑖 − 𝑗≠𝑖 [A] 𝑖 𝑗 [x] 𝑗 ;
4 solve sub-LCP ([A] 𝑖𝑖 , [x] 𝑖 , [b] 𝑖′) ;
5 end
6 end
Algorithm 8: Blocked Gauss-Seidel (BGS) method. Notice that the blocking is a very
general mechanism. One may define blocks in any way and dimensions that one sees fit.
Another trait from blocking is that any kind of sub-solver can be used for solving the
blocked sub-problem.

The sub-block LCP at line 4 can be solved using any LCP solver. Usually yet another splitting
is applied, dividing the sub-block LCP into a normal impulse sub-block and a frictional sub-
block. The normal sub-block is a 1D problem and can be solved by a projection. For instance,
when using the four-sided friction pyramid, the frictional sub-block is a 5D problem. The
frictional sub-block of A is not entirely neat as we have zero diagonal terms and non-symmetry.
However, the low dimensionality allows efficient direct enumeration. Another fix is to ignore
the principle of maximum dissipation – effectively changing the contact model – which
reduces the number of variables such that we have to solve a 2D problem with a symmetric
PSD frictional sub-block matrix.
The blocked Gauss-Seidel method offers many possibilities. In Section 3.2.5 we divide a
LCP into two sub-blocks, one with all normal variables only and the other containing the
rests. If the LCP includes joints, we could have a sub-block for all the joint variables. As we
will illustrate here, being clever in making such partitions can be used to solve sub-problems
efficiently.
One such example is the joint sub-block of the LCP, this is known to be equivalent to a
symmetric positive semi-definite linear system. Thus, we can use a preconditioned conjugate
gradient (PCG) solver to solve for joint impulses rather than a PGS method. Because PCG has
the same per-iteration cost as PGS, but a better convergence rate, the result is much less joint
drifting errors at the same cost as PGS. If the number of joints is sufficiently small, we could
even use an incomplete Cholesky factorization to solve for joint impulses, resulting in very
accurate solutions.
Taking the concept of blocking a step further, BGS can be used to partitioning a configuration
into sub-blocks where specialized solvers can be applied for each sub-block. This is termed
hierarchical solvers in the graphics and gaming community. Instead of using a Gauss-Seidel

78
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Fig. 18. Simulation of a canon ball hitting a tower. The simulation uses a velocity based shock-
propagation, fixed time stepping method [Erleben 2007]. This is an example of a blocking method
using gravity to create layers of blocks of a boxed linear complementarity problem (BLCP). Incredible
details and non-viscous contact interaction can be obtained with this method.

splitting, we could use a blocked Jacobi method or a blocked red and black Gauss-Seidel method.
This can be beneficial as domain decomposition techniques for distributed or parallel system
solvers.
The blocking concepts are rather generic and can be applied to the more general class of
BLCP problems too. We leave it to the reader to explore those ideas further.
Erleben [2007] realize a shock-propagation time-stepping method that can be explained as a
specific blocking method that divides the contact points in a simulation into disjoint spatial
chunks based on layers along the direction of gravity. This allows for fast propagation of
shocks in the up-down gravitational direction. Figure 18 shows an example demonstrating the
high fidelity visual details that a proper blocking strategy can create.
Erleben [2005] uses a blocked PGS for a BLCP type of problem with variable lower and upper
bounds. Figure 19 shows simulation results obtained with this method and Figure 20 illustrates
typical convergence rates obtained during a single time-step. Notice that for these specific
simulations, the method still obtains a linear convergence rate, although the convergence
constant varies a lot across simulations.
3.2.5 Staggering. We will now combine the ideas of splitting the LCP and using QP reformu-
lations. This is collectively referred to as staggering [Kaufman et al. 2008; Lötstedt 1984]. We
illustrate the idea for a multiple contact problem. We partition the LCP variables into three
index sets: one corresponding to normal impulses N , one to friction impulses F , and the last
one is slack variables 𝛽. Applying our partition would require us to solve the two coupled
LCPs,
0 ≤ AN N xN + (bN + AN F xF ) ⊥ xN ≥ 0 (161)
and
" #" # " # " #
AF F e xF bF + AF N xN xF
0≤ + ⊥ ≥ 0. (162)
−e𝑇 0 𝛽 𝜇xN 𝛽

79
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Fig. 19. Simulations of wall and a tower using a blocked Projected Gauss-Seidel (PGS) type of method
for boxed linear complementarity problem (BLCP) with variable lower and upper bounds [Erleben
2005].

0.45
Box Stack
0.4 Ball Grid 0
Wall 10
0.35 Tower
−5
0.3 10

0.25 −10
θ(λi)

10
log( θ(λi))

0.2
−15
10
0.15
−20
0.1 10

0.05 Box Stack


−25
10 Ball Grid
0 Wall
0 50 100 150 200 250 300 Tower
iterations −30
10
0 50 100 150 200 250 300
iterations

(a) Convergence (b) Log Convergence

Fig. 20. Convergence rate plots of a single time-step for each of the configurations shown in Figure 19.

In a staggered approach, we first solve the normal force LCP and then the friction force LCP.
This is repeated iteratively until a fixed-point is reached. This is in essence a specialized blocked
Gauss-Seidel splitting method.
Using the splitting of Equation 161 and Equation 162, we note that the normal force problem
has a symmetric positive semi-definite coefficient matrix AN N making QP reformulations
possible, whereas the frictional problem has a non-symmetric matrix. However, because the

80
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

friction LCP is equivalent to the first order optimality conditions of the QP problem
1 𝑇
x∗F = arg min x AF F xF + c𝑇F xF (163)
2 F
subject to
xF ≥ 0 and 𝑐 N − e𝑇 xF ≥ 0 , (164)
where 𝑐 N = 𝜇xN and cF = bF + BF N xN , any convex QP method can be used to solve for the
normal and friction forces. Thus, we are guaranteed to find a solution for each sub-problem.
Whether the sequence of QP sub-problems converge to a fixed point is not obvious. There
exist many variations over this staggering scheme [Lacoursiere and Linde 2011].
Silcowitz et al. [2009] apply a kind of semi-staggering method for BLCPs. They found that
using this simple semi-staggering approach to warm start a Newton method shows how
dramatically staggering can affect the convergence behavior.
3.2.6 The Projected Gauss-Seidel Subspace Minimization Method. We extend the general PGS
method, by tailoring it to the generalized boxed LCP problem class which allows for variable
lower and upper bounds. The method we derive originates from work on solving the contact
force problem [Silcowitz et al. 2010b]. The projected Gauss-Seidel with Subspace Minimization
(PGS-SM) method is an iterative method, and each iteration consists of two phases:
(1) The first phase estimates a set of active constraints F using the standard PGS method.
(2) The second phase solves accurately for the active constraints, potentially further reducing
F for the next iteration.
Phase I. This phase consists of running a standard PGS method to solve for x. When the PGS
algorithm terminates, we know that x is feasible, although not necessarily the correct solution.
However, v may be infeasible due to the projection on x made by the PGS method. Recall the
definitions given by Equation 112a-112c, which are practical for labeling and eliminating some
of the unknowns based on analysis of the feasibility and complementarity conditions. In fact,
the pivoting based solver exploited this aspect of the index set definitions. A similar approach
is taken by the second phase of the PGS-SM method, which solves for a a subset of variables.
Phase II. The linear system may be partitioned as in Equation 111 into three distinct sets:
free and tight lower and upper bounded. To solve this system for the unknowns vL , vU and xF ,
we first compute xF by solving
 
AF,F xF = − bF + AF,L𝝀 lo L + AF,U𝝀 hi U . (165)

Here, AF,F is a symmetric principal sub-matrix of A. Knowing xF , we can easily compute vL


and vU ,
vL = ALF xF + ALL𝝀 lo L + ALU𝝀 hi U + bL, (166a)
vU = AUF xF + AUL𝝀 lo L + AUU𝝀 hi U + bU . (166b)

81
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Now, we check that the feasibility conditions are satisfied: vL < 0, vU > 0 and 𝝀 lo F ≤ xF ≤ 𝝀 hi F .
If all constraints are satisfied, we have reached a solution. Rather than testing the constraints
explicitly, a projection is performed on the reduced problem:
xF ← min(xhi lo
F , max(xF , xF )) . (167)
h i𝑇
We assemble the full solution vector x ← x𝑇F l𝑇L u𝑇U before re-estimating the index sets
for the next iteration. The projection on the reduced problem will either leave the active
set unchanged or reduce it further. See Algorithm 9 for the full pseudo code of the PGS-SM
method.
Notice that Algorithm 9 does not specify which termination criteria to use . A particularly
useful termination criterion for the PGS-SM method could be to monitor if the set F has
changed from the previous iteration,
F𝑘+1 = F𝑘 . (168)
Figure 21 shows different simulation results obtained with the PGS-SM method [Silcowitz
et al. 2010b]. As shown the PGS-SM method behaves rather well for small configurations and
configurations with joints. For larger configurations, we obtain convergence results similar to
the PGS method.
3.2.7 The Non-Smooth Nonlinear Conjugate Gradient Method. Silcowitz et al. [2010a] shows
that the PGS iteration can be written in generic form using Equation 158 as
x𝑘+1 = min( u(x𝑘 ) , max( l(x𝑘 ) , −(D + L) −1 (Ux𝑘 + b)) (169)
|{z} |{z} | {z }
T𝑈 x𝑘 +t𝑈 T𝐿 x𝑘 +t𝐿 Tx𝑘 +t

where the lower and upper bound functions l, u : R𝑛 ↦→ R𝑛 are affine functions. The T𝐿 and T𝑈
matrices express the linear relations between the tangential friction forces and their associated
normal forces. The t𝐿 and t𝑈 vectors can be used to express fixed bound constraints, such as
a normal force constraint. Thus, the PGS iteration can be perceived as a selector function of
three affine functions.
Assuming a converging sequence x𝑘 → x∗ for 𝑘 → ∞ the solution of PGS can be written as
the fixed point formulation,
x∗ = min(T𝑈 x∗ + t𝑈 , max(T𝐿 x∗ + t𝐿 , Tx∗ + t)) . (170)
| {z }
≃Gx∗ +g

The right hand side of Equation 170 can be conceptually considered as the evaluation of an
affine function, Gx∗ + g. This is true if the active set of constraints is known in advance.
Therefore, we have
0 = (G − I)x∗ + g . (171)

82
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: 𝑘𝑝𝑔𝑠 : Number of PGS sweeps per outer iteration, 𝑘𝑠𝑚 : Number of subspace solves
per outer iteration, x: The initial iterate, A: The coefficient matrix of the BLCP, b:
The right hand side vector the BLCP.
Result: x: The numerical solution for the BLCP.
1 while not converged do
2 x ← run PGS for at least 𝑘𝑝𝑔𝑠 iterations;
3 if termination criteria reached then
4 return x;
5 end
6 for 𝑘 ← 1 to 𝑘𝑠𝑚 do
7 L ≡ {𝑖 |x𝑖 = l𝑖 };
8 U ≡ {𝑖 |x𝑖 = u𝑖 };
9 F ≡ {𝑖 |l𝑖 < x𝑖 < u𝑖 }; 
10 solve: AF,F xF = − bF + AF,L lL + AF,U uU ;
11 vL ← AL,F xF + AL,L lL + AL,U uU + bL ;
12 vU ← AU,F xF + AU,L lL + AU,U uU + bU ;
13 update: (l, u);
14 xF ← min(uF, max(lF, xF ));
h i𝑇
15 x ← xF lL uU ;
𝑇 𝑇 𝑇

16 if termination criteria reached then


17 return x
18 end
19 end
20 end
Algorithm 9: Projected Gauss-Seidel subspace minimization (PGS-SM) method.
Observe that is can be seen as a PGS solver followed by an active-set strategy solving a
sequence of linear systems while efficiently updating the active index set. PGS becomes a
prior for making a good initial estimate of the active set.

Observe, explicit assembly is not needed for any of the matrices, instead the PGS method can
be used to implicitly evaluate the residual of any given iteration, r𝑘 = (G − I)x𝑘 + g. Thus, if
we write one iteration of the standard PGS method as

x𝑘+1 = PGS(x𝑘 ) (172)

then r𝑘 = x𝑘+1 − x𝑘 = PGS(𝑥 𝑘 ) − x𝑘 . This can be thought of as the gradient of a non-


smooth nonlinear quasi-quadratic function 𝑓 (x𝑘 ) ≈ 12 ∥r𝑘 ∥ 2 . We are essentially seeking a

83
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Arched Snake Heavy Box On Arched Snake Large Stack of Boxes Heavy Box Resting On Light Boxes
20 5 10 10
10 10 10 10
PGS−SM PGS−SM PGS−SM PGS−SM
PGS PGS PGS PGS
0 0 0 0
10 10 10 10
Ψ(λk)

Ψ(λk)

Ψ(λk)

Ψ(λk)
−20 −5 −10 −10
10 10 10 10

−40 −10 −20 −20


10 10 10 10
0 500 1000 1500 0 500 1000 1500 0 500 1000 1500 0 500 1000 1500
PGS iterations PGS iterations PGS iterations PGS iterations

(a) (b) (c) (d)


Boxes Resting On Inclined Surface Small Pyramid of Gears Medium Pyramid Of Gears Friction Dependant Structure
5 5 5 5
10 10 10 10
PGS−SM PGS−SM PGS−SM PGS−SM
PGS PGS PGS PGS
0 0 0
10 10 10
Ψ(λk)

Ψ(λk)

Ψ(λk)

Ψ(λk)
0
10
−5 −5 −5
10 10 10

−10 −10 −10 −5


10 10 10 10
0 500 1000 1500 0 500 1000 1500 0 500 1000 1500 0 500 1000 1500
PGS iterations PGS iterations PGS iterations PGS iterations

(e) (f) (g) (h)

Fig. 21. Test cases for the comparison of PGS and PGS–SM methods with corresponding convergence
plots. Observe the jaggedness in the PGS–SM plots in (b), (c), (d), and (g). The spikes indicates that the
PGS–SM method guessed a wrong active set. This can cause the merit function to rise abruptly. The
𝜓 function is the Fischer–Burmeister function from Silcowitz et al. [2009]. The 𝑥-axis is measured in
units of one PGS iteration to make comparison easier.

local minimizer of 𝑓 , however, we only know its gradient ∇𝑓 (x𝑘 ) = r𝑘 . The Fletcher-Reeves
nonlinear conjugate gradient method is perfect for this [Nocedal and Wright 2006].
In each iteration of the conjugate gradient method we perform the update,
x𝑘+1 = x𝑘 + 𝜏 𝑘 p𝑘 (173)
where p𝑘 is the search direction and 𝜏 𝑘 can be found using a line search method. Next a new
search direction is computed by
2
𝑘+1
∇𝑓 𝑘+1
𝛽 = 2
, (174a)
∇𝑓 𝑘
p𝑘+1 = 𝛽 𝑘+1 p𝑘 − ∇𝑓 𝑘+1 . (174b)
In an an interactive context, the line search on 𝑓 (x𝑘+1 ) is dropped. Here the full step length,
𝜏 = 1, is used and the method is restarted whenever ∥∇𝑓 𝑘+1 ∥ 2 > ∥∇𝑓 𝑘 ∥ 2 .
When computing PGS(x𝑘 ), it is practical to do so in-place, meaning that a PGS step is taken
implicitly on x𝑘 . Therefore, the update of x𝑘 is done separately in two places in each iteration.
The full algorithm is stated in Algorithm 10.

84
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: x: The initial iterate, A: The coefficient matrix of the LCP , b: The right hand side
of the LCP.
Result: x: The numerical solution for the LCP.
1 x1 ← PGS(x0 );
2 ∇𝑓 0 ← −(x1 − x0 );
3 p0 ← −∇𝑓 0 ;
4 𝑘 ← 1;
5 while not converged do
6 x𝑘+1 ← PGS(x𝑘 );
7 ∇𝑓 𝑘 ← −(x𝑘+1 − x𝑘 );
2 2
8 𝛽 𝑘 ← ∇𝑓 𝑘 / ∇𝑓 𝑘−1 ;
9 if 𝛽 𝑘 > 1 then
10 p𝑘 ← 0 ; /* restart */
11 else
12 x𝑘+1 ← x𝑘+1 + 𝛽 𝑘 p𝑘−1 ;
13 p𝑘 ← 𝛽 𝑘 p𝑘−1 − ∇𝑓 𝑘 ;
14 end
15 𝑘 ← 𝑘 + 1;
16 end
Algorithm 10: Nonsmooth nonlinear conjugate gradient (NNCG) method. Observe
how a single PGS sweep is used to compute the gradient ∇𝑓 of some imaginary objective
function 𝑓 that NNCG method tries to minimize. It is surprisingly that we do not need to
be able to explicitly create 𝑓 .

An implementation of the non-smooth nonlinear conjugate gradient (NNCG) method can be


found in [Silcowitz-Hansen 2010] and [Coumans 2005]. Detailed convergence studys may be
found in [Silcowitz et al. 2010a]. Figure 22 shows corresponding convergence rates for some
simulation results, taken from [Silcowitz et al. 2010a]. Figure 22 Notice the dramatic change in
convergence behavior. The improved accuracy means the NNCG method is more equipped to
deal with for instance large mass ratios. Usually PGS performs slow on such problems and
NNCG will out-perform it. Further, NNCG is overall computationally cheaper than applying a
direct method which otherwise would be able to handle large mass ratios.

3.3 Non-Smooth Newton Methods


Let us just remember the classical Newton method for solving a generic root finding problem
F(x) = 0, that is solve for x such that the vector function F is zero. The Newton method is

85
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

(a) (b) (c)

(d) (e) (f)

(g) (h) (i)

Fig. 22. Test results comparing the nonlinear conjugate gradient method (NNCG) with projected
Gauss-Seidel (PGS) method with up to 5000 iterations. The NNCG method clearly converges faster,
and often to a higher accuracy than that of the PGS method. Notice the superior rate of convergence
in (f)-(i).

classically derived from a first order Taylor approximation around the 𝑘 th iterate,

𝜕F(x𝑘 )
F(x𝑘 + Δx) ≈ F(x𝑘 ) + Δx . (175)
𝜕x
86
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Setting the approximation equal to zero we have the Newton equation,


𝜕F(x𝑘 )
Δx = −F(x𝑘 ) . (176)
𝜕x
The Δx is called the search direction or Newton direction. We solve the Newton equation for
finding the search direction. The search direction is then used in the Newton update rule given
by,
x𝑘+1 = x𝑘 + Δx . (177)
The Newton method can be globalized by adding a line-search method to the update rule.
This essentially consist of multiplying the search direction by a scalar line-step parameter.
Line-search strategies are sometimes avoided in interactive and real-time simulations as they
can be expensive, but back-tracking strategies are quite popular when a line-search is added. In
these notes we will not go into line-search methods, but instead focus on how to reformulate
the contact and friction problem into a root finding problem. In the text below we will start
by building up the mathematical parts that allow us to define a F-function in the context of
𝑘)
contact problems and provide the building blocks for later showing how to assemble 𝜕F(x 𝜕x
and solve for Δx.
One successful approach by Ferris and Munson [1999] is to reformulate a complementar-
ity problem in terms of a NCP function whose roots satisfy the original complementarity
conditions. In other words, functions where the following equivalence holds:
𝜓 (𝑎, 𝑏) = 0 ⇐⇒ 0 ≤ 𝑎 ⊥ 𝑏 ≥ 0 . (178)
Combined with an appropriate time-discretization, such a NCP function turns our contact
problem into a root finding one. In general the functions 𝜓 are non-smooth, but allow us to
apply a wide range of numerical root finding methods [Munson et al. 2001].
Let us review some of the most commonly used NCP functions and show how to rephrase
the contact problem into an equivalent root finding problem.
3.3.1 Minimum-Map Formulation. The first NCP function we will consider is the minimum-
map defined as
𝜓 mm (𝑎, 𝑏) ≡ min(𝑎, 𝑏). (179)
The equivalence of this function to the original NCP can be verified by examining the values
associated with each conditional case for finding a root for the equation 𝜓 mm = 0. We
now consider how this reformulation applies to unilateral contact constraints. Recall that
the complementarity condition associated with a contact constraint 𝜙 (q) and its associated
Lagrange multiplier 𝜆𝑛ˆ is
0 ≤ 𝜙 (q) ⊥ 𝜆𝑛ˆ ≥ 0 . (180)

87
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

We can write this in the equivalent minimum-map form of the contact constraint as
𝜓𝑛ˆ (q, 𝜆𝑛ˆ ) ≡ 𝜓 mm (𝜙 (q), 𝜆𝑛ˆ ) = 0 , (181)
which has the following derivatives,
(
𝜕𝜓𝑛ˆ ∇𝜙 (q), 𝜙 (q) ≤ 𝜆𝑛ˆ
= , (182)
𝜕q 0, otherwise
(
𝜕𝜓𝑛ˆ 0, 𝜙 (q) ≤ 𝜆𝑛ˆ
= . (183)
𝜕𝜆𝑛ˆ 1, otherwise
From these cases we can see that the minimum-map gives rise to an active-set style method
where a contact is considered active if 𝜙 (q) ≤ 𝜆𝑛ˆ . Active contacts are treated as equality
constraints, while for inactive contacts the minimum-map enforces that the constraint’s
Lagrange multiplier is zero.
3.3.2 Fischer-Burmeister Formulation. An alternative NCP function is given by Fischer [1992],
who observe the roots of the following equation satisfy complementarity:

𝜓 fb (𝑎, 𝑏) = 𝑎 + 𝑏 − 𝑎 2 + 𝑏 2 = 0 . (184)
This is the Fischer-Burmeister function, and it is interesting because, unlike the minimum-map,
it is smooth everywhere apart from the point (𝑎, 𝑏) = (0, 0). For (𝑎, 𝑏) ≠ (0, 0) the partial
derivatives of the Fisher-Burmeister function are given by:
𝜕𝜓 fb 𝑎
𝛼 (𝑎, 𝑏) = =1− √ , (185)
𝜕𝑎 𝑎2 + 𝑏 2
𝜕𝜓 fb 𝑏
𝛽 (𝑎, 𝑏) = =1− √ . (186)
𝜕𝑏 𝑎2 + 𝑏 2
At the point (𝑎, 𝑏) = (0, 0) the derivative is set-valued. For Newton methods it suffices to
choose any value from this sub-gradient. Erleben et al. [2011] compared how the choice of
derivative at the non-smooth point affects convergence for LCP problems and found no overall
best strategy. Thus, for simplicity we make the arbitrary choice of
𝛼 (0, 0) = 0 , (187)
𝛽 (0, 0) = 1 . (188)
For a contact constraint 𝜙, with Lagrange multiplier 𝜆𝑛ˆ we may then write our contact constraint
alternatively as,
𝜓𝑛ˆ (q, 𝜆𝑛ˆ ) ≡ 𝜓 fb (𝜙 (q), 𝜆𝑛ˆ ) = 0 , (189)

88
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

with derivatives given by


𝜕𝜓𝑛ˆ
= 𝛼 (𝜙, 𝜆𝑛ˆ )∇𝜙 , (190)
𝜕q
𝜕𝜓𝑛ˆ
= 𝛽 (𝜙, 𝜆𝑛ˆ ) . (191)
𝜕𝜆𝑛ˆ
3.3.3 Friction. Coulomb’s law can be derived from a principle of maximal dissipation that
requires the frictional forces remove the maximum amount of energy from the system while
having their magnitude bounded by the normal force:
arg min v𝑡ˆ𝑇 𝝀𝑡ˆ subject to ∥𝝀𝑡ˆ ∥ ≤ 𝜇𝜆𝑛ˆ . (192)
𝝀𝑡ˆ

This minimization defines an admissible cone that the total contact force must lie in. The
Lagrangian associated with this minimization is
L (𝝀𝑡ˆ, 𝜆𝑛ˆ ) ≡ v𝑡ˆ𝑇 𝝀𝑡ˆ + 𝛾 (∥𝝀𝑡ˆ ∥ − 𝜇𝜆𝑛ˆ ) . (193)
where 𝛾 is a slack variable used to enforce the Coulomb constraint that the friction force
magnitude is bounded by 𝜇 times the normal force magnitude. When 𝜇𝜆𝑛ˆ > 0 the problem
satisfies Slater’s condition [Boyd and Vandenberghe 2004] and we can use the first-order
Karush-Kuhn-Tucker (KKT) conditions, given by
𝜕∥𝝀𝑡ˆ ∥
s(u, 𝝀𝑡ˆ, 𝛾) ≡ J𝑡ˆu + 𝛾 =0 (194)
𝜕𝝀𝑡ˆ
0 ≤ 𝛾 ⊥ 𝜇𝜆𝑛ˆ − ∥𝝀𝑡ˆ ∥| ≥ 0 , (195)
where 𝛾 is a slack variable that governs stick/slip behavior, and we used the block notation for
the mapping v = Ju given by
" # " #
𝑣𝑛ˆ J𝑛ˆ
v= = u. (196)
v𝑡ˆ J𝑡ˆ
|{z}
J
The complementarity condition may be directly written using any NCP function as,
𝜓𝑡ˆ ≡ 𝜓 (𝛾, 𝜇𝜆𝑛ˆ − ∥𝝀𝑡ˆ ∥) = 0 . (197)
3.3.4 Newton’s Method. We may now define generically for any chosen NCP function,
u  Mu − J𝑇 𝜆 + f 
   
   
𝜆𝑛ˆ   𝜓𝑛ˆ (𝜙 (q), 𝜆𝑛ˆ ) 
x ≡   and F(x) ≡ 
    = 0, (198)
𝝀
 𝑡ˆ  s(u, 𝝀 𝑡ˆ, 𝛾) 

   
𝛾  𝜓𝑡ˆ (𝛾, 𝜇𝜆𝑛ˆ − ∥𝝀𝑡ˆ ∥) 
   
89
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

r=1 r=0.25
1 1

0.5 0.5

0 0

-0.5 r -0.5 r
c( ) c( )
min(c, r ) min(c, r )
fb(c, r ) fb(c, r )
-1 -1
-1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1

Fig. 23. Left: The minimum-map of a unilateral constraint has a kink in it at the cross over point. Right:
Choosing an appropriate r-factor can remove the discontinuity by forcing both terms to be parallel. For
a single constraint this results in a straight-line error function that can be solved in one step regardless
of starting point. In the case of Fischer-Burmeister (green) the error function’s curvature is reduced.
For illustration purposes we have shown the constraint function 𝑐 = 41 𝜆 − 18 > 0, which has a unique
solution at 𝜆 = 12 .

Observe the top-row in F is the time-discretized Newton Euler equations. One may replace
the normal reformulation with one that is based on the separation velocity 𝑣𝑛ˆ rather than the
normal constraint 𝜙. In which case we have 𝜓𝑛ˆ (𝜙,¤ 𝜆𝑛ˆ ) = 𝜓𝑛ˆ (𝑣𝑛ˆ , 𝜆𝑛ˆ ) = 𝜓𝑛ˆ (J𝑛ˆ u, 𝜆𝑛ˆ ). We can solve
for the roots of 𝜓𝑛ˆ and 𝜓𝑡ˆ using Newton’s methods by linearizing the equation F = 0 in terms
of velocities and the Lagrange multipliers to obtain the following system,
M −J𝑛ˆ𝑇 −J ˆ𝑇 0   Δu  f 
 𝑡    
0  Δ𝜆𝑛ˆ 
 𝜕𝜓𝑛ˆ    
J𝑛ˆ 𝜕𝜆 0
 = − 𝜓𝑛ˆ  .
 
𝑛ˆ
  (199)
𝜕𝛾  Δ𝝀𝑡ˆ
J 𝜕s 𝜕s  
 𝑡ˆ 0 𝜕𝝀𝑡ˆ
 s
 
𝜕𝛾   Δ𝛾 
 0 𝜕𝜓𝑡ˆ 𝜕𝜓𝑡ˆ 𝜕𝜓𝑡ˆ  
   
 𝜓𝑡ˆ 
 𝜕𝜆𝑛ˆ 𝜕𝝀𝑡ˆ  
Here we have considered a single contact constraint for simplicity. The extension to a system
of contacts is straightforward. However, it is clear that, due to the frictional constraints,
Equation 199 is non-symmetric, which restricts the numerical methods we can use to solve it.
Macklin et al. [2019] proposed a fixed-point iteration to eliminate 𝛽 and obtain a symmetric
system that can be solved with iterative Krylov methods.
3.3.5 Preconditioning. Similar to prox formulations, the NCP functions presented in this
section have a free parameter 𝑟 that may be used to rescale the functions. Specifically, a
solution to 𝜓 (𝑎, 𝑏) = 0, is also a solution to the scaled problem, 𝜓 (𝑎, 𝑟𝑏) = 0, where 𝑟 may be
chosen as any positive constant. In practice this parameter is important for the robustness of
Newton methods, and we visualize its effect on the NCP functions in Figure 23.

90
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Fig. 24. Examples of rigid body simulation using PROX schemes. Top row shows digital prototyping
application studying jamming due to friction properties, upper-middle: packing into a container, middle-
lower: building collapse due to poor design. Bottom demonstrates structured stacking.

3.4 Proximal Operators


Iterative methods are popular for solving contact force problems in rigid body dynamics. We
have extensively covered many of the LCP variations of these type of methods. The ideas
do extend into other types of models. One such model is based on the proximal operator. It
is a much more general model that allow one to express more nonlinear and non smooth
properties in a compact way than the LCP approach often would allow one to do. In this
section we extend many previous ideas covered in previous sections into this more general
abstract setting building on proximal operators. We provide a mathematical foundation for
computer graphics researchers for iterative (PROX) schemes based on proximal operators. Our
presentation follows the outline of Erleben [2017]. We derive a class of iterative Jacobi and
blocked Gauss-Seidel variants that theoretically proven always converge and provides flexible
plug and play framework for exploring different friction laws as we describe in Section 6. PROX
methods are both fast, scale to handle a large number of rigid bodies, deal with non-convex
shapes, accurately model the physics, and be robust as well as predictable in case of user
interactions as illustrated in Figure 24.
The PGS type of methods have become quite a de-facto standard for interactive entertainment.
The robustness of PGS and PSOR variants are well-known as is their poor convergence behavior
[Andrews et al. 2017; Erleben 2007]. We provide a derivation of such iterative schemes using
proximal operators. We name these schemes PROX methods to avoid confusion with the

91
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

traditional PGS variants as described in Section 3.2. We will take a different path based on
proximal operators than the usual PGS-type derivation such as the one done by Silcowitz et al.
[2010a].
Interestingly, the usual PGS complementarity based friction box-model variants are special
cases of a PROX method with a fixed constant 𝑟 -factor (to be explained later). This is the reason
why PGS can diverge and why the PROX method setting is theoretically guaranteed to always
converge [Foerg et al. 2006; Parikh and Boyd 2014]. Further, PGS is tied to the box-model for
performance reasons as it provides a small tight blocked memory footprint. PROX methods are
in their very derivation not limited to such friction models. PROX schemes provide one with
both a theoretical guarantee of convergence and a flexible modeling of any convex multi-set
friction law. For completeness we show the model can express Newton style impact laws, and
post-stabilization. The proximal operator model is derived directly from physical principles
and is in our opinion a very powerful approach. One benefit is that the iterative scheme for
computing a solution comes for free, more or less, directly from the model. No additional
discretization is needed. Another benefit of this model is that it generalizes to general limit
surfaces [Goyal et al. 1989] and can include torsional friction and Coulomb friction [Leine and
Glocker 2003].
3.4.1 The Proximal Operator Model. We will present a contact force model for a single contact
point. The notation makes use of a proximal operator, proxC (z). The proximal point of a
convex set C to a point z is the point in C that minimizes the distance to z,
proxC (z) ≡ arg min ∥z − x∥ 2 , z ∈ R𝑛 . (200)
x∈𝐶

this is called the proximal operator [Parikh and Boyd 2014]. This definition is illustrated in
Figure 25. For friction modeling we usually only require C to be convex. Notice that C is strict
convex then the solution is always unique. The weaker requirement of only being convex can
imply multiple solutions. One advantage of this formulation is that we can work with a C that
has a non-smooth boundary. That is the normal cone at a boundary point has a sub-space of
normals. The requirement for C to be convex is one of the ingredients connected to giving
strong guarantee that a fixed point scheme will converge. The proximal operator definition
can be weaken to give meaning for non-convex sets too. We do not go into this discussion in
this text.
Given the normal contact velocity 𝑣𝑛ˆ ∈ R then the non-penetration constraints can be stated
as
𝑣𝑛ˆ ≥ 0, 𝜆𝑛ˆ ≥ 0, and 𝑣𝑛ˆ 𝜆𝑛ˆ = 0 , (201)
or equivalently the fixed point relationship have the same solution as the non-penetration
constraint [Jourdan et al. 1998]
𝜆𝑛ˆ = proxN (𝜆𝑛ˆ − 𝑟𝑛ˆ 𝑣𝑛ˆ ) for 𝑟𝑛ˆ > 0 , (202)

92
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Fig. 25. The proximal operator for a set C applied to a point z. Observe that computing a solution x★
for the proximal operator is similar to point in set testing and projection to closest point on a boundary.
The set C can have a non-smooth boundary.

where N ≡ {𝛾 ∈ R | 𝛾 ≥ 0}, 𝜆n̂ ∈ R is the magnitude of the normal force, and 𝑟𝑛ˆ is a
mathematical scalar variable named an 𝑟 -factor, we use the subscript here to denote that
the value is specific for the normal force as we will see later friction forces can have their own
𝑟 -factor value. The equation holds for all 𝑟𝑛ˆ > 0 and the exact 𝑟 -factor value will have practical
impact on convergence. We can graphically illustrate how the proximal operator identifies the
same solutions as the complementary form of the non-penetration constraint by using the
real number line. Here N is all numbers from origin to the right. The case-by-case analysis is
shown in Figure 26.
It is not difficult to show that the proximal operator formulation includes all the LCP based
formulations. For doing this it is convenient to use the slightly more general proximal operator
definition
x★ ≡ proxKC (x − 𝑟 (Ax + b)) , K = A−1, C = {x | x ≥ 0} ∀𝑟 > 0 . (203)
Let z = x − 𝑟 (Ax + b) then by more general definition of the proximal operator we have
1
x★ ≡ arg min ∥x − z∥ 2K , (204)
x∈C 2

which we can algebraic transform into


x★ ≡ arg min 𝑟 2 (Ax + b)𝑇 K (Ax + b) . (205)
x∈C

The positive term 𝑟 2 can be dropped without affecting the solution of the minimization problem
and the quadratic term can be written out to yield the equivalent problem,
 
x★ ≡ arg min x𝑇 A𝑇 KAx + b𝑇 K A𝑇 + A x + b𝑇 Kb . (206)
x∈C

93
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

(a) (b)

Fig. 26. In (a) we observe that if the normal force is positive then the proximal operator only has a
fixed point if the normal velocity is zero. In (b) the case of zero normal shows that a fixed point only
exist if the normal velocity is non-negative. This proves the fixed point formulation with the proximal
operator has the same solutions as the non-penetration constraint.

Using the explicit choice of K = A−1 and assuming A is symmetric this reduces to
x★ ≡ arg min x𝑇 Ax + 2b𝑇 x (207)
x∈C
or
1
x★ ≡ arg min x𝑇 Ax + b𝑇 x . (208)
x∈C 2
This happens to be the equivalent quadratic problem (QP) reformulation of the linear com-
plementarity problem. This can be verified by noticing that the solution to the first order
optimality conditions for the QP formulation is the solution to the linear complementarity
problem. This completes the proof that solutions of LCP formulations are also solutions for
the proximal operator formulations.
Given the coefficient of friction 𝜇 > 0 and the magnitude of normal force 𝜆𝑛ˆ ≥ 0, then the
planar friction force 𝝀𝑡ˆ ∈ R2 is bounded by the friction cone,
𝝀𝑡ˆ ∈ F (𝜇𝜆𝑛ˆ ) (209)
where the friction cone could be defined as we did in Section 1.5,
F (𝜇𝜆𝑛ˆ ) ≡ 𝜸 𝑡ˆ ∈ R2 𝜸 𝑡ˆ ≤ 𝜇𝜆𝑛ˆ .

(210)
This is the typical isotropic Coulomb friction law. We will later show another example. For
the proximal operator model to work we only need F to be a convex set. We may visualize
the friction cone in 3D where the 𝑥 and 𝑦 axis gives the components of the frictional force
and the 𝑧-axis gives the normal force magnitude as shown in Figure 27. Another often used
visualization is to make a corresponding 2D visualization of the intersection of the cone with
the 𝑧-plane that corresponds to the current normal force as shown in middle of Figure 27.

94
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Fig. 27. On the left the isotropic Coulomb friction cone is shown as an ice-cream cone, in the middle
the 2D plane intersection with the normal force plane is representing the shape of the friction set, and
on the right we have a map of the set of coefficients of friction. Observe that the map of coefficients of
frictions is a convenient representation of any friction cone that can be used to generate both the 2D
friction set and the 3D friction cone if needed.

Because the friction force scales linear with normal force the shape of the 2D intersection will
not change for any positive normal force and we may therefore just draw the shape of the
cone for the normal force value 𝜆𝑛ˆ = 1. The cone shape then illustrates the magnitude of the
coefficient of friction for different directions, as seen on right side of Figure 27.
According to principle of maximum dissipation the friction force should dissipate as much
work as possible from the system. Given the friction force 𝝀𝑡ˆ ∈ F (𝜇𝜆𝑛ˆ ) and the tangential
contact velocity, v𝑡ˆ ∈ R2 , then the dissipation power, 𝑃𝝀𝑡ˆ , is,

𝑃𝝀𝑡ˆ = 𝝀𝑡ˆ𝑇 v𝑡ˆ . (211)


Note that dissipation implies that 𝑃𝝀𝑡ˆ < 0. According to the principle of maximum dissipation
the power, 𝑃𝜸 𝑡ˆ , done by any other possible friction force, 𝜸 𝑡ˆ ∈ F (𝜇𝜆𝑛ˆ ), has to be larger than or
equal to 𝑃𝝀𝑡ˆ . From this we have
𝑃𝝀𝑡ˆ ≤ 𝑃𝜸 𝑡ˆ , (212a)
𝑇
𝝀𝑡ˆ v𝑡ˆ ≤ 𝜸 𝑡ˆ𝑇 v𝑡ˆ , (212b)
𝑇
0 ≤ 𝜸 𝑡ˆ𝑇 v𝑡ˆ − 𝝀𝑡ˆ𝑇 v𝑡ˆ = 𝜸 𝑡ˆ − 𝝀𝑡ˆ v𝑡ˆ . (212c)
Resulting in the condition
𝑇
∀𝜸 𝑡ˆ ∈ F (𝜇𝜆𝑛ˆ ) and 𝜸 𝑡ˆ − 𝝀𝑡ˆ v𝑡ˆ ≥ 0 . (213)

95
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Recall, we derived this condition in Section 1.5 from first order optimality conditions, here we
just took a more direct geometric approach for deriving this condition. Now a solution to this
variational inequality is equivalent to the fixed point of the proximal operator,
𝝀𝑡ˆ = proxF (𝜇𝜆𝑛ˆ ) (𝝀𝑡ˆ − 𝑟𝑡ˆv𝑡ˆ) for 𝑟𝑡ˆ > 0 . (214)
Figure 28 illustrates how the principle of maximum dissipation is connected to the proximal
operator, by connecting the variational inequality to the definition of the tangent cone and
finally testing if −v𝑡ˆ is included in the normal cone at 𝝀𝑡ˆ. The tangent and normal cone
viewpoint is quite helpful in handling the case of zero sliding velocity. In this case we note
that there are no dissipating forces. This means the tangent cone is all directions in the plane
and the normal cone contains the zero-vector. This means that any force in the friction cone is
a solution to principle of maximum dissipation. Notice that the proximal operator will have
this solution htoo. i
𝑇 h i𝑇
Since v = 𝑣𝑛ˆ𝑇 v𝑡ˆ𝑇 can be written as a linear combination of 𝝀 = 𝜆𝑛ˆ𝑇 𝝀𝑡ˆ𝑇 we have
v = A𝝀 + b. The equation holds for all values of the variable 𝑟𝑡ˆ but the actual value used will
have impact on convergence. Substituting v into the proximal operator lead to a fixed point
problem,
" # " #
𝜆𝑛ˆ proxN (𝜆𝑛ˆ − 𝑟𝑛ˆ (ANN𝜆𝑛ˆ + ANF𝝀𝑡ˆ + bN ))
= . (215)
𝝀𝑡ˆ proxF (𝜇𝜆𝑛ˆ ) (𝝀𝑡ˆ − 𝑟𝑡ˆ (AFN𝜆𝑛ˆ + AFF𝝀𝑡ˆ + bF ))
|{z} | {z }
𝝀 F(𝝀)
Here N and F are index sets used to extract blocks from A corresponding to normal force
variables or friction force variables. Now one could compute the iterates, 𝝀𝑘+1 = F(𝝀𝑘 ), more
details are given in Section 3.4.2. The iteration sequence converges locally if the spectral radius
of the Jacobian,  
𝜕F(𝝀)
𝜌 < 1, (216)
𝜕𝝀
remains limited and smaller than one. This requirement can be realized by making a suitable
choice of the parameters 𝑟𝑛ˆ and 𝑟𝑡ˆ [Foerg et al. 2006; Niebe 2014; Parikh and Boyd 2014; Studer
2008].
The Newton-Euler equations and kinematic maps are given by
Mu¤ = f + J𝑇 𝝀 , (217a)
q¤ = H u , (217b)
where u is the generalized velocity vector, q is generalized position vector, M is the mass matrix,
J is the contact Jacobian, and f holds external and gyroscopic force terms, see Section 1.10.1
for details. The relative contact velocity is computed from
v = Ju . (218)

96
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

(a) (b)

(c) (d)

Fig. 28. The proximal operator can be derived from the principle of maximum dissipation. We start with
some convex friction cone and assume a non-zero sliding velocity. Given the velocity vector we may
look in the whole half-space of dissipating forces (a). In this space we locate the maximum dissipating
force as done in (b). In (c) we slightly reformulate the dissipation test to look at the force difference
vectors. Any such force difference vector must make a positive dot product with the velocity. That is
equivalent to saying that any direction in the tangent cone at 𝝀𝑡ˆ must make a positive product with
the velocity. Taking this one step further that means the negative velocity must be in the normal cone
at 𝝀𝑡ˆ . That is equivalent to say that any point on the half-line from 𝝀𝑡ˆ in the negative velocity direction
must have 𝝀𝑡ˆ as the closest point on the surface as shown in (d).

All the contact constraints are now formulated using proximal operators,
∀𝑖 𝜆𝑛𝑖ˆ = proxN𝑖 𝜆𝑛𝑖ˆ − 𝑟𝑛𝑖ˆ 𝑣𝑛ˆ 𝑖+ + 𝜀𝑛𝑖ˆ 𝑣𝑛ˆ 𝑖− ,

(219a)
∀𝑖 𝝀𝑡ˆ𝑖 = proxF𝑖 𝝀𝑡ˆ𝑖 − 𝑟𝑡ˆ𝑖 v𝑡ˆ𝑖+ + 𝜀𝑡ˆ𝑖 v𝑡ˆ𝑖−

(219b)

97
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

where sub-index 𝑖 refers the contact point index and


N𝑖 ≡ {𝛾 ∈ R | 𝛾 ≥ 0} , (220a)
   2 𝛾  2 𝛾  2 
3 𝛾𝑡 𝑏 𝜏
F𝑖 ≡ (𝛾𝑡 , 𝛾𝑏 , 𝛾𝜏 ) ∈ R + + ≤1 (220b)
𝑎 𝑏 𝑐
and
𝑎 = 𝜇𝑡𝑖 𝜆𝑛𝑖ˆ , 𝑏 = 𝜇𝑏𝑖 𝜆𝑛𝑖ˆ , and 𝑐 = 𝜇𝜏𝑖 𝜆𝑛𝑖ˆ . (221)
Above we exploit the advantage of the proximal operator to work for any convex set and
changed F to be the Coulomb-Contensou friction model, a generalization over the previous
definition in Equation 210. We used v− and v+ to denote pre- and post-impact contact velocities.
We have also applied a Newton impact law. Usually one has 𝜀𝑛𝑖ˆ ∈ [0, 1] and 𝜀𝑡ˆ𝑖 = 0. Further,
one may choose 𝑟 = 𝑟𝑛𝑖ˆ = 𝑟𝑡ˆ𝑖 > 0. Although other 𝑟 -factor strategies can be used. Using a
time-discretization on the differential equations we have
u𝑡+ℎ = u𝑡 + ℎM−1 f + M−1 J𝑇 𝝀 . (222)
Both M and J depends on q, f depends on both q and u due to gyroscopic force terms. For now
we ignore these dependancies and will specify them when we introduce the time-stepping
method in Section 3.4.5. The pre-impact contact velocities are given by v− = Ju𝑡 and the
post-impact velocities are given by v+ = Ju𝑡+ℎ . Multiplying Equation 222 by J from the left
yields,
v+ = JM−1 J𝑇 𝝀 + Ju𝑡 + ℎJM−1 f . (223)
Defining
z ≡ 𝝀 − R v+ + Ev− ,

(224a)
 
= 𝝀 − R JM−1 J𝑇 𝝀 + Ju𝑡 + ℎJM−1 f + EJu𝑡 (224b)
where R and E are diagonal matrices containing 𝑟 -factors and 𝜀-coefficients. Now the proximal
operators read

∀𝑖 𝜆𝑛𝑖ˆ = proxN𝑖 zN𝑖 , (225a)

∀𝑖 𝝀𝑡ˆ𝑖 = proxF𝑖 zF𝑖 . (225b)
The solutions of these are given by

∀𝑖 𝜆𝑛𝑖ˆ = max 0, zN𝑖 (226a)
(
zF𝑖 ; zF𝑖 ∈ F𝑖
∀𝑖 𝝀𝑡ˆ𝑖 = 2 . (226b)
arg min𝜸 ∈F𝑖 zF𝑖 − 𝜸 ; otherwise
The last case computes the closest point in the F𝑖 to the point zF𝑖 . This can be solved as
described in Section 3.4.3.

98
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

3.4.2 Iterative Methods for the Fixed-Point Scheme. A Jacobi-scheme can be used to solve the
fixed point problem in Equation 225. This consists of first computing the iterate,

z𝑘 = 𝝀𝑘 − R ­­JM−1 J𝑇 𝝀𝑘 + Ju𝑡 + ℎJM−1 f + EJu𝑡 ®® ,


© ª
(227a)
| {z } | {z }
« A b ¬
 
= 𝝀𝑘 − R A𝝀𝑘 + b . (227b)

We solve for the next iterate 𝜆𝑘+1 by


 
∀𝑖 𝜆𝑛ˆ 𝑘+1
𝑖 = prox 𝑘
N𝑖 zN𝑖 , (228a)
 
∀𝑖 𝝀𝑡ˆ𝑘+1
𝑖 = prox 𝑘
F 𝑘 zF𝑖 (228b)
𝑖

, where F𝑖 𝑘 is defined using the value of the 𝑘 th iterate, 𝑎 = 𝜇𝑡𝑖 𝜆𝑛ˆ 𝑘𝑖 , 𝑏 = 𝜇𝑏𝑖 𝜆𝑛ˆ 𝑘𝑖 and 𝑐 = 𝜇𝜏𝑖 𝜆𝑛ˆ 𝑘𝑖 .
As it stands the scheme is inherently easily parallelized.
A Gauss–Seidel scheme can be created from the Jacobi scheme. The idea is to always use the
most updated 𝝀-values in any computation. Let z denote the most updated value at all times.
The normal and friction solves for the 𝑖 th contact is now computed using,

𝜆𝑛ˆ 𝑘+1
𝑖 = proxN𝑖 zN𝑖 , (229a)

𝝀𝑡ˆ𝑘+1
𝑖 = proxF 𝑘+1 zF𝑖 . (229b)
𝑖

Observe that F𝑖 𝑘+1 is used instead of F𝑖 𝑘 . After having solved for 𝜆𝑛ˆ 𝑘+1
𝑖 and 𝝀𝑡ˆ𝑘+1
𝑖 then all z
dependent entries must be updated before moving on to the next contact. For this update
we present the factorization technique from [Erleben 2007]. The idea is to write z as z ≡
𝝀 + R (Jw + b) and use w ≡ M−1 J𝑇 𝝀. For convenience we introduce the index set of all the
bodies, B, and the index set of the 𝑖 th contact point, I ≡ {N𝑖 , F𝑖 }. Now we can find the most
updated value of zI before computing the contact forces,
zI = 𝝀𝑘I − R𝑖 (JIB w + bI ) . (230)
After having computed the contact forces we can update w so its value is ready for the next
contact,    
w = M−1 J𝑇 𝝀𝑘+1
I − 𝝀𝑘I . (231)
BI
We have summarized the complete schemes in Algorithms 11 and 12. We will keep on iterating
using the PROX scheme until the residual error has absolutely or relatively converged, or we
exceed a maximum iteration count. A residual error can defined as
e𝑘+1 = 𝝀𝑘+1 − 𝝀𝑘 . (232)

99
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

For making an implemetation we are missing two intrinsic parts of the PROX scheme, one is
how the closest points on an ellipsoid is computed and the other is how to control the 𝑟 -factors.
The next two subsection will cover these aspects.

Data: K: indices of all contacts, B indices of all bodies, J, M, b, R, 𝝀 0, 𝜈


Result:
 𝝀𝑘
𝑘, 𝝀𝑘 , 𝜖 𝑘 ← 0, 𝝀 0, ∞ ;

1

2 while not converged do


3 w ← M−1 J𝑇 𝝀𝑘 ;
4 z ← 𝝀𝑘 − R (J w + b);
5 foreach 𝑖 ∈ K do

6 𝜆𝑛ˆ 𝑘+1
𝑖 ← proxN𝑖 zN𝑖 ;

7 𝝀𝑡ˆ𝑘+1
𝑖 ← proxF𝑖 (𝜆𝑛ˆ 𝑘 ) zF𝑖 ;
𝑖
8 end
9 𝜖 𝑘+1 = 𝝀𝑘+1 − 𝝀𝑘 ∞ ;
10 if 𝜖 𝑘+1 > 𝜖 𝑘 then
11 R ← 𝜈R;
12 else   
13 𝝀𝑘 , 𝜖 𝑘 , 𝑘 ← 𝝀𝑘+1, 𝜖 𝑘+1, 𝑘 + 1 ;
14 end
15 end
Algorithm 11: The PROX Jacobi variant with adaptive 𝑟 -Factor strategy. For efficiency
the matrix product M−1 J𝑇 may be precomputed and stored in transposed form.

An interesting question to take note of is how good accuracy one can expect from these
iterative schemes. This is important when setting the tolerance for absolute convergence. If
too aggressive one will never find a solution and if too loose one will never get close enough.
Here we present a rough estimate of the upper bound of the expected residual error under the
best possible assumptions. Assume the scheme is in the limit of convergence that means that
the proximal operator fixed points has been reached. A fixed point means we have

𝝀★ = 𝝀★ − 𝑟 A𝝀★ + b .
The residual error is defined as the norm of the residual vector
   
e 𝝀𝑘+1 = 𝝀𝑘+1 − 𝝀𝑘 + 𝑟 A𝝀𝑘 + b .
In the limit of 𝑘 → ∞ and assuming convergence to the closest possible numerical representa-
tion 𝝀 of the fixed point solution 𝝀★ we have 𝝀 = (1 + 𝜀)𝝀★ where 𝜀 is the machine epsilon

100
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: K: indices of all contacts, B indices of all bodies, J, M, b, R, 𝝀 0, 𝜈


Result:
 𝝀𝑘
𝑘, 𝝀𝑘 , 𝜖 𝑘 ← 0, 𝝀 0, ∞ ;

1

2 while not converged do


3 w ← M−1 J𝑇 𝝀𝑘 ;
4 foreach 𝑖 ∈ K do
5 I ≡ indices of block N𝑖 , F𝑖 ;
6 zI ← 𝝀𝑘I − R𝑖 (JIB w + bI );

7 𝜆𝑛ˆ 𝑘+1
𝑖 ← proxN𝑖 zN𝑖 ;

8 𝝀𝑡ˆ𝑘+1
𝑖 ← proxF𝑖 (𝜆𝑛ˆ 𝑘+1 ) zF𝑖 ;
−1
𝑖  𝑘+1 𝑘

9 w ← w + M J B,I 𝝀 I − 𝝀 I ;
𝑇

10 end
11 𝜖 𝑘+1 = 𝝀𝑘+1 − 𝝀𝑘 ∞ ;
12 if 𝜖 𝑘+1 > 𝜖 𝑘 then
13 R ← 𝜈R;
14 else  
15 𝜆𝑘 , 𝜖 𝑘 , 𝑘 ← 𝜆𝑘+1, 𝜖 𝑘+1, 𝑘 + 1 ;
16 end
17 end
Algorithm 12: The PROX Gauss–Seidel variant with adaptive 𝑟 -Factor strategy. The
product M−1 J𝑇 may be precomputed as for the Jacobi variant.

and
∥e (𝝀)∥ ≤ 𝑟 𝜀 ∥A∥ 𝝀★ .
Of course 𝝀★ is computational unknown but a conservative upper bound can be computed
by tracking the minimum norm of the iterates. The adaptive 𝑟 -factor strategy guarantees a
contraction mapping and hence the bound will continue to improve while iterating. The norm
of A can be estimated too by exploiting the factorization of A ≡ JM−1 J or from computing
the spectral radius of the explicit assembly of A or by applying an iterative method such as
Powers method that avoids the need for actual explicit assembly of A.
3.4.3 Closest Point on Ellipsoid. For isotropic friction models or omission of torque effects
the ellipsoid collapses to a 2D ellipse and finding the closest point can be done analytically
by finding the largest positive real root of a 4th order polynomial. However, we consider the
Coulomb-Contensou law. That means our ellipsoid models anisotropic spatial friction with
torque effects and corresponds to computing the roots of 6th order polynomial. Hence, we seek

101
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

a robust and efficient numerical method. For general convex sets one may use the Minkowsky
difference to transform the problem into that of finding the closest point between the origin
and a convex set. The GJK algorithm is an example of such an algorithm exploiting these ideas.
The advantage of a GJK approach is that it is generally applicable to any friction model as
long as the limit surfaces defines a convex set. However, in our case the friction model is an
ellipsoid and the generality of GJK is uncalled for. Here we present an approach that exploits
the corresponding 6th order polynomial and apply a root finding method to search for the root.
Let 𝑎, 𝑏, 𝑐 > 0 be given. These parameters defines an ellipsoid surface. The ellipsoid surface
consists of all points x ∈ R3 where
𝑓 (x) = x𝑇 Kx − 1 = 0 (233)
and K is a positive diagonal matrix given by
 12 0 0 
𝑎
K = 0 1 (234)
0 .
 
 𝑏2 
0 1
 0 2
𝑐 
Given a point z ∈ R3 outside the ellipsoid, 𝑓 (z) > 0, then we wish to find the closest point, x★
on the ellipsoid surface to z,
1
x★ = arg min ∥x − z∥ 2 subject to 𝑓 (x) = 0 . (235)
𝑥 2
The first order optimality conditions yields
x★ − z − 𝜆★∇𝑓 (x★) = 0 . (236)
Using ∇𝑓 (x★) = 2Kx★ and 𝑡 = −2𝜆★ we have,
x★ = (𝑡K + I) −1 z . (237)
Further, we must have that x★ lies on the surface of the ellipsoid,
𝑓 (x★) = 𝑓 ((𝑡K + I) −1 z) = 0 . (238)
We now define this as a scalar function like this,
𝑔(𝑡) ≡ 𝑓 ((𝑡K + I) −1 z) , (239)
𝑎 2𝑧 12 𝑏 2𝑧 22 𝑐 2𝑧 32
= + + −1. (240)
(𝑎 2 + 𝑡) 2 (𝑏 2 + 𝑡) 2 (𝑐 2 + 𝑡) 2
Observe that the problem of finding the closest point has been reformulated into the problem
of finding a root of 𝑔(𝑡) = 0. From geometry, we know that the curve given by 𝑔(𝑡) can pierce a
non-degenerate ellipsoid in at most two points. If 𝑓 (z) > 0 then we are seeking the intersection
point with 𝑡 > 0. If 𝑓 (z) ≤ 0, then z is already inside the ellipsoid and we simply return z as
the solution.

102
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

For 𝑡 > 0 we have 𝑑𝑡𝑑 𝑔(𝑡) < 0. However, 𝑔(𝑡) is very steep for small 𝑡-values and very flat for
larger 𝑡-values. Thus, a binary search numerical method is a good choice for finding the positive
root of 𝑔(𝑡). Alternatively a Newton-Raphson method can be applied, although Erleben [2017]
found a Newton-Raphson method to diverge or find negative roots when the root approaches
the flat parts of the 𝑔-function.
An initial bracketing technique is needed for the binary search method. The minimum
𝑡-value for the search interval is given by 𝑡 min = 0 the maximum 𝑡-value for the search interval
can be estimated as,
𝑡 guess = max{𝑎, 𝑏, 𝑐}∥z∥ . (241)
The maximum 𝑡-value is then given by the minimum non-negative integer, 𝑘 where 𝑔(𝑡 max ) < 0
and 𝑡 max ≡ 𝛼 𝑘 𝑡 guess , where 𝛼 > 1 is the scalar expansion coefficient of the interval. Erleben
[2017] uses 𝛼 = 1.5. In order to make the binary search method more robust in the sense of
having better precision the problem can be scaled to be within the unit-cube. That is a scaling
factor is computed as
1
𝑠= (242)
max{1, 𝑎, 𝑏, 𝑐, 𝑧𝑡 , 𝑧𝑏 , 𝑧𝜏 }
and then re-define the problem as follows.
z ← 𝑠 z, and {𝑎, 𝑏, 𝑐} ← {𝑠 𝑎, 𝑠 𝑏, 𝑠 𝑐} . (243)
However, when the scheme has converged one must remember to convert the solution back to
the unscaled problem. The bisection method is summarized in Algorithm 13.
3.4.4 The 𝑟 -Factor Strategies. If the 𝑟 -value is sufficiently low then the fixed point schemes
will converge as proven by Foerg et al. [2006]; Studer [2008]. Convergence speed is expected
to be worse for small 𝑟 -values than larger 𝑟 -values. Let us study a simple example to build
intuition about how different 𝑟 values affect the fixed point search. For simplicity we will study
a 2D disk S defined by the radius Δ ∈ R+ . That is
S ≡ {𝝀 ∈ R2 | ∥𝝀∥ ≤ Δ} .
Then we iteratively compute
 
𝝀𝑘+1 ← proxS 𝝀𝑘 − 𝑟 v .
h i𝑇 h i𝑇
0
For a fixed given value of 𝑟 and v ≡ 0 1 and 𝝀 ≡ Δ 0 . The results of solving this
simple 2D example are shown in Figure 29. One can easily observe the benefit of larger 𝑟 -values
in this simple 2D example. A simple divergence example can be created as well by choosing S
to be the unit disk and solving
" # " # !!
2 1 −1
𝝀𝑘+1 ← proxS 𝝀𝑘 − 𝑟 𝝀𝑘 + .
1 2 1

103
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: {𝑎, 𝑏, 𝑐}: Ellipsoid shape parameters, z = {𝑧𝑡 , 𝑧𝑏 , 𝑧𝜏 }: Query point, 𝜖 > 0: User
specified accuracy
Result: x The closest point on the ellipsoid
1 // Re-scale problem for better numerical precision
1
2 𝑠 ← max(1,𝑎,𝑏,𝑐,|𝑧 𝑡 |,|𝑧𝑏 |,|𝑧𝜏 |)
;
3 z ← 𝑠 z;
4 {𝑎, 𝑏, 𝑐} ← {𝑠 𝑎, 𝑠 𝑏, 𝑠 𝑐};
5 // Perform inside ellipsoid test
6 if 𝑓 (z) < 𝜖 then
7 return z;
8 end
9 // Perform bracketing for root finding
10 𝑡 0 ← 0;
11 𝑡 1 ← max (𝑎, 𝑏, 𝑐) ∥c∥;
12 𝛼 ← 1.5 // Expansion coefficient, can be tuned
13 while 𝑔(𝑡 1 ) > 0 do
14 𝑡1 ← 𝛼 𝑡1;
15 end
16 // Perform root finding and compute closest point
17 𝑡 ∗ ← BisectionRootSearch(𝑔, 𝑡 0, 𝑡 1, 𝜖);

18 𝑡 ∗ ← 𝑠𝑡 2 ;
19 x ← 𝑡 ∗ (K + I) −1 z;
20 return x;
Algorithm 13: Numerical-Ellipsoid-Solver: Iterative numerical root finding method
for computing the closest point on an ellipsoid.

h i𝑇
0
Using 𝝀 ≡ 0 1 results in the behaviors seen in Figure 30. Here we see the benefit of
increasing the 𝑟 -value. The iterations in this example are illustrated in Figure 31.
We may apply an adaptive back-tracking approach for adjusting the 𝑟 -values to auto-tune
the 𝑟 -value for better convergence behavior while solving for the fixed point of the proximal
operator. Regardless of chosen strategy, if we detect divergence while iterating, ie. the norm of
the residual e𝑘+1 > e𝑘 then we drop updating 𝝀𝑘+1 . Instead we roll-back to 𝝀𝑘 and reduce
all 𝑟 -values by a user specified fraction 𝜈. We will next present three different strategies for
adjusting the 𝑟 -factors: global, local and blocked strategies.
For the global 𝑟 -factor strategy we simply initialize all 𝑟 -values of all constraints to a single
global constant value. Ideally based on theory by Foerg et al. [2006] one should initialize this

104
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Lambda Iterates 0
Fixpoint merit value
1 10
r = 0.2 r = 0.2
0.9 r = 0.4 -2 r = 0.4
10
r = 0.6 r = 0.6
0.8
r = 0.8 -4 r = 0.8
10
r=1 r=1
0.7
-6
10
0.6

0.5 -8
10

0.4 -10
10
0.3
-12
10
0.2
-14
10
0.1

0 -16
10
0 0.2 0.4 0.6 0.8 1 0 100 200 300 400

Fig. 29. Left figure illustrates the iterates of solving the 2D problem 𝜆 = prox S (𝜆 − 𝑟 v) where S is a
2D disk for different 𝑟 -values. The iterates have been re-scaled by 𝑟 /Δ to separate them into distinct
curves for better comparison. On the right the corresponding convergence is displayed. Observe that
the linear convergence rate constant depends on the 𝑟 -value. Notice that larger 𝑟 -values results in a
smaller constant.

to the reciprocal of the sum of the absolute values of the minimum and maximum eigenvalues
of A. However, these are not easily obtained.
For the local 𝑟 -factor strategy one would initially choose the 𝑟 -value of the 𝑖 th variable to be
1
𝑟𝑖 = . (244)
A𝑖𝑖
Comparing this choice to the algebraic form of the variable updates used in PGS and PSOR we
immediately recognize this as using a PGS-strategy for setting the initial value. If one used
𝑟𝑖 = A𝜔𝑖𝑖 where 𝜔 is the successive over-relaxation coefficient then the PSOR variant is achieved,
see Section 3.2 for derivation of PGS and PSOR. Hence, one may replace F𝑖 with a box-model
and keeping local 𝑟 -values as fixed constants and the PROX scheme will deteriorate into the
well known PGS/PSOR variants used in many physics engines.
For the blocked strategy the idea is to replace the scalar 𝑟 -values with small blocked matrices
build from the diagonal blocks of the A-matrix. Let us consider the 𝑘 th block corresponding to

105
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Iterates Iterates Convergence


1 1 2
r = 0.4 r = 0.4
r = 0.8 0.8 r = 0.8 1.8
0.8
r = 1.2 r = 1.2
0.6 1.6
r = 1.6 r = 1.6
0.6 0.4 1.4

0.2 1.2

merit value
0.4
x-value

y-value
0 1
0.2
-0.2 0.8

0 -0.4 0.6

-0.6 0.4
r = 0.4
r = 0.8
-0.2
-0.8 0.2 r = 1.2
r = 1.6
-0.4 -1 0
0 5 10 0 5 10 0 5 10
iteration iteration iteration

Fig. 30. Left figure illustrates the iterates of solving the 2D problem 𝜆 = prox S (𝜆 − 𝑟 (A𝜆 + b)) where
S is a 2D unit disk for different 𝑟 -values. As one may observe the convergence behavior gets worse for
larger 𝑟 -values in that the iterates starts to oscillate wildly.

Fig. 31. From left to right: the starting iterate, the effect of the first iteration, the second iteration, and
finally a sequence of operations. Observe how the 𝑟 value always "push" the iterate the same distance
in the −v direction. Increase 𝑟 -value makes the iterations go faster to the north pole of the disk.

the 𝑘 th contact, then the 𝑟 -factor strategy uses the block R𝑘 ∈ R4×4 ,
" #
1
0
R𝑘 = A𝑖𝑖 −1
, (245)
0 A𝑡:𝜏,𝑡:𝜏

106
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

where 𝑛 = 4𝑘, 𝑡 = 𝑛 + 1, 𝑏 = 𝑛 + 2, 𝜏 = 𝑛 + 3. The blocked strategy has been reported by Merlhiot


[2007] to work quite well.
For the global and blocked strategies one may use 𝜈 = 0.5 and for the local strategy 𝜈 = 0.9.
These values are not critical but was tuned experimentally and reported by Erleben [2017]. Note
𝑟 -factors are not the same as numerical damping or regularization as known from LCP methods
shown in Cottle et al. [1992]. For those the coefficient matrix is changed like A ← I𝜌 + A
for some damping parameter 𝜌 > 0. This changes the model and adds compliance to the
contact. The 𝑟 -factors does not change the model, the solutions hold for all positive 𝑟 -values.
The specific 𝑟 -value only affect the convergence constants. Erleben [2017] reports that local
𝑟 -value strategy combined with Gauss-Seidel type variant of PROX gives more predictable
performance in most cases, and that the global strategy for Jacobi scheme has interesting
capabilities for dealing with large structured stacks like masonry structures.
3.4.5 Time-Stepping Methods. The PROX schemes can be used with different time-stepping
methods. In this presentation we favor the mid-point scheme of Moreau [1999]. It consists of
using an explicit half-step position update
1 ℎ
q𝑡+ 2 = q𝑡 + H u𝑡 . (246)
2
1 1 1
Then one computes M = M(q𝑡+ 2 ), J = J(q𝑡+ 2 ) and f = f (q𝑡+ 2 , u𝑡 ) and solves
 1 
𝜆 = PROX-SOLVER q𝑡+ 2 , u𝑡 , ℎ, . . . , (247a)
u𝑡+1 = 𝑢 𝑡 + ℎM−1 f + 𝑀 −1 J𝑇 𝜆, (247b)
1 ℎ
q𝑡+1 = q𝑡+ 2 + u𝑡+1, (247c)
2
where PROX-SOLVER (. . .) denotes invocation of the PROX scheme developed above, see
Algorithm 11 and 12. Previous work on interactive simulation by Erleben [2007] have used
a simple semi-implicit scheme . Here we favor the Moreau-variant due to the mid-point
evaluation adds some “softness” into how contact is detected compared to the simpler semi-
implicit scheme.
3.4.6 Constraint Stabilization by Post-step Projection. The velocity based formulation solves
constraints on a velocity-level, and this means that numerical drift will occur for position-level
constraints. Regardless of how many iterations are used, there will also be some inaccuracy in
the constraint impulses.
Stabilization can be used to reduce constraint errors. For instance, Baumgarte stabilization
adds a penalty term to the kinematic constraints, and a spring-based version of this stabilization
technique was presented in Section 1.9. Alternatively, the approach we derive here is similar
in spirit to the one proposed by Baraff [1993] and Cline and Pai [2003]. It uses a position-level

107
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

update as a post-step process to resolve the constraint errors, and we further demonstrate how
this can be formulated using the prox operator.
Consider a gap vector 𝝓 containing penetration errors for all contacts at the current time
step. We can compute a gap-displacement that corrects constraint errors as
Δ𝝓 = 𝝓 ∗ − 𝝓 ,
where 𝝓 ∗ are the corrected gap values without constraint violation. Given a finite displacement
of the bodies, Δq = q∗ − q, the first order relationship mapping body displacements to changes
in the gap values can be written as
Δg = JΔq . (248)
Observe that here we write the gap displacements using a vector notation. However, if we
only want to correct the penetration error for one contact, then the gap displacement vector
would reduce to the scalar 𝜙.
From first-order physics, we have the equation of motion
MΔq = J𝑇 d . (249)
In this formulation, d are the contact displacements and J𝑇transforms the contact displacements
into body-displacements. The body-displacements are also weighted by the mass matrix M,
and this has the effect that linear contact displacements are distributed in a physical plausible
way as linear and rotational displacements of the bodies. From the above equation of motion,
we can write the body-displacements as
Δq = M−1 J𝑇 d . (250)
Next, we substitute the expression into our kinematic gap-equation:
Δ𝝓 = JM−1 J𝑇 d (251)
We seek a body displacement such that the gap-function becomes non-negative, such that
𝝓 ∗ = (Δ𝝓 + 𝝓) ≥ 0 . (252)
Recall that contact displacements can only “push” bodies apart, which means that d ≥ 0, and
furthermore we cannot have a contact displacement at a separated contact. Thus, we wish to
find a body displacement such that
(Δ𝝓 + 𝝓) ≥ 0, d ≥ 0 and d𝑇 (Δ𝝓 + 𝝓) = 0 . (253)
Combining these yields
   
−1 𝑇 𝑇 −1 𝑇
JM J d + 𝝓 ≥ 0, d ≥ 0 and d JM J d + 𝝓 = 0 , (254)
which is a linear complementarity problem. This can be re-cast as a proximal operator model
  
d = proxN d − 𝑟 JM−1 J𝑇 d + 𝝓 (255)

108
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

for all 𝑟 > 0 where N = N1 × · · · × N𝑛 . Having solved for d a position update can be performed.
q∗ = q + H(q)M−1 J𝑇 d . (256)
Recall that H(q) is the kinematic mapping between velocities and positions. The above equation
can be seen as computing an instantaneous change of the body positions disregarding velocities,
external forces or velocity dependent forces. The scheme is of course based on a linearization
of the true gap-function. Therefore, it may not be able to resolve the errors with a single step
and quite often several steps must be taken.

109
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

4 SOFT BODY CONTACT APPROACHES


In Section 1.10, we introduced the first concepts and notation needed to understand how to
deal with solving contact for soft bodies compared to rigid bodies. The focus was on how
to assemble the system of ordinary differential equations that explain the dynamics of soft
bodies due to elastic deformations, material damping and contact forces. This resulted in
Equation 76, which we then combined with an implicit time-discretization approach to derive
a complementarity model for soft body contact.
In this chapter, we will rewind and elaborate further into several of the typical techniques
used for dealing with time-discretizations of soft body contact, as well as the numerical methods
that have dominated soft body dynamics solvers. Hence, our goal is to provide a more nuanced
overview of simulating soft body contact, as well to dive deeper into some of the limitations
that pop-up when shifting from rigid to soft bodies.

4.1 Equations of Motion for a Collection of Soft Bodies


We begin by restating the differential equations that govern soft body motion:

M¥q = fext + fd (u) + fe (q) + fc (q, u) (257)

Here, q is the concatenation of the positions of all mesh nodes, u are the velocities of those
nodes, and fext are the external forces acting on the nodes. The matrix M is the mass matrix
of the soft bodies, fd (u) are damping forces, fe (q) are the internal elastic forces, and fc (q, u)
gives the contact forces between soft bodies (or the same body in the case of self-collision).
We next make an important conceptual change about how the simulation views multiple soft
bodies. Consider that there are 𝑁 nodes in a multi-body system, and assume that each body is
modeled using a tetrahedral mesh, which is a common choice for computer graphics. We can
then assemble all tetrahedral elements of all the soft bodies into one single global tetrahedral
mesh, and thus the dimensions of the introduced quantities are q, u, fext, fe, fd, fc ∈ R3 𝑁 and
M ∈ R3 𝑁 ×3 𝑁 . This is convenient as there is really no need to think of a collection of individual
local volume meshes (i.e., one for each soft body). From a numerical viewpoint, the simulation
is now just a big soup of volume elements, with some elements being connected and others are
not. From an implementation viewpoint, there are also benefits since soft-bodies are simply
subsets of the global state. Therefore, there are memory footprint and computational savings
since information does not have to be copied back-and-forth between “global” and “local” data
structures before and after each time-step.
Having merged all bodies into one global volume mesh, let us revisit how to assemble the
contact Jacobian when using a constraint-based approach. That is we have fc (q, u) ≡ J(q)𝑇 λ
where λ contains the Lagrange multipliers for the contact forces. The Lagrange multiplier
could depend on u if friction forces are included. Here we keep notation simplified to not
over-clutter the presentation. Much of what we will present in this chapter holds for both

110
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

non-penetration and friction forces, and any of the models and constraint formulations we
have presented elsewhere can in principle be used for setting up a model to solve for λ.
In Section 1.4.2, we derived the contact Jacobian for the case of non-interpenetration at a
single contact point defined by the node of one tetrahedral element colliding with a second
element. The barycentric coordinates of the tetrahedral element that embed the contact point
are used to setup the Jacobian. The same recipe can now be used in a more general setting.
Let p ∈ R3 be the position of a contact point occurring between two tetrahedral elements.
Let one element be denoted by 𝐴 with nodal indices 𝑖, 𝑗, 𝑘 and 𝑚, and the other element be
denoted by 𝐵 with nodal indices 𝑛, 𝑜, 𝑝, and 𝑟 . Using barycentric coordinates, we can write the
position of a contact point as a weighted sum of the nodal positions of element 𝐴:

p𝐴 = 𝑤𝑖 x𝑖 + 𝑤 𝑗 x 𝑗 + 𝑤𝑘 x𝑘 + 𝑤𝑚 x𝑚

Here, x{𝑖,𝑗,𝑘,𝑚} are the nodal positions, and 𝑤 {𝑖,𝑗,𝑘,𝑚} are the barycentric coordinates, with
subscripts indicating the corresponding node index. A similar expression can be written for
the contact point using element 𝐵’s nodal positions as follows:

p𝐵 = 𝑤𝑛 x𝑛 + 𝑤𝑜 x𝑜 + 𝑤 𝑝 x𝑝 + 𝑤𝑟 x𝑟

Obviously, at the time of contact, we have p = p𝐴 = p𝐵 . The relative velocity at the contact
point is then given by

 
𝜕p𝐵 𝜕p𝐴
Δv = − .
𝜕𝑡 𝜕𝑡

However, it is more convenient to express the relative velocity in the contact space, which is
achieved by projecting Δv onto the vectors spanning the local coordinate frame, such that

h i𝑇
v = 𝑛ˆ 𝑡 𝑏 Δv .
ˆ ˆ
| {z }
C𝑇

111
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Since the barycentric coordinates do not depend on time, we rewrite the above equation as:
v 
 𝑖
 
 v𝑗 
 
v 
 𝑘
h i v 
𝑚
v = C𝑇 −𝑤𝑖 I3×3 −𝑤 𝑗 I3×3 −𝑤𝑘 I3×3 −𝑤𝑚 I3×3 𝑤𝑜 I3×3 𝑤 𝑝 I3×3 𝑤𝑞 I3×3 𝑤𝑟 I3×3   .
| {z }  v𝑜 
J  v𝑝 
 
v 
 𝑞
 
 v𝑟 
 
|{z}
u
Here we have the nodal velocities given by sub-scripted v’s. Equivalently we can write J for a
single contact between colliding elements as:
h i
J = −𝑤𝑖 C −𝑤 𝑗 C −𝑤𝑘 C −𝑤𝑚 C 𝑤𝑜 C 𝑤 𝑝 C 𝑤𝑞 C 𝑤𝑟 C
𝑇 𝑇 𝑇 𝑇 𝑇 𝑇 𝑇 𝑇 (258)
This form is closer to how one would implement the assembly of the J matrix. If there are
multiple contact points and multiple tetrahedral elements, then Equation 258 is repeated for
each contact. The global matrix J for all contacts and all elements can then be assembled in a
sparse block-wise fashion, where for each contact a 3-by-3 block is added to the global matrix
corresponding to each of the vertices of elements involved in the contact. In fact, there could
be multiple contacts between two given tetrahedral elements, in which case the barycentric
coordinates would be different in the corresponding block-rows of J, but the fill pattern would
be the same. Hence, if there are 𝐾 contacts, then the global Jacobian matrix has dimensions
J ∈ R3 𝐾×3 𝑁 and the vector of constraint impulses is 𝝀 ∈ R3 𝐾 . Algorithm 14 shows how to
perform the assembly given a collection of 𝐾 contact points.

4.2 Approaches to Time Discretization


The semi-implicit first-order time discretization from Section 1.2 is a popular scheme for
fast and interactive rigid body simulators. However, for soft bodies with stiff elasticity, such
schemes are often avoided as they limit the time-step sizes. Rather, implicit schemes are sought,
and in this section we embark on explaining these variations that are common to soft body
contact simulations [Baraff and Witkin 1998].
There are two general approaches for time stepping soft body simulations. One approach
is based on deriving a non-smooth root finding problem, where solving for the roots yields
the time-updated state vectors. The second approach is based on formulating an optimization
problem for minimizing an energy potential, and a first-order optimizer is used to produce a
solution of the time-updated state vectors. The minimization approach can be further broken

112
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: Collection of all contacts K, numbers of contacts 𝐾, and number of nodes 𝑁


Result: Contact Jacobian matrix J.
1 J ← create a 𝐾 × 𝑁 blocked sparse matrix 3 × 3 blocks;
2 foreach 𝑐 ∈ K do
3 ˆ 𝑡ˆ, 𝑏ˆ ≡ contact normal, tangent and binormal contact 𝑐;
𝑛,
4 C ≡ block row index for contact 𝑐;
5 I, J, K, M, O, P, Q, R ≡ block column indices for vertices of contact 𝑐;
6 𝑤𝑖 , 𝑤 𝑗 h, 𝑤𝑘 , 𝑤𝑚 , i𝑤𝑜 , 𝑤 𝑝 , 𝑤𝑞 , 𝑤𝑟 ≡ barycentric coordinates of contact 𝑐;
7 C ← 𝑛ˆ 𝑡ˆ 𝑏ˆ ;
8 JC,I ← −𝑤𝑖 C𝑇 ;
9 JC,J ← −𝑤 𝑗 C𝑇 ;
10 JC,K ← −𝑤𝑘 C𝑇 ;
11 JC,M ← −𝑤𝑚 C𝑇 ;
12 JC,O ← 𝑤𝑜 C𝑇 ;
13 JC,P ← 𝑤 𝑝 C𝑇 ;
14 JC,Q ← 𝑤𝑞 C𝑇 ;
15 JC,R ← 𝑤𝑟 C𝑇 ;
16 end
17 return J
Algorithm 14: AssembleSoftBodyJacobian Assembly of the contact Jacobian for soft
bodies is accomplished by iterating over contacts and filling in J row-by-row. Each row
block has exactly 8 non-zero column blocks, for a total of 24 non-zero values for each row.
Hence, J is often quite sparse for soft bodies since the degrees of freedom 3 𝑁 is typically
larger than 3 𝐾.

down into (i) position-level and (ii) velocity-level approaches. We briefly derive both variants
below to illustrate their differences.
4.2.1 Root-finding Approach. Starting from the equations of motion, we rewrite the second-
order ODE in Equation 257 into a system of coupled first-order ODEs:

Mu¤ = fext + fd (u) + fe (q) + fc (q, u) , (259a)


q¤ = u (259b)

This avoids difficulties related to the treatment of higher order time derivatives. There are many
different ways of deriving the specific root-finding formulation that will give us a time-update.
One way to present the generic recipe for the derivation is as follows:

113
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

(1) Write the full system of equations. There are two main forms: the primary form and the
dual form.
(2) Apply finite difference approximations to all time-derivatives to derive the root-finding
function. The finite difference approximation originate from the chosen time-integration
method. However, below we show only the derivation for implicit Euler integration,
although this recipe will work for other integration schemes.
(3) Derive the equation for Newton’s method by substituting first-order Taylor approxi-
mations and then reformulate using matrix notation. This results in a linear system. In
practice one may solve this linear system in many different ways (e.g., applying Schur
complement reduction techniques, preconditioners, or iterative solvers). We refer you to
other chapters for more details about numerical solver methods.
The above steps give the recipe for assembling the Newton equations, and iteratively assembling
and solving this equation yields a final approximate solution for time stepping the simulation.
Primary Form. Equation 259 is not necessarily complete in its current form, since it also
depends on the contact model. However, for the moment, we consider that the contact forces
are the negative gradient of some potential function, Ec , whose specific algebraic form depends
on the chosen contact model. We may now write fc (q, u) ≡ −∇q Ec (q, u).
Next, the equations of motion are discretized and rewritten using the implicit Euler method,
giving
u𝑡+ℎ − u𝑡
M = fext + fd (u𝑡+ℎ ) + fe (q𝑡+ℎ ) + fc (q𝑡+ℎ , u𝑡+ℎ ) (260a)

q𝑡+ℎ − q𝑡
= u𝑡+ℎ , (260b)

where superscripts denote the time that a physical quantity is evaluated, and quantities without
a superscript are considered time independent. A slight reorganization of Equation 260 gives:
" # " #
M u𝑡+ℎ − ℎ fd (u𝑡+ℎ ) − ℎ fe (q𝑡+ℎ ) − ℎ fc (q𝑡+ℎ , u𝑡+ℎ ) − M u𝑡 − ℎ fext 0
= . (261)
q𝑡+ℎ − ℎ u𝑡+ℎ − q𝑡 0
| {z }
≡Fprimary

Having defined this vector function Fprimary , we derive the problem of computing the time-
updated values q𝑡+ℎ and u𝑡+ℎ as a root-finding problem:
compute q𝑡+ℎ and u𝑡+ℎ
s.t. Fprimary (q𝑡+ℎ , u𝑡+ℎ ) = 0
Moving forward, we remove the superscripts and simply say that we are searching for q and
u where Fprimary (q, u) = 0. Such a root-finding problem can be solved by applying Newton’s

114
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

method. Assuming values q𝑘 and u𝑘 at the 𝑘 th -iterate are known, we seek updates Δq and Δu:
q𝑘+1 ← q𝑘 + Δq (262a)
u𝑘+1 ← u𝑘 + Δu (262b)
We omit details of a line-search, but this can be incorporated by adding a step-length parameter
to above equations. The first-order Taylor approximations of the terms in Equation 261 can
thus be written as:
M u𝑘+1 ≈ M u𝑘 + M Δu
ℎ fd (u𝑘+1 ) ≈ ℎ fd (u𝑘 ) + ℎ B𝑘 Δu
ℎ fe (q𝑘+1 ) ≈ ℎ fd (q𝑘 ) + ℎ K𝑘 Δq
ℎ fc (q𝑘+1, u𝑘+1 ) ≈ ℎ fc (q𝑘 , u𝑘 ) − ℎ H𝑘q Δq − ℎ H𝑘u Δu

Note that B𝑘 and K𝑘 are the well-known damping matrix and the stiffness matrix [Kim and
Eberle 2020; Sifakis and Barbic 2012]:
𝜕fd (u𝑘 ) 𝑘 𝜕fe (q𝑘 ) 𝑘 𝜕 2 Ec (q𝑘 , u𝑘 ) 𝜕 2 Ec (q𝑘 , u𝑘 )
B𝑘 ≡ ,K ≡ , Hq ≡ , and H𝑘
u ≡ .
𝜕u 𝜕q 𝜕q2 𝜕q𝜕u
Combining the approximations above with Fprimary and adopting a short-hand notation of the
super-script denoting time or iterate where a term is evaluated, this gives the set of equations:
"   # "  #
M − ℎ B + ℎ Hu Δu − ℎ Hq − K Δq
 
𝑘 𝑘 𝑘 𝑘 M u − u + ℎ fd + fe + fc + fext
𝑡 𝑘 𝑘 𝑘 𝑘
=
−ℎ Δu + Δq q𝑡 − q𝑘 + ℎu𝑘
Furthermore, it can be shown that Δq = ℎ Δu. We use this relation to further simplify the
system:
"  # "  #
M − ℎ B𝑘 − ℎ 2 𝐾 𝑘 + ℎ H𝑘u + ℎ 2 H𝑘q Δu

M u𝑡 − u𝑘 + ℎ fd𝑘 + fe𝑘 + fc𝑘 + fext
=
−ℎ Δu + Δq q𝑡 − q𝑘 + ℎu𝑘
A solution can thus be obtained by solving the first row for Δu, then substituting this solution
into the second row and solving for Δq. Finally, the solution of the current iterate is updated
using Equation 262.
There are cases where the terms Hq and Hu may be simplified. For instance, if no damping is
present in the normal forces and a “lagging” model is used to approximate the friction directions,
then the velocity dependent term can be set to zero. Also, using a diagonal approximation of
Hq gives rise to another type of approach that is similar to adding geometric stiffness of the
contacts.

115
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Dual Form. For constraint-based approaches, then the contact forces can be computed
as Langrange multipliers, fc ≡ J𝑇 λ, as we have already seen in earlier chapters. Recall
that the Jacobian matrix depends on q, and the Lagrange multipliers λ represent both non-
interpenetration and friction forces. The λ originate from a set of constraints that describes the
feasible contact forces, and thus the motion ODEs need to be augmented with these constraint
equations. This results in a set of differential algebraic equations (DAEs).
However, we use a more generic form of the constraints to describe the high-level ideas
of the theory. The equations of motion are augmented with the constraint function, 𝜓 , that
models feasible normal and friction forces, such that 𝜓 (𝜙 (q), λ) = 0. Combining it with the
set of coupled first-order differential equations from before, the system of equations for the
constraint-based formulation can be written as:
Mu¤ = fext + fd (u) + fe (q) + J𝑇 λ
q¤ = u
𝜓 (𝜙 (q), λ) = 0
Once again, applying the implicit Euler integration method gives the discretized form:
 𝑇
𝑡+ℎ 𝑡 𝑡+ℎ 𝑡+ℎ
M u − M u = ℎ fext + ℎ fd + ℎ fe + ℎ J 𝑡+ℎ
λ𝑡+ℎ (263a)
q𝑡+ℎ = q𝑡 + ℎ u𝑡+ℎ (263b)
 
𝜓 𝜙 (q𝑡+ℎ ), λ𝑡+ℎ = 0 (263c)

Some further reorganization of terms gives the root-finding function:


M u𝑡+ℎ − u𝑡  − ℎ f − ℎ f 𝑡+ℎ − ℎ f 𝑡+ℎ − ℎ J𝑡+ℎ 𝑇 λ𝑡+ℎ  0
 ext d e   
 

 q𝑡+ℎ − q𝑡 − ℎ u 𝑡+ℎ =
 0 .
 
   
𝜓 𝜙 (q𝑡+ℎ ), λ𝑡+ℎ 0
 
   
 
| {z }
≡Fdual

We are now ready to perform substitutions using first-order Taylor approximations. It is often
assumed that the contact Jacobian does not change significantly over a time-step, hence it
can be seen as time independent. Sticking with this assumption, and re-scaling the Lagrange
multiplier by the time-step ℎ, gives:
 A𝑘 0 −J𝑇   Δu   b𝑘 

   
   q𝑡 − q𝑘 + ℎu𝑘 
 −ℎI I 0   Δq  =   (264)
 
     
 0 ∇q𝜓 𝑘 ∇𝝀𝜓 𝑘  Δ𝝀  −𝜓 𝜙 (q𝑘 ), 𝝀𝑘 
     

116
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

where
 
A𝑘 ≡ M − ℎ B𝑘 − ℎ 2 K𝑘 ,
   
b𝑘 ≡ M u𝑡 − u𝑘 + ℎ fext + fd𝑘 + fe𝑘 − J𝑇 𝝀𝑘 .

Again, the superscript indicates the time step or iterate where a term is evaluated, and
additionally we adopt the following short-hand notation:
   
𝜕𝜓 𝜙 (q𝑘 ), 𝝀𝑘 𝜕𝜓 𝜙 (q𝑘 ), 𝝀𝑘
∇q𝜓 𝑘 ≡ and ∇𝝀𝜓 𝑘 ≡ .
𝜕q 𝜕𝝀

We have now derived the Newton equation in its most generic form. Section 3.3 later provides
a more in-depth presentation about how to solve this type of system for the specific case of
isotropic Coulomb friction models.

4.2.2 Position-level Minimization Approach. We next consider another class of methods for
time-stepping soft body systems. Optimization-based approaches rewrite the time-integration
problem as a minimization problem where a first-order optimization technique can be applied to
compute kinematic quantities at the end of each time-step. Upon convergence, the optimization-
based approaches should give the same solutions as the root-finding approaches, even though
intermediate solutions may be different. Hence, we postulate that the solution of the constrained
minimization problem

1
q𝑡+ℎ ≡ arg min (q − q̃)𝑇 M (q − q̃) + ℎ 2 Ee (q) − q𝑇 ℎ 2 fd (u) (265)
q,𝜙 (q)≥0 2
| {z }
≡𝑓 (q,u)

is a solution to the fully implicit Euler time integration. The first term of Equation 265 minimizes
the momentum potential, where q̃ = q𝑡 + ℎ u𝑡 + ℎ 2 M−1 fext . The second term minimizes the
energy potential of elastic strain, Ee , and the third term maximizes work done by damping
forces, fd .
Stating the optimization problem is only the first step. We must next derive the optimality
conditions that a solution of the minimization problem must satisfy. To do so, we write the
Lagrangian function

L (q, u) ≡ 𝑓 (q, u) − 𝜸 𝑇 𝜙 (q) ,

117
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

where 𝜸 ≥ 0 are the Lagrange multipliers for unilateral constraints 𝜙 (q) ≥ 0. We thus define
the first-order optimality conditions by the gradient of the Lagrangian:
𝑇
𝑡+ℎ 𝑡+ℎ 𝑡+ℎ 𝑡+ℎ 𝜕𝜙 (q𝑡+ℎ )
∇q L (q ,u ) = ∇q 𝑓 (q ,u )− 𝜸 = 0,
𝜕q
𝜸 ≥ 0,
𝜙 (q𝑡+ℎ ) ≥ 0 ,
𝜸 𝑇 𝜙 (q𝑡+ℎ ) = 0 .
The last three equations
 can be replaced by the NCP function that was previously introduced.
That is, 𝜓 𝜙 (q𝑡+ℎ ), 𝜸 = 0. Expanding 𝑓 (q𝑡+ℎ , u𝑡+ℎ ) from Equation 265, the derivative is
rewritten
 𝑇
∇q L (q𝑡+ℎ , u𝑡+ℎ ) = M (q − q̃) + ℎ 2 ∇q Ee (q) − ℎ 2 fd (u) − J𝑡+ℎ 𝜸 ,

𝜕𝜙 (q𝑡 +ℎ )
where J𝑡+ℎ ≡ 𝜕q is the Jacobian of the contact constraints. The elastic forces are the negative
gradient of the strain energy potential, fe (q) ≡ −∇q Ee (q), and so the above expression can be
simplified even further:
   𝑇
𝑡+ℎ 𝑡+ℎ 𝑡+ℎ 2 𝑡+ℎ 2 𝑡+ℎ 𝑡+ℎ
∇q L (q , u ) = M q − q̃ − ℎ fe (q ) − ℎ fd (u ) − J 𝜸.

Finally, substituting for q̃ gives:


 𝑇
Mq𝑡+ℎ − Mq𝑡 − ℎMu𝑡 − ℎ 2 fext − ℎ 2 fe (q𝑡+ℎ ) − ℎ 2 fd (u𝑡+ℎ ) − J𝑡+ℎ 𝜸 = 0
 𝑇
⇒ ℎMu𝑡+ℎ − ℎMu𝑡 − ℎ 2 fext − ℎ 2 fe (q𝑡+ℎ ) − ℎ 2 fd (u𝑡+ℎ ) − J𝑡+ℎ 𝜸 = 0
  1  𝑡+ℎ 𝑇
⇒ M u𝑡+ℎ − u𝑡 − ℎfext − ℎfe (q𝑡+ℎ ) − ℎfd (u𝑡+ℎ ) − J 𝜸 =0

Compared with Equation 263a, the above expression is almost identical. The last piece of the
puzzle comes with the realization that substituting 𝜙 ← ℎ 2𝜙 and 𝛾 ← ℎ1 𝝀𝑡+ℎ do not change
the underlining problem, but makes the equations match exactly.
The minimization approach for the primal form comes easy by recalling that fc (q, u) ≡
−∇q Ec (q, u). Hence, the equivalent minimization problem of the primal form is given by:
1
q𝑡+ℎ ≡ arg min (q − q̃)𝑇 M (q − q̃) + ℎ 2 Ee (q) + ℎ 2 Ec (q, u) − q𝑇 ℎ 2 fd (u)
q 2
Observe that the unilateral constraint is gone, and instead we have an unconstrained mini-
mization problem to solve.

118
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Position-level minimization approaches have become fundamental for implicit integration of


soft body simulations. In Section 5.2, one such approach is presenting that combines a Newton
method with a line-search technique based on continuous collision detection.

4.2.3 Velocity-level Minimization Approach. A velocity form of the minimization approach


presented in the previous section may also be derived, such that

1
u𝑡+ℎ ≡ arg min (u − ũ)𝑇 M (u − ũ) + ℎ Ee (q) ,
u, Ju≥0 2

where ũ ≡ u𝑡 + ℎM−1 fext . Here, damping forces are ignored. In this approach, the constraint
function 𝜙 (q) is approximated by its first-order Taylor expansion 𝜙 (q) ≈ 𝜙 (q𝑡 ) +ℎJu ⇒ J u ≥
0. This assumes that initially 𝜙 (q𝑡 ) = 0. Further, the elastic force term is handled by considering
q as a function of u. Applying the chain rule gives:

𝜕q 𝑇 𝜕Ee (q)
∇u Ee (q) = ,
𝜕u 𝜕q
1 𝜕Ee (q)
= .
ℎ 𝜕q

Many of the ideas from solving the position-level minimization problem can be transferred to
the velocity-level formulation, and so we do not expand further on velocity level approaches in
these notes. The velocity-level formulation as stated here is often not used for soft body
contact problems. Instead, the position-based formulation is preferred as the non-linear
form of constraints is maintained. The velocity level formulation has been used for fluid
simulations [Batty et al. 2007].

4.3 A Taxonomy of Preconditioners for Dual Form Approaches


So far, we have presented several fundamental approaches for how to formulate the time
integration problem as either a root-finding problem or a minimization problem. We focused
completely on the full implicit first order time integration. These approaches are quite powerful
and represent the state-of-the-art for soft body dynamics with contact. In contrast, we will
now cover a range of approaches and techniques that have been used to create fast and
efficient simulators. Before diving into the details, we briefly outline the general idea behind
many of these methods we will cover. We will write up a typical form of a first-order Euler

119
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

time-discretized system as:


Mu𝑡+ℎ − ℎ fd (u𝜏 ) − ℎ fe (q𝜏 ) − J𝑇 𝝀𝑡+ℎ = ℎ fext + Mu𝑡
q𝑡+ℎ − ℎ u𝑡+ℎ = q𝑡
𝜙 (q𝑡+ℎ ) ≥ 0
𝝀𝑡+ℎ ≥ 0
𝜙 (q𝑡+ℎ )𝑇 𝝀𝑡+ℎ = 0
This is the dual form, but with the NCP written using three equations rather than a single
equation. Furthermore, 𝜏 is used to abstract over implicit versus explicit choices for evaluating
elastic and damping forces. Recall that J is dependent on q. Hence, strictly speaking a full
implicit time-stepping would use J𝑡+ℎ in above equations. Here we assume contact information
stays unchanged over the time-step. This way notation is less verbose when we present our
ideas. All concepts do extend to the full implicit notation as well.
When working with constraint-based approaches, such as the one above, typically a lin-
earization of the constraint is used:
𝜕𝜙 (q𝑡+ℎ ) 𝑡+ℎ
𝜙 (q𝑡+ℎ ) ≈ 𝜙 (q𝑡 ) + ℎ u ≥0 (266a)
𝜕q
⇒ 𝜙 (q𝑡 ) + ℎJ u𝑡+ℎ ≥ 0 (266b)
1
⇒ J u𝑡+ℎ ≥ − 𝜙 (q𝑡 ) (266c)

This form reveals that constraint errors can be corrected, or future contacts anticipated, by
keeping the term − ℎ1 𝜙 (q𝑡 ) and results in a Baumgarte-type of constraint stabilization, as we
saw in Section 1.9.
Other approaches assume that constraints are only formed when touching contact exists
between soft bodies. This implies 𝜙 (q𝑡 ) = 0, and the right-hand side of Equation 266c can
be set to zero. Defining v𝑡+ℎ ≡ J u𝑡+ℎ and 𝜖 𝑡 ≡ − ℎ1 𝜙 (q𝑡 ), we can then rewrite the system of
equations as:
Mu𝑡+ℎ − ℎ fd (u𝜏 ) − ℎ fe (q𝜏 ) − J𝑇 𝝀𝑡+ℎ = ℎ fext + Mu𝑡
q𝑡+ℎ − ℎ u𝑡+ℎ = q𝑡
v𝑡+ℎ = J u𝑡+ℎ
0 ≤ v𝑡+ℎ − 𝜖 𝑡 ⊥ 𝝀𝑡+ℎ ≥ 0
This is the form of the soft body system with contact we will work with going forward. The
approach for solving this problem now depends on the specific choice of using 𝜏 = 𝑡 or 𝜏 = 𝑡 +ℎ
for each of the terms in the first equation of our system. These choices combined with solving

120
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

for u𝑡+ℎ from the first equation and substituting into the third equation results in a reduced
complementarity problem of the form:

0 ≤ WP 𝝀𝑡+ℎ + wP ⊥ 𝝀𝑡+ℎ ≥ 0
The subscript on the Delassus operator WP and right-hand side vector wP is used here to
denote that different decisions in the different methods lead to different matrices and vectors.
We will show how these derivations are done a bit later.
Once the complementarity problem is solved, 𝝀𝑡+ℎ is known and u𝑡+ℎ can be computed
from the first equation. Finally, from the second equation we obtain q𝑡+ℎ . Hence, u𝑡+ℎ may be
eliminated from the first and third row of our system to give the reduced system:

Mu𝑡+ℎ − ℎ fd (u𝜏 ) − ℎ fe (q𝜏 ) − J𝑇 𝝀𝑡+ℎ = ℎ fext + Mu𝑡 ,


v𝑡+ℎ = J u𝑡+ℎ
Now, our attention turns toward finding methods of efficiently computing WP , or methods
that give WP a simple form that allows us to solve the complementarity problem easily. A key
insight from this mathematical exercise is that we can frame the methods as different choices
 −1
for computing the preconditioner P ≈ M + ℎB + ℎ 2 K , and then preconditioned form of the
Delassus operator may be used, such that

WP ≡ J P J𝑇 .
Hence, the subscript now simply denotes a specific choice of preconditioner. We are now ready
to outline the many different choices of preconditioners that can be applied.
4.3.1 Quality of a Preconditioners. By a “good” preconditioner, we mean P A ≈ I. Expanding
the system matrix as A ≡ M + ℎB + ℎ 2 K allows us to write a more exact definition:

P M − ℎ B − ℎ2 K ≈ I


Clearly, this is only a good approximation for ℎ → 0. Observe the ℎ 2 term on the stiffness
matrix. This too reveal that when lowering the value of ℎ which is necessary to have a good
preconditioner then we get a more “weak” coupling of anticipation of how elastic forces work
between mesh nodes.
The view that different methods are simply different preconditioner choices allow us to
interpret and rank the methods in terms of how close their preconditioner is to the real system.
Table 4 presents an overview of the various preconditioners that we cover in this section, as
well as some of the highlights and differences of these approaches.
4.3.2 Explicit Time-Discretization and Mass Lumping. Let us derive a very simple precondi-
tioner. The idea is to evaluate elastic and damping forces in a fully explicit way and assume a

121
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Table 4. A coarse comparison of the preconditioner cases covered in this chapter. The (‡) case considers
building WA from a Cholesky factorization whereas (†) avoids building the Delassus operator.

P-case Advantages Disadvantages See Section


WM Very fast Small time-steps, sensitive 4.3.2
to instabilities, weak nodal
couplings
WA Large time-steps, strong Matrix inversion is expen- 4.3.3
nodal couplings sive.
WLDLT (‡) Parallel building Computing Cholesky factor- 4.3.4
ization
WLDLT (†) No need for WA Computing Cholesky factor- 4.3.5
ization, Partial evaluation is
too expensive
WD Easy to implement, Large Convergence rate is linear, 4.3.6
time-steps no proof of convergence,
solves a sequence of comple-
mentarity problems

lumped mass matrix. Then our reduced system becomes:


Mu𝑡+ℎ − ℎ fd (u𝑡 ) − ℎ fe (q𝑡 ) − J𝑇 𝝀𝑡+ℎ = ℎ fext + Mu𝑡
v𝑡+ℎ = J u𝑡+ℎ
Solving for u𝑡+ℎ is now efficient since M is assumed to be a diagonal matrix:
u𝑡+ℎ = M−1 J𝑇 𝝀𝑡+ℎ + u𝑡 + ℎ M−1 fd (u𝑡 ) + fe (q𝑡 ) + fext


Multiplying by J on both sides gives:


v𝑡+ℎ = J M−1 J𝑇 𝝀𝑡+ℎ + J u𝑡 + ℎ J M−1 fd (u𝑡 ) + fe (q𝑡 ) + fext

| {z }
≡WM
Putting things back into the complimentarity formulation, we arrive at the lumped mass
preconditioned system with
WM = J M−1 J𝑇 ,
wM = J u𝑡 + ℎ J M−1 fd (u𝑡 ) + fe (q𝑡 ) + fext − 𝜖 𝑡 .


The time integration now boils down to solving the complementarity problem:
0 ≤ WM 𝝀𝑡+ℎ + wM ⊥ 𝝀𝑡+ℎ ≥ 0

122
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

This can be done very efficiently with a projected Gauss-Seidel type of method due to the
diagonal lumped mass matrix, which results in a fast per-iteration update and straightforward
implementation. It avoids the matrix inversion of M + ℎB + ℎ 2 K that other implicit methods
face when building the Delassus operator. Conversely, the explicit nature of elastic forces
can severely limit the time-step size due to instabilities. Propagation and accumulation of
round-off errors can also cause instabilities for longer running simulations. Lumping the mass
matrix may not always be desired either. The mass lumping will create a “weaker” coupling of
force interactions between mesh nodes, and contact forces will inherit this weaker coupling.
Numerically, it will take more time-steps to have the effect of contact forces from one local area
propagate to other areas of the soft body volume mesh. Hence, the mass lumping preconditioner
is limited in this way too. Finally, we note that this form is almost identical to its rigid body
counterpart (see Equation 9).
4.3.3 Implicit Euler. Let us investigate another preconditioner case. Let us rewind back to the
core system and this time we do not assume mass lumping and further we wish to evaluate
the damping and elastic forces implicitly. That is we have,
Mu𝑡+ℎ − ℎ fd (u𝑡+ℎ ) − ℎ fe (q𝑡+ℎ ) − J𝑇 𝝀𝑡+ℎ = ℎ fext + Mu𝑡 , (267a)
v𝑡+ℎ = J u𝑡+ℎ . (267b)
Let us with out loss of generality assume a simple damping model fd = B u and make a
linearization of the elastic forces,
fe (q𝑡+1 ) ≈ fe (q𝑡 ) + ℎK u𝑡+1 .
Substitution into our first equation and cleaning up gives us,
M − ℎ B − ℎ 2 K u𝑡+ℎ − J𝑇 𝝀𝑡+ℎ = ℎ fext + fe (q𝑡 ) + Mu𝑡 ,
 
| {z }
≡A
One may observe that A is a symmetric positive definite matrix. Hence, it is invertible and we
can solve for u𝑡+ℎ ,
u𝑡+ℎ = ℎA−1 fext + fe (q𝑡 ) + Mu𝑡 + A−1 J𝑇 𝝀𝑡+ℎ .
 

Substituting v𝑡+ℎ = J u𝑡+ℎ yields:


v𝑡+ℎ = J A−1 J𝑇 𝝀𝑡+ℎ + ℎJ A−1
 
fext + fe (q𝑡 ) + Mu𝑡
| {z }
≡WA

Cleaning up and putting results into the complementarity formulation gives:


WA = J A−1 J𝑇
wA = ℎJ A−1
 
fext + fe (q𝑡 ) + Mu𝑡 − 𝜖 𝑡

123
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

The time integration now boils down to solving the complementarity problem,
0 ≤ WA 𝝀𝑡+ℎ + wA ⊥ 𝝀𝑡+ℎ ≥ 0 .
We notice that WA is a perfect preconditioner. Hence, it will be able to handle larger time-steps
and is not limited to the lumped mass matrix choice that we used for WM . On the other hand,
computing P requires the inversion of the A-matrix and naive approaches may require a
complexity of O (𝑁 3 ) in the worst case. Because the number of degrees-of-freedom in the
mesh, 𝑁 is a number that for most solids will be much larger than the number of contacts 𝐾, a
naive inversion approach will dominate any solver we use for computing the contact forces.
For instance, consider a cube with 𝑀 nodes along each axis, or 𝑁 = 𝑀 3 nodes in total. If the
cube is resting on the ground on one of its faces, then we will have 𝐾 = 𝑁 2 nodes in contact.
Obviously, there will be an order of magnitude more nodal degrees-of-freedom than contact
constraints.
The approach we have outlined here is often termed the backward Euler method [Baraff and
Witkin 1998]. It is related to the dual form root-finding approach we presented earlier in that
it corresponds to setting up and solving the Newton equation from Equation 264 only once. In
the following sections, we will present different approaches to deal with the computational
bottleneck associated with computing the WA -matrix. We will explore a parallel algorithm for
building WA and a partial evaluation approach that can be applied in iterative methods, such
as projected Gauss-Seidel. Both of these methods use a Cholesky factorization as a building
block. Finally, we present a splitting approach known as the Iterative Constraint Anticipation
(ICA) method [Otaduy et al. 2009b]. ICA has been the dominating state-of-the-art method for
quite many years in the field, but recent work on Newton-type methods and barrier functions
has surpassed it. Building WA is often the preferred choice over partial evaluation, since one
partial evaluation is almost as expensive as building WA .
4.3.4 Parallel Assembly using the Cholesky Factorization. The WA version of the Delassus
operator requires the inversion of the matrix A ≡ M +ℎB +ℎ 2 K. We know that A is a symmetric
positive definite matrix, and this characteristic can be exploited to create an efficient parallel
method for computing WA . For instance, this approach has been applied in GPU simulators
for surgical training [Courtecuisse et al. 2011]. The idea is centered around first computing an
incomplete Cholesky factorization of A,
A = L D L𝑇 .
Here, L is a lower triangular matrix and D is a positive diagonal matrix. This we can consider
as a special preconditioner choice of P = (L D L𝑇 ) −1 . Hence, we may write WLDLT when the
Cholesky factorization is used to make this explicit, although we obviously have WLDLT = WA
and wLDLT = wA .
A key aspect of this approach is that all the columns of WA are computed in parallel. To
mask out columns of WA , we introduce the notation of the 𝑘 th unit-axis vector, e𝑘 . The 𝑖 th

124
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

component of e𝑘 is defined as follows:


(
0 if 𝑖 ≠ 𝑘
e𝑘,𝑖 =
1 if 𝑖 = 𝑘
Using the notation of e𝑘 , we mask out the 𝑘 th column of WA as:
w𝑘 = WA e𝑘
Substituting WA = J(L D L𝑇 ) −1 J𝑇 gives:
  −1
𝑇
w𝑘 = J L D L J𝑇 e𝑘

Observe that J𝑇 e𝑘 is simply the transpose of the 𝑘 th row of the Jacobian matrix. Let us define
j𝑘 ≡ J𝑇 e𝑘 = (J𝑘★)𝑇 . We can now write:
  −1
w𝑘 = J L D L𝑇 j𝑘 = J h𝑘
| {z }
≡h𝑘

Hence, we just need to compute h𝑘 and w𝑘 is easy to obtain. However, to compute h𝑘 we must
solve the system:
 
𝑇
L D L h𝑘 = j𝑘
This can be done efficiently given that the Cholesky factorization is available. First, perform a
forward substitution to solve for g𝑘 :
L g𝑘 = j𝑘
Then, solve for s𝑘 using the diagonal matrix D:
D s𝑘 = g𝑘
Finally, a backward-substitution solves for h𝑘 :
L𝑇 h𝑘 = s𝑘
The insight from this is we can compute all columns of WA in parallel. For each column
computation we can exploit the same Cholesky factorization. A pseudo-code version of the
full method is shown in Algorithm 15.
The benefit of this approach is that existing matrix libraries, both CPU or GPU version, may
be used to build the full Delassus matrix, WA , in parallel. This does not change the overall
time-complexity, but it does dramatically reduce the performance. This is particularly relevant
when extremely fast and high-fidelity simulations are needed. GPU acceleration is quite easy
to exploit too, but the model size of the soft bodies will be limited by the total amount of GPU
memory available [Courtecuisse et al. 2011]. If the stiffness matrix, K, does not depend on the

125
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: A: The coefficient matrix, J: The Jacobian matrix.


Result: WA : The assembled Delassus operator.
1 WA ← Allocate empty matrix;
2 D, L ← Cholesky-Factorization(A);
3 foreach 𝑘 in parallel do
4 j ← transposed of 𝑘 th row of J;
5 Solve L g = j for g;
6 Solve D s = g for s;
7 Solve L𝑇 h = s for h;
8 w ← J h;
9 Insert w into 𝑘 th column of WA ;
10 end
Algorithm 15: Parallel-Build-Delassus Building Delassus operator in parallel. The
Cholesky factorization is computed only once, and thereafter it is reused in parallel to
evaluate the columns of WA matrix. The three solves step are a “textbook” Cholesky solver.
Factorization and solver sub-routines are standard features in most matrix librarie, and
thus this algorithm is straightforward to implement.

current value of q, such as with linear elastic material models, then the Choleksy factorization
can be re-used throughout the whole simulation. It will then be quite similar in spirit to the
projective dynamics method [Bouaziz et al. 2014; Narain et al. 2016; Wang 2015].

4.3.5 Partial Evaluation using Choleskey Factorization. In past section we presented a method
that allows one to build the complete WA matrix. In doing this we exploited a Choleksy
factorization to make a very efficient parallel method. In this section we explore a different
idea. The idea originates from intrinsic knowledge about how factorization of the Delassus
operator can be exploited inside a projected Gauss-Seidel type of method. We provide a very
detailed treatment of these factorization ideas in Section 3.4.2. Here we will quickly summarize
a simplistic Gauss-Seidel type of solver method to introduce the computational building blocks
of such a type of method. Here is the rough outline of a bare-bone Gauss-Seidel method,
1 while not converged do
2 foreach 𝑘 do
3 v𝑘 ← (WA𝝀 + wA )𝑘 ;
4 𝝀𝑘 ← proj (v𝑘 , 𝝀𝑘 );
5 end
6 end

126
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

The main components in this type of method are: An outer loop monitoring convergence
and an inner loop that sweeps over all variables, aka contacts. For each variable a type of
projection, proj (·), is performed. The projection updates the Lagrange multiplier values for
this individual variable. For now we do not have to understand why such a method converges
or why it computes a solution. The reader may find this type of information in Section 3.4.1
where we present an example of such a method where the projection operation is done using
a proximal operator on a smooth elliptical cone, or in Section 3.2 where we use a simpler box
projection, or later in Section 6 where we generalize the concept of projections onto cones
that change shape depending on system state. For now we will go on a leap of faith that such
a method will compute a solution and instead try and analyze the computations going into the
method.
The nasty part of the algorithm outline is found in Line 3. Here the Delassus operator is
used to compute the relative sliding velocity vector v𝑘 for the 𝑘 th variable (aka contact). This
is nasty because it requires us to actual build the WA -matrix. Once we have WA it is of cause
quite simple to efficiently compute Line 3. Now the idea we want to explore is whether we
can circumvent to build WA at all. As seen from the code we actual do not need to know WA
we only need to know its effect when applied to a vector. This is our ticket to a different way
of computing the same thing. To do this we will need to introduce an auxiliary  variable, u
and we will factorize the Delassus operator into two terms, WA = (J) A−1 J𝑇 . This way the
algorithm outline can now be re-written as follows.

1 u ← wA ;
2 while not converged do
3 foreach 𝑘 do
4 v𝑘 ← (J u)𝑘 ;
5 𝝀𝑘 ← proj (v𝑘 , 𝝀𝑘 );
6 Δ𝝀 ← the change in 𝝀 from the
projection;
7 u ← u + A−1 J𝑇 Δ𝝀;
8 end
9 end

The computation of the values of v𝑘 and 𝝀𝑘 are exactly the same as before. Our little rewrite
only changed that we never need to build WA . Instead we have to be very efficient at computing
v𝑘 ← (J u)𝑘 and u ← u + A−1 J𝑇 Δ𝝀 as these are done for each time we sweep over a single
contact point.

• The term v𝑘 ← (J u)𝑘 is quite easy, it is simply the dot product of the 𝑘 th row of the
Jacobian matrix with our auxiliary vector u. If a sparse matrix library is used and we

127
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

assume a linear tetrahedral mesh then this operation can be done in O (8) time as the 𝑘 th
row of J will have at most 8 non-zero blocks.
• The other term involves the computation of A−1 J𝑇 Δ𝝀, let us denote the value of this
computation by x, so we have x = A−1 J𝑇 Δ𝝀. This term is slightly more complicated to
compute. First we observe that vector Δ𝝀 only will have non-zero values for the variables
corresponding to the 𝑘 th variable. All other values in this vector will be zero. Hence, the
multiplication of J𝑇 and Δ𝝀 then will mask-out the 𝑘 th row of the Jacobian, and scale this
by the change in the Lagrange multiplier. Let us call this resulting vector y, then we have,

x = A−1 J𝑇 Δ𝝀 ,
 
= A−1 J𝑇 Δ𝝀 .
| {z }
=y

This means we should solve for x such that


Ax = y.
Once we know x we can compute the update of the auxiliary variable as u ← u + x. When
solving for x we can exploit a Cholesky factorization of A.
It is worthwhile to consider the case of using WM instead of WA . In this case solving for x
becomes simply x = M−1 y. Given that M is a lumped matrix it means the whole update of
u would only take O (8) time. In the more general case of WA we have to pay the price of
a Cholesky solver for each variable update. That is O (𝑁 2 ) time-complexity for the update.
Hence, the per-iteration cost of one sweep will be O (𝐾 𝑁 2 ). This is quite expensive as this is
roughly the same price it will cost to build WA . Hence, partial-updates are often not done for
WA but is very attractive for WM .
4.3.6 Splitting Method. As we have seen in previous sections, much of the challenge when
dealing with soft body contact comes from the computation of A−1 . This is a well-known
headache when solving linear systems too. One remedy is to apply iterative methods instead.
We will now outline one such idea, which introduces the idea of applying a matrix splitting
technique. The end result will be a sequence of complementarity problems. Each problem will
be simple to solve, and the converging solution of the simpler problems will be a solution to
the original hard complimentary problem which involves the inverted A-matrix. Hence, the
origin for this method is the model given by WA and wA . These quantities were derived from
Equation 267 which we show here again for convenience:

Au𝑡+ℎ = ℎ fe (q𝑡 ) + fext + Mu𝑡 + J𝑇 𝝀𝑡+ℎ
v𝑡+ℎ = J u𝑡+ℎ

128
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Defining b = ℎ fe (q𝑡 ) + fext + Mu𝑡 , then the first equation can be written compactly as
A u𝑡+ℎ = b + J𝑇 𝝀𝑡+ℎ .
Let us now introduce a splitting of the A-matrix, such that A = L + D + U where L is the strict
lower triangular part, D the diagonal and U the strict triangular upper part of A. This allow us
to rewrite our equation:
D u𝑡+ℎ = b − (L + U) u𝑡+ℎ + J𝑇 𝝀𝑡+ℎ
This provides us with a Jacobi method that iteratively computes an approximation for u𝑡+ℎ . Let
us denote the solution from the 𝑘 th iteration as u𝑘 , which gives a Jacobi update for the new
iterate:
 
u𝑘+1 = D−1 b − (L + U) u𝑘 + D−1 J𝑇 𝝀𝑘+1

Substitution into v𝑘+1 = J u𝑘+1 gives us the 𝑘 th iteration approximation for the relative sliding
contact velocity,
 
𝑘+1 −1 𝑇 𝑘+1 −1 𝑘
v = J D J 𝝀 + J D b − (L + U) u .
| {z }
≡WD

Now we have all the pieces for solving for the 𝝀𝑘+1 iterate. That is in the 𝑘 th iteration we solve
the complementarity problem,
0 ≤ W𝑘D 𝝀𝑘+1 + w𝑘D ⊥ 𝝀𝑘+1 ≥ 0 ,
where
WD = J D−1 J𝑇 ,
 
−1
wD = J D b − (L + U) u − 𝜖 𝑡 .
𝑘 𝑘

Once 𝝀𝑘+1 is computed then u𝑘+1 can be computed before one is ready to setup w𝑘+1 D which
will be needed for the next iteration. The overall pseudo-code for this splitting method can be
seen in Algorithm 16.
The method we have outlined is quite similar to the Iterative Constraint Anticipation (ICA)
method by Otaduy et al. [2009b]. In their work they used a projected Gauss-Seidel solver for
the complementarity problem in Line 8 of Algorithm 16. Only an approximate solution is
needed. Hence, a few Gauss-Seidel iterations per Jacobi iteration is reported to work well. In
context of the partial evaluation analysis we presented in Section 4.3.5 it is instructive to note
that WD has the exact same form as WM and can hence exploit the same computational tricks.
Comparing to the WM -approach we observe that ICA essentially in each outer Jacobi iteration
add some of the "coupling" expressed by the L and U parts of A back into the solution by this
lagged iterative approach. This was one of the drawbacks of the WM -approach we treated in

129
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Data: A: The system coefficient


 matrix, J: The Jacobian matrix,
b = ℎ fe (q𝑡 ) + fext + Mu𝑡 : The “right-hand-side vector”, u𝑡 : The initial
body-space velocities.
Result: u𝑘+1 : The approximation to the body-space velocities, 𝝀𝑘+1 : the
approximation to the Lagrange multiplier solution.
1 Something ;
2 WD ← J D−1 J𝑇 ;
3 𝑘 ← 0;
4 u𝑘 ← u𝑡 ;
5 while not converged do
ũ ← D−1 b − (L + U) u𝑘 ;

6
7 w𝑘D ← J ũ − 𝜖 𝑡 ;
8 Solve: 0 ≤ WD 𝝀𝑘+1 + w𝑘D ⊥ 𝝀𝑘+1 ≥ 0;
9 u𝑘+1 ← ũ + D−1 J𝑇 𝝀𝑘+1 ;
10 𝑘 ← 𝑘 + 1;
11 end
Algorithm 16: Jacobi-Splitting A Jacobi splitting method is used to iteratively update
the body-space velocity vector u𝑘+1 until it converges to u𝑡+ℎ . In each iteration a simple
constraint problem must be solved. The benefit of the splitting is that the WD -matrix has a
particular nice form similar to WM . Hence, a projected Gauss-Seidel solver using partial
evaluation will be quite efficient from quickly finding an approximation for 𝝀𝑘+1 .

Section 4.3.2. Hence, the ICA method is expected to handle larger time-steps better than the
mass lumping approach, and it is not confined to lumping.

130
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

5 PENALTY AND BARRIER METHODS


In this chapter, we consider a fundamentally different approach to the constraint-based methods
that are covered extensively in earlier chapters. The topic is penalty-based and barrier methods
for contact modeling, and the goal here is to provide a broader and more complete coverage
of contact and friction simulation. Besides, penalty-based and constraint-based approaches
are frequently combined for many implementations, giving a sort of “hybrid” simulator. This
is evident from the strong connection between constraint stabilization and penalty-based
methods.

5.1 Overview of Classical Penalty Methods


Solid objects in the real world do not penetrate each other. The constraint-based formulations
of contact that we have considered so far try to eliminate any penetration between bodies
by applying an impulse at the point of contact. In penalty-based methods, the goal is similar.
However, rather than computing a constraint impulse, a spring-damper system is used for
penalizing penetrations. A spring-damper system behaves like a harmonic oscillator in classical
mechanics, and thus the trick is often to tune stiffness and damping parameters to get a critically
damped system. Penalty methods have a lot in common with mass-spring systems because all
effects are modeled by spring and damping forces. Therefore, these approaches are generally
applicable to both deformable and rigid objects. Spring-damper models are even found in
biomechanical muscle models, such as Hill’s muscle model and Zajac’s force model used by
Chen and Zeltzer [1992]. Baumgarte stabilization may also be interpreted as a spring-damper
system, as we showed in Section 1.9. Hence, it is quite a general purpose modeling tool.
The central idea behind penalty methods is to find a force f and torque 𝜏 at a given instant
that can be included in the dynamical equations of motion in order to perform the numerical
integration. These forces and torques include contributions from external forces, such as gravity,
as well as contact forces stemming from interaction with other rigid bodies. Specifically, with
regards to contact, forces are generated by springs with zero rest-length that are inserted at
all penetrations. Larger penetrations produced larger spring forces, and thus springs penalize
penetrations. Hence the name penalty method. The contact force from each point of contact is
thus computed as a spring force.

5.1.1 Rigid Bodies. Consider a rigid body A that penetrates another rigid body B. The spring
spring spring
force f𝑘 acting at the 𝑘 th contact point gives rise to the corresponding torque term, 𝜏𝑘 ,
acting on the rigid body. Let the vector arm from center of mass of 𝐴 to the contact point be
given by r𝑘,𝐴 , and the resulting torque is computed as

spring spring
𝜏𝑘 ≡ r𝑘,𝐴 × f𝑘 . (268)

131
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

To use the penalty method, one would simply sum all the penalty forces and add them to the
generalized force vector in Equation 2:
" spring
#
f ext +
Í
𝑘 f𝑘
f= Í spring (269)
𝜏 ext + 𝑘 𝜏𝑘

Here, the external forces and torques are given by f ext and 𝜏 ext , and without loss of general-
ization we consider the effect of the gyroscopic forces to be included in the external torque
component.
Recalling there are two bodies in contact, there is a similar force term acting on the opposing
body B at the 𝑘 th contact. Due to Newton’s second law, the spring force on that body is equal
in magnitude, but opposite in direction. In a practical implementation, one would iterate over
contact points and compute the penalty force only once per contact and then distribute the
spring force to the two bodies that are in contact. In its most pure form the simulation loop of
the penalty method can now be summarized as
• Detect contact points (run collision detection).
• Compute and accumulate spring forces.
• Integrate equations of motion forward in time.
This is the pure form of the penalty method. In practice, it is combined with several other
techniques, some of which we will elaborate on below.
First we will turn our attention toward the actual computation of the penalty forces in a
general simulator. Let the 𝑘 th contact point between the two bodies 𝐴 and 𝐵 with center of
mass at x𝐴 and x𝐵 respectively be at position p𝑘 given in 3D world coordinates. The 𝑘 th contact
point has the contact normal, n𝑘 , also in 3D world space, pointing from body 𝐴 toward body 𝐵,
and a measure of penetration depth, 𝜙𝑘 . Then the penalty force acting on body 𝐵 is given by

spring
f𝐵 = (−𝑘𝜙𝑘 − 𝑏v𝑘 · 𝑛ˆ𝑘 ) 𝑛ˆ𝑘 , (270)

where v𝑘 denotes the relative contact velocity at the 𝑘 th contact point. Observe, that the
penalty force here only works in the normal direction of the contact. Hence, we are currently
ignoring friction. The coefficients 𝑘 and 𝑏 are known as the stiffness and damping coefficients,
sometimes the stiffness coefficient is referred to as the spring constant as well. The term v𝑘 · 𝑛ˆ𝑘
is essentially only measuring the relative velocity in the normal direction, let us define this
ˆ = v𝑘 · 𝑛ˆ𝑘 . For 𝑣 𝑛,𝑘
as 𝑣𝑛,𝑘 ˆ < 0 objects are approaching each other, 𝑣 𝑛,𝑘
ˆ = 0 there is no relative
movement, and if 𝑣𝑛,𝑘 ˆ > 0 objects are moving away from each other. Notice how carefully
the viscosity is modeled only to work in the direction of the contact normal to ensure that

132
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

damping should only work in the constraint direction. We may compute 𝑣𝑛,𝑘ˆ like this
 
ˆ = 𝑛ˆ𝑘 · v𝐴 + 𝜔 𝐴 × r𝑘,𝐴 − v𝐵 + 𝜔 𝑗 × r𝑘,𝐵
𝑣𝑛,𝑘 , (271)
v 
 𝐴
h i 𝜔 
×
= 𝑛ˆ𝑇𝑘 I3×3 −r𝑘,𝐴 ×
−I3×3 r𝑘,𝐵  𝐴  = J𝑘 u , (272)
}  v𝐵 
 
| {z
J𝑘 𝜔 𝐵 
 
|{z}
u
where r𝑘,𝐴 = p𝑘 − x𝐴 and r𝑘,𝐵 = p𝑘 − x𝐵 . We have seen this before in Equation 17, and if we
had a soft body instead of a rigid body then the normal relative velocity can be computed as
we did in Equation 20. If we write up the magnitude of the spring force as
𝜆𝑛,𝑘 ¤
ˆ ≡ −𝑘𝜙𝑘 − 𝑏 𝜙𝑘 . (273)
Here, we use the substitution that 𝜙¤𝑘 = 𝑣𝑛,𝑘
ˆ and with this notation in place we can write the
spring forces and torques on body A and B as follows:
f spring   −𝑛ˆ 𝜆 
𝐴   ˆ
𝑘 𝑛,𝑘 
 spring   
𝜏𝐴  −r𝑘,𝐴 × 𝑛ˆ𝑘 𝜆𝑛,𝑘ˆ 
=  = −J𝑇 𝜆𝑛,𝑘 (274)
𝑘 ˆ .

f spring   𝑛ˆ𝑘 𝜆𝑛,𝑘 
𝐵   ˆ 
 spring   
𝜏   r𝑘,𝐵 × 𝑛ˆ𝑘 𝜆𝑛,𝑘
ˆ 
𝐵   
It is interesting to generalize Equation 271 and Equation 274 to a system with multiple bodies
and multiple contacts. Hence, let us do this. We obtain,
𝝓¤ = Ju , (275a)
λ = −K𝝓 − B𝝓¤ , (275b)
Mu¤ = f + J𝑇 λ , (275c)
here K is a diagonal matrix with stiffness coefficients, B a diagonal matrix with damping
coefficients, and λ is a vector of spring force magnitudes. The vector u is the generalized
velocities and M is the mass matrix, and J is the system Jacobian matrix. If we have 𝐾 contacts
and 𝑁 rigid bodies then 𝝓, 𝝓,¤ λ ∈ R𝐾 , and f, u ∈ R6 𝑁 , J ∈ R𝐾×6 𝑁 , M ∈ R6 𝑁 ×6 𝑁 , and K, B ∈
R𝐾×𝐾 .
5.1.2 Soft Bodies. In case of soft bodies, dimension 6 𝑁 is replaced with 3 𝑉 , where 𝑉 is
the total number of vertices in the system. However, note that for soft bodies, there is no
torque component generated by the spring forces (meaning the last row of Equation 269 is
dropped). Also note that for soft bodies, the contact point may not coincide with a node of the
computational mesh. In this case, the penalty force is often distributed to the enclosing nodes

133
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

of the contact point using some weighting scheme. The most common choice for computer
graphics is to use linear weights based on the barycentric coordinates of the nodes. With these
considerations, it is trivial to perform a time-discretization to Equation 275 in order to solve
this system of ordinary differential equations. Xu et al. [2014] showed how to take the ideas
we presented here into an implicit time-stepping scheme.

5.1.3 Implementation Notes. It is quite interesting to compare the penalty method algebraic
form given in Equation 275 with that of a constraint based method. We observe that the
J-matrices appear in similar places, but 𝝀 is now given by a closed-form solution. The spring
force, or rather impulses, are simply computed by evaluating Equation 275 at the instant
corresponding to the chosen time-stepping scheme. Hence, the per-time-step complexity of the
penalty method is very fast compared to solving an LCP problem per time-step. Furthermore,
in most implementations of the penalty method, the above matrices are not assembled, which
further reduces the computational and storage complexity. Yet the algebraic form here provides
a straightforward connection to the constraint based approaches that we have already covered
in full detail.
There are, however, several difficulties associated with the classical penalty method. These
are listed below without going into details about possible solutions:
• It is not trivial to compute satisfactory contact normals or penetration depths as they lack
global knowledge about the entire state. The problem of determining meaningful contact
normals and penetration depths is mostly caused by the use of local computations. If a
global computation [Kim et al. 2002] is used instead, these problems can be resolved.
• Some contact points like the face-face case appearing in a box stack is difficult to handle
by applying a penalty force at the contact point of deepest penetration [Hasegawa et al.
2003]. To alleviate this problem, researchers have tried to sample the entire contact region
with contact points. There also exist methods, that integrate over the intersection area
and/or volume.
• During motion, there can be a discontinuous changes of the contact normals.
• It is not trivial to pick the stiffness and damping parameters. Stiffness parameter need to
be large enough to remove any penetration. Unfortunately, this value limits the time-step
size severely for explicit time-stepping methods.
• The springy nature of the contact forces can create secondary oscillation effects that leads
to a more “spongy” contact behavior than the hard contact response that is expected from
rigid bodies.

5.1.4 Penalty Based Friction. Until now, we have only been concerned with generating non-
interpenetration forces using penalty methods. How should one go about modeling friction in
a penalty-based simulator? It seems reasonable to use a spring-damper system for the friction
force as well. This is often done by tracking the contact points. At first point of contact, an
anchor point, a, is saved. This is an unmovable point in the world coordinate system. The

134
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

friction force is determined by the spring force stemming from the zero-length spring with
stiffness coefficient 𝑘 between the anchor point and the current position p of the contact point
that caused the creation of the anchor point:
spring
ffriction = 𝑘 (a − p) . (276)
Typically, the value of the friction stiffness coefficient is different from the value of the non-
interpenetration stiffness coefficient. During subsequent time steps, the simulation is monitored
to ensure the following condition holds:
spring
ffriction ≤ 𝜇 f spring , (277)

here, 𝜇 is the Coulomb coefficient of friction and f spring is the normal penalty force. If the
condition is fulfilled, we have the case of static friction and nothing needs to be done. If, on
the other hand, the condition is broken, then we have the case of dynamic friction (sliding)
and the anchor point is moved towards the current contact position p such that the condition
in Equation 277 is true.
The frictional spring force model can be physically justified as a crude model of the external
shear stresses acting between two bodies. As such, the friction model adds an element
of compliance to the rigid bodies. Another approach to model friction is as a damping
force [McKenna and Zeltzer 1990], like this,
spring v𝑡ˆ
ffriction = −𝜇 f spring , (278)
∥v𝑡ˆ ∥
where v𝑡ˆ is the tangential relative sliding velocity. This approach only models dynamic friction,
thus static friction is ignored.
5.1.5 Other Penalty Methods. We will now briefly survey a few of the usual tricks and ideas
that have been used in the context of penalty methods over the years in the field of computer
graphics. Our coverage is not complete but most central ideas are represented. Moore and
Wilhelms [1988] were among the first to model contact forces by springs in computer animation.
They used a simple linear spring, but added a twist of letting the spring constant depend on
whether the motion is receding or approaching. The relationship is as follows
𝑘 recede = 𝜀𝑘 approach , (279)
where 𝜀 describes the elasticity of the collision, 𝜀 = 0 corresponds to totally inelastic collisions,
and 𝜀 = 1 to perfectly elastic collisions. Furthermore, Moore and Wilhelms extended the
penalty method with an algebraic collision resolving method, similar to Newton’s collision
law. The main idea is to handle colliding contacts before applying springs. This is because
colliding contacts requires very stiff springs, which are numerically intractable.
Terzopoulos et al. [1987] used another kind of penalty force. The main idea behind their
derivation comes from conservative forces, which are known to be the negative gradient of an

135
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

energy potential, that is the negative gradient of a scalar function. A scalar energy function is
then designed that penalizes penetration, such that
 
−𝜙
𝑐 exp , (280)
𝜀
where 𝑐 and 𝜀 are constants used to determine the specific shape of the energy potential. The
penalty force is then computed as
   
spring ∇𝜙 −𝜙
f =− exp · 𝑛ˆ 𝑛ˆ . (281)
𝜀 𝜀
Such penalty forces are called exponential springs. Exponential springs are stiffer for large
displacement than linear springs, which can quickly lead to stability problems for explicit
integration schemes. However, for small displacements exponential springs are less stiff than
linear springs [McKenna and Zeltzer 1990].
McKenna and Zeltzer [1990] introduce a twist on penalty forces for modeling collisions that
is inspired by Newton’s impact law, relating pre- and post velocities through a coefficient of
restitution, 𝜀. A value of zero for the coefficient corresponds to completely inelastic collisions,
and a value of 1 corresponds to fully elastic collisions. For contacts where the bodies are
moving away from each other, the penalty force is multiplied by 𝜀, such that
(
𝜀 f spring if 𝜙 < 0 and 𝑣𝑛ˆ > 0
f spring ← . (282)
f spring otherwise
In Jansson and Vergeest [2003], a mass-spring model is used for modeling both rigid and
deformable objects, here simple springs are created when particles move within a nominal
distance, and springs are deleted again when their incident particles move further away than a
given fracture distance. The spring force is simply modeled as
 x𝑖 − x 𝑗
F = −𝑘 x𝑖 − x 𝑗 − 𝑙 , (283)
x𝑖 − x 𝑗
where 𝑘 is the spring constant, x𝑖 and x 𝑗 are the particle positions, and 𝑙 is the nominal distance.
Details for determining nominal and fracture distances can be found in Jansson and Vergeest
[2002]. Hence, there is no need for contact points in the traditional sense, and instead contact
points are simply particle pairs.
Penalty methods are popular for differentiable simulators too as they provide differentiable
forces. Here we briefly describe the approach in Macklin et al. [2020b]. One view of penalty
forms of contact is as a regularization of the complementarity form of the non-penetration
constraint. Penalty methods of contact associate a stiff potential with the non-penetration
constraint. In the simplest case this is a quadratic function of the clamped constraint error,
1
𝑈 (q) ≡ 𝑘𝑛 min(0, 𝜙) 2 . (284)
2

136
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

The associated (non-smooth) force due to this potential:


f spring ≡ −𝑘𝑛 J𝑇 min(0, 𝜙) (285)
where 𝑘𝑛 controls the stiffness of the contact. We observe that as 𝑘𝑛 → ∞ it approaches a hard
constraint limit. One advantage of penalty based approaches is that they can easily support
nonlinear contact models. For example, applying a simple exponentiation with 𝑝 ≥ 1 gives the
exponential spring equation
f spring ≡ −𝑘𝑛 J𝑇 min(0, 𝜙) 𝑝 , (286)
which produces smooth contact forces with continuous derivatives. Similar modeling was done
by Geilinger et al. [2020] and found to perform better than other regularized complementarity
models.
A regularized form of Coulomb friction may be expressed as the derivative of the following
dissipative potential in terms of the slip velocity,
(
1
𝑘 𝑓 ∥v𝑡ˆ ∥ 2 𝑘 𝑓 ∥v𝑡ˆ ∥ < 𝜇 f spring
𝑈 𝑓 (q) ≡ 2 spring , (287)
𝜇 f ∥v𝑡ˆ ∥ − 𝛾 otherwise
where the parameter 𝑘 𝑓 controls stiffness in the “stick” regime, and 𝛾 is a constant to make
the potential have C0 continuity. Since we only ever evaluate the potential’s gradient, 𝛾 may
generally be ignored. This potential is quadratic around the origin and is linear past a certain
point (in the slip regime). The force for this potential is
!
spring f spring
ffriction ≡ −min 𝑘 𝑓 , 𝜇 v𝑡ˆ , (288)
∥v𝑡ˆ ∥
which in 1D looks like the relaxed step function.

5.2 Barrier Methods


Penalty-based methods are limited by the choice of the penalty stiffness 𝑘 [Baraff 1989]. A
small 𝑘 allow for a easier problem to solve but lacks the stiffness needed to prevent tunneling.
On the other hand, a large 𝑘 will repel contacting bodies more effectively, but results in a
stiffer system and is therefore harder to solve (can be unstable when using explicit methods
and require more iterations when using a fully implicit approach).
Beyond this, no matter the choice of 𝑘 there always exists a large enough velocity between
contacting bodies that will result in tunneling. To address this problem we can turn to barrier
methods. Barrier methods are similar to penalty-based methods but apply penalties that diverge
as objects get closer. This is done through the use of so called barrier functions [Nocedal and
Wright 2006] which grows to infinity as our gap shrinks to zero. Immediately, we can see
one problem with such methods which is that, similar to solving with large 𝑘, special care is
needed to solve such a stiff problem. Here we will briefly discuss a powerful explicit method

137
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

for handling contact through barriers. Additionally, in Section 5.3 we discuss in greater detail
the recent Incremental Potential Contact [Li et al. 2020].
5.2.1 Asynchronous Contact Mechanics. We start from a simple quadratic penalty

𝑔(q, 𝜂) = ∥x𝑏 − x𝑎 ∥ − 𝜂, (289)

where 𝜂 encodes the surface thickness and 𝑥𝑎 and 𝑥𝑏 are the contacting point. We can then
use this penalty to define a contact potential
(
1 2
𝑘𝑔 (q, 𝜂) if 𝑔 ≤ 0
𝑉 (q, 𝜂, 𝑘) = 2 (290)
0 if 𝑔 > 0

where again 𝑘 is the penalty stiffness.


Harmon et al. [2009] propose to layer these quadratic penalties such that their sum grows
to infinite at the boundary 𝑔(q) = 0. That is they apply a sequence of 𝑉 (q, 𝜂 (𝑖), 𝑘 (𝑖)) for
𝑖 = 1, 2, . . ., where 𝜂 (𝑖) is monotonically decreasing and 𝑘 (𝑖) is monotonically increasing with
respect to 𝑖. Harmon et al. [2009] choose 𝑘 (𝑙) = 𝑘 (1)𝑖 3 and 𝜂 (𝑙) = 𝜂 (1)𝑖 −1/4
Í , for a given initial
𝑘 (1) and 𝜂 (1). The sum of these potentials then form a barrier because 𝑖 𝑘 (𝑖)𝜂 (𝑖) → ∞. 2

For each penalty layer, we can apply friction as in Section 5.1.4. This applies an increasing
friction force to effectively handle high-speed tangential motion.
To handle the increasingly stiff problem (i.e., increasingly large forces/impulses), we can use
an adaptive time-stepping method or as Harmon et al. [2009] propose step each contacting
point asynchronously. While this method is more effective than a simple global adaptive
time-stepping, it still leads to exceedingly high running times. Subsequent works [Ainsley
et al. 2012; Ni et al. 2015] have improved upon the original method, but despite the guarantees
provide by this method, the high running-time has limited its applications.

5.3 Incremental Potential Contact


Recently there have been several advancements in robust contact handling by applying barrier
potentials within an optimization-based implicit time integration [Chen et al. 2022; Ferguson
et al. 2021; Lan et al. 2022, 2021; Li et al. 2020, 2021, 2022a,b; Zhao et al. 2022]. As we saw in
Section 4.2.2, the implicit time integration problem can be written as a optimization over nodal
positions q with velocities u. For ease of reading let us restate Equation 265 here:

q𝑡+ℎ = arg min 𝑓 (q, q𝑡 , u𝑡 ) s.t. 𝜙𝑘 (q) ≥ 0 ∀𝑘 ∈ C,


q

where C is the set of all “active” contacts and 𝜙𝑘 is a gap function encoding our contacts
(see Figure 33 for example gap functions). Here contacts are treated as inequality constraints
(friction is omitted for now). IPC instead transforms these constraints into barrier potentials

138
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Barrier energy
2

0
0 0.5 1 1.5
Distance

Fig. 32. IPC’s clamped barrier approximation to the discontinuous function (blue) improves as we
ˆ shrinks to zero.
make our geometric accuracy threshold, 𝑑,

added to the objective function (similar to interior-point methods [Nocedal and Wright 2006])
∑︁
𝑡+ℎ 𝑡 𝑡
q = arg min 𝑓 (q, q , u ) + 𝜅 ˆ
𝑏 (𝑑𝑘 (q), 𝑑), (291)
q 𝑘∈C

where 𝑑𝑘 is the unsigned distance between the contacting geometry (e.g., point and triangle or
two edges) and
(  
−(𝑑 − ˆ 2 ln 𝑑 , 0 < 𝑑 < 𝑑ˆ
𝑑)
ˆ =
𝑏 (𝑑, 𝑑) 𝑑ˆ , (292)
0 𝑑 ≥ 𝑑ˆ

is a smoothly clamped barrier which vanishes as the distance 𝑑 approaches a value of 𝑑ˆ (see
Figure 32). This 𝑑ˆ acts as an intuitive parameter to control the performance versus accuracy
of the simulation. By decreasing 𝑑, ˆ accuracy increases because forces at unphysical distances
vanish, but the sharper barriers requires more optimization iterations. On the other hand,
increasing 𝑑ˆ smooths the problem leading to and easier optimization, but the contact forces
activate at a possibly non-realistic distance.
For simplicity active contacts can be all possible contacts (quadratic number in terms of
the surface triangles). However, thanks to the local support provide by the clamped barrier
function in Equation 292, we can instead use a fast spatial data structure (e.g., spatial hash) to
cull out contacts that will result in zero force (i.e., ignore contacts with distance greater than
ˆ
𝑑).
The benefit of this approach is it is a unconstrained minimization. This can be robustly solved
using Newton’s method (Section 5.3.2) with line search (Section 5.3.3). Importantly, by using
CCD within the line-search we can provide guarantees that every step will be intersection-free
independent of the parameter choices.

139
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Constraint definition: Large displacement:

𝜙(x) = V 𝜙(x) = d ⋅ n

Volume constraints Gap constraints Constraint violated without interpenetration!

IPC’s constraints Constraints still valid

Fig. 33. Traditional contact constraints come in many flavors. For example, volume constraints [Kane
et al. 1999; Müller et al. 2015] compute a signed volume of the tetrahedron formed by a point-triangle
or edge-edge pair (illustrated in 2D). Also popular, gap constraints [Harmon et al. 2008; Otaduy et al.
2009a; Verschoor and Jalba 2019] define constraints as the signed distance between point-triangle
or edge-edge pairs by projecting to the plane spanned by the triangle or three points of the edge-
edge pair. However, when undergoing large displacements these constraints can be violated without
interpenetrations. This leads to artificially smaller steps due to being over-constrained. Instead IPC
uses an unsigned distance as constraints. This is globally consistent as the closest point is determined
on each evaluation.

A limitation of this model is that we have to be careful with the input geometry and selection
ˆ Not only does the initial configuration need to be intersection-free but there needs to be
of 𝑑.
ˆ will cause the gaps
an initial nonzero gap. Furthermore, using an tiny initial gap, relative to 𝑑,
to expand as the (possibly large) contact forces push them apart.

5.3.1 Consistent Distance Functions. Traditionally distance-based constraints 𝑑 (q) ≥ 0 are


evaluated using a signed distance function. However, IPC utilizes unsigned (e.g., standard
Euclidean) distances. This is important as it ensures a consistent constraint definition as
contacts shift through time (e.g., Figure 33).
In 3D, we need to compute the minimum distance between triangles. As long as the triangles
are not intersecting, this can be equivalently broken down into computing the minimum of the
distance between vertices and triangles and between a pairs of edges. The distance between
a point and triangle can be expressed as a small constrained minimization over Barycentric

140
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

coordinates 𝑢 and 𝑣
𝑑 PT (x1, x2, x3, x4 ) = min ∥((1 − 𝑢 − 𝑣)x1 + 𝑢x2 + 𝑣x3 ) − x4 ∥
𝛼,𝛽
(293)
s.t. 𝑢 ≥ 0, 𝑣 ≥ 0, 𝑢 + 𝑣 ≤ 1,
where again x1 , x2 , and x3 are the vertices of the triangle and x4 is the point. Similarly for a
pair of edges parameterized by 𝑎 and 𝑏 the distance can be computed as
𝑑 EE (x1, x2, x3, x4 ) = min ∥(x1 + 𝑎(x2 − x1 )) − (x3 + 𝑏 (x4 − x3 ))∥
𝑎,𝑏
(294)
s.t. 0 ≤ 𝑎, 𝑏 ≤ 1,
where, in this context, x1 and x2 are the end points of the first edge and x3 and x4 are the end
points of the second edge.
Conveniently, both of these constrained minimizations have a closed form solution and the
solution depend on which sub-element are closest. For example if the point is closest to an
edge of the triangle, then the distance can be computed as the distance between the point and
the analytical line collinear with the edge. For a full breakdown of each possible case we refer
to Li et al. [2020] and the implementation provided in the IPC Toolkit [Ferguson et al. 2020].
5.3.2 Optimization-based Time Integration. Let us start by defining
∑︁
𝑓 (q) ≡ 𝐸 (q, q𝑡 , u𝑡 ) + 𝜅 ˆ
𝑏 (𝑑𝑘 (q), 𝑑)
𝑘∈C

as our objective function to the minimization in Equation 291. Because this is an unconstrained
optimization we can simply use a gradient descent or Newton’s method to find the minimum.
Data: q0, 𝑓 (q)
Data: q0, 𝑓 (q)
Result: q★
Result: q★
1 𝑖 ← 0;
1 𝑖 ← 0;
2 C ← ActiveContactSet(q𝑖 );
2 C ← ActiveContactSet(q𝑖 );
3 while ∥∇𝑓 (q𝑖 )∥ > 𝜖 do
3 while ∥∇𝑓 (q𝑖 )∥ > 𝜖 do
4 H ← PDProject(∇2 𝑓 (q𝑖 ));
4 Δq𝑖 ← −∇𝑓 (q𝑖 );
5 Δq𝑖 ← −H−1 ∇𝑓 (q𝑖 );
5 𝛼 ← LineSearch(q𝑖 , Δq𝑖 );
6 𝛼 ← LineSearch(q𝑖 , Δq𝑖 );
6 q𝑖+1 ← q𝑖 + 𝛼Δq𝑖 ;
7 q𝑖+1 ← q𝑖 + 𝛼Δq𝑖 ;
7 C ← ActiveContactSet(q𝑖 );
8 C ← ActiveContactSet(q𝑖 );
8 𝑖 ← 𝑖 + 1;
9 𝑖 ← 𝑖 + 1;
9 end
10 end
10 q ← q𝑖 ;

11 q ← q𝑖 ;

Algorithm 17: Gradient descent with line-


Algorithm 18: Projected Newton with line-
search
search
141
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

A simple gradient descent method. To start off simple we can minimize 𝑓 (q) by using a
gradient descent method (Algorithm 17). This requires computing the gradient ∇𝑓 (q𝑖 ) of our
objective, and then use this as an update direction Δq𝑖 that decreases the energy. We use
line-search to find a intersection-free descent step length 𝛼 (more on this in the next section).
Our function 𝑓 (q) (and namely our distances 𝑑 (q)) need to be at least 𝐶 1 (continuous and
differentiable).
A better method: Projected Newton. In general we want to use Newton’s method because it
provides an improved rate of convergence (close to a minimum) and therefore takes fewer
iterations. While Newton does not promise global convergence, the benefit of time dependent
simulation is the previous time step usually provides a good warm start. Here we can also see
a trade off of the time step size: as the time step size increase the further the initial positions
q0 will be from q★ (i.e., larger timesteps require more optimization iterations).
Algorithm 18 provides a basic outline of the solve. We need to compute the gradient ∇𝑓 (q𝑖 )
and Hessian ∇2 𝑓 (q𝑖 ) of our objective. These are then used to find an update direction Δq𝑖 that
decreases the energy.
Projecting to Positive Definite. Notice the Hessian is projected to positive definite (PD). This
is to ensure Δq𝑖 is a descent direction (Δq𝑖 · ∇𝑓 (q𝑖 ) < 0). Formally this is, if H ∈ R𝑛×𝑛 is PD
(i.e., x𝑇 Hx > 0 ∀𝑥 ≠ 0), then Δq · ∇𝑓 = −H−1 ∇𝑓 · ∇𝑓 < 0.

Proof. x𝑇 Hx > 0 ∀x ≠ 0 =⇒ x𝑇 H−1 x > 0 ∀x ≠ 0


x𝑇 H−1 x = H−1 x · x > 0 =⇒ H−1 ∇𝑓 · ∇𝑓 > 0 =⇒ −H−1 ∇𝑓 · ∇𝑓 = Δq · ∇𝑓 < 0 □

The projection to PD is done by first projecting the elasticity, barrier, and friction Hessians
(soon to come in Section 5.3.4) to positive semi-definite (PSD). Then when we add the lumped
mass matrix (Hessian of the inertia term in 𝑓 ) which is a PD diagonal matrix, we get a resulting
matrix H that is PD. Alternatively, in the static case we can add a small scaled identity to the
projected PSD Hessian. You can think of this as blending between the full Newton direction
and the gradient descent direction to ensure progress is made toward a minimum.
Projecting a matrix to PSD can be done by computing its Eigendecomposition and then
setting all negative Eigenvalues to zero. However, computing a full Eigendecomposition can
be prohibitively expensive. To avoid this large cost, we can instead project the local Hessian
blocks rather than the entire matrix. This is, when we compute the Hessian of the 𝑘 th contact
term (which is a small 12 × 12 matrix at most) we project it to PSD and then assemble the full
matrix as usual. The same can be done for the elasticity Hessian on a per element bases [Teran
et al. 2005].
A limitation of this local projection strategy is that it might be overkill as the full matrix
might be PSD on its own, and further while projecting to PD guarantees a descent direction it
can worsen the rate of convergence of the method (less than the expected quadratic rate of
convergence from a standard Newton’s method).

142
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Because there are no slack variables, the linear systems is only the size of the dimension
times the number of nodes (when computing nodal displacements). Assembling this system
requires adding an entry per contacting pair (e.g., a 12 × 12 matrix for a single point-triangle
collision) in addition to the standard FEM matrix assembly.
This system can be large and the sparsity pattern changes dynamically (preventing pre-
factorization), so solving the linear system becomes the dominating component as the scene
grows in number of elements.
5.3.3 CCD-Aware Filtered Line-Search. A critical part of the IPC algorithm is ensuring the
optimization does not take a step that jumps over the barrier. To accomplish this CCD is added
to the line-search within the optimization.
Data: q, Δq, 𝑓 (q) Data: q, Δq, 𝑓 (q)
Result: 𝛼 Result: 𝛼
1 𝛼 ← CCD(q, q + Δq);
1 𝛼 ← 1;
2 while 𝑓 (q) ≤ 𝑓 (q + 𝛼Δq) do
2 while 𝑓 (q) ≤ 𝑓 (q + 𝛼Δq) do
3 𝛼 ← 𝛼/2; 3 𝛼 ← 𝛼/2;
4 C ← ActiveContactSet(q + 𝛼Δq); 4 C ← ActiveContactSet(q + 𝛼Δq);
5 end
5 end

Algorithm 19: Backtracking line-search Algorithm 20: CCD-aware backtracking


line-search
A line-search is a search for a minimum (or acceptable decrease in energy) along a one-
dimensional space. In our case, this means finding a step length 𝛼 ∈ [0, 1] that decreases the
energy between q𝑖 and q𝑖 + Δq𝑖 . One efficient form of line-search is backtracking (Algorithm 19).
In backtracking line-search, 𝛼 is initialized to one. Then 𝛼 is repeatedly halved until a descent
step (𝑓 (q𝑖 + 𝛼Δq𝑖 ) < 𝑓 (q𝑖 )) is found.
For those knowledgeable about numerical methods, you will see that this is a very relaxed
form of the the Armijo rule [Armijo 1966]: 𝑓 (𝑥𝑖 + 𝛼Δ𝑥𝑖 ) ≤ 𝑓 (𝑥𝑖 ) + 𝑐 1𝛼Δ𝑥𝑖T ∇𝑓 (𝑥𝑖 ) where
Δ𝑥𝑖T ∇𝑓 (𝑥𝑖 ) < 0. The method described here is the most relaxed form of this condition (𝑐 1 = 0,
so any decrease in the objective is sufficient).
To incorporate CCD into a backtracking line-search (Algorithm 20), the initial value of 𝛼 is
set to the minimum time of impact. By doing this it is guaranteed that all 𝛼 ≤ CCD(q, q + Δ𝑥)
are intersection free.
5.3.4 Variational Friction Model. Up to this point we have only discussed friction-less contact.
In order to add friction into the IPC model, we need to derive a potential such that its gradient
generates the frictional forces. Several others have looked at the problem of defining a smooth
friction model [Geilinger et al. 2020; Macklin et al. 2020b] in particular for its applications in
differentiable simulation. Here we will focus solely on the model proposed by Li et al. [2020].
Starting from the force perspective, we can defines friction forces variationally by maximizing
the dissipation rate subject to the Coulomb constraint. That is for the 𝑘 th contact, compute the

143
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

0.5

Friction force
0

-0.5

-1
-1 -0.5 0 0.5 1
Tangent relative velocity

Fig. 34. The smooth transition from static to dynamic friction converges to the exact relation as the
frictional accuracy threshold, 𝜖 𝑣 gets smaller.

friction force 𝐹𝑘 as
𝐹𝑘 (q, u) = 𝑇𝑘 (q)argmin𝛽𝑇 u𝑘 s.t. ∥𝛽 ∥ ≤ 𝜇𝑁𝑘 (q), (295)
𝛽∈R2

where 𝑇𝑘 (q) ∈ R3𝑛×2 is the sliding basis at the point of contact, 𝑁𝑘 (q) is the magnitude of
the normal force, and 𝜇 is the local friction coefficient. To remove the dependency on u we
can use our time integration method to compute the velocity from change in position (e.g.,
u = ℎ1 (q − q𝑡 ) for implicit Euler).
Notice that both 𝑇𝑘 and 𝑁𝑘 depend on q. This is because as the position of the vertices
move the tangential basis of the contact change. For example, in a point-triangle contact the
tangential basis lies co-planar with the triangle, so the basis moves as the the triangle deforms.
Similarly the normal force grows as the distance between elements shrinks and vice versa.
Let Δq̃𝑘 = 𝑇𝑘 (q)(q − q𝑡 ) ∈ R2 be the relative sliding displacement of the 𝑘 th contacting
point over the timestep. These friction forces have the form 𝐹𝑘 = −𝜇𝑁𝑘 (q)𝑇𝑘 (q) 𝑓 , where in
Δq̃
the dynamic case (∥u∥ > 0), 𝑓 = ∥Δq̃𝑘𝑘 ∥ , but in the static case (∥u∥ = 0), 𝑓 can be any vector
in the 2D unit disk. This demonstrates the first challenge when integrating such forces: the
transition between sticking and sliding comes with a discontinuous jump in both the force
magnitude and direction.
To address this, the transition between static and dynamic friction is mollified using a
function
( 2
− 𝜖 𝑠2ℎ2 + 𝜖2𝑠𝑣 ℎ , |𝑠 | < ℎ𝜖𝑣
𝑚𝜖𝑣 (𝑠) = 𝑣 (296)
1, otherwise

where 𝑠 is the input (speed) and, similar to 𝑑ˆ in the contact formulation, 𝜖𝑣 controls the accuracy
of the model with smaller values approaching the full discontinuous transition (see Figure 34).

144
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

This lead us to a smooth friction force defined as


𝑚𝜖 (∥Δq̃𝑘 ∥)
𝐹𝑘 (q) = −𝜇𝑁𝑘 (q)𝑇𝑘 (q) 𝑣 Δq̃𝑘 . (297)
∥Δq̃𝑘 ∥
Notice that for the static case (∥Δq̃𝑘 ∥ = 0) it may seem that we have a division by zero, but
in fact by dividing the first case in 𝑚𝜖𝑣 by 𝑠:
1 −𝑠 2
 
2𝑠 −𝑠 2
2 2
+ = 2 2+ ,
𝑠 𝜖𝑣 ℎ 𝜖𝑣 ℎ 𝜖𝑣 ℎ 𝜖𝑣 ℎ
we see that for 𝑠 = 0 this function is well defined.
There still remains one challenge with this formulation however. Because 𝑁𝑘 and 𝑇𝑘 depend
on q, there does not exist a well defined potential whose derivative produces the friction force.
To resolve this, Li et al. [2020] proposes to lag these values to their values at the beginning of
the time-step (or optimization).
lagged lagged
By setting 𝑁𝑘 and 𝑇𝑘 to some fixed value 𝑁𝑘 and 𝑇𝑘 we can define a dissipative
potential as
lagged
𝐷𝑘 (𝑥) = 𝜇𝑁𝑘 𝑀𝜖𝑣 (∥Δq̃𝑘 ∥) , (298)
where 𝑀𝜖′𝑣 (𝑠)= 𝑚𝜖𝑣 (𝑠) and the friction force is related to this potential by 𝐹𝑘 (𝑥) = −∇𝐷𝑘 (𝑥).
This dissipative potential can then be added to the objective function in Equation 291. Again
this leads to an unconstrained optimization that can be solved with Newton’s method using a
CCD-aware line-search.
For improved accuracy, the lagged values can be updated after the optimization and the new
objective can be minimized again. This process repeats until a force balance at the updated
positions is found. Unfortunately, IPC provides no guarantee that such convergence will occur.
This is the major limitation of this approach, but in practice this rarely occurrence.
A limitation of this model is that for the static case the zero-force solution is preferred. In
other approaches, one would try to use the static friction force that will make things stick
[Bridson et al. 2002]. Additionally, the mollified friction models may suffer from a viscous drag.
It can be controlled by the 𝜖𝑣 parameter but it can never be made to disappear. Geilinger et al.
[2020] demonstrate this for a similar smooth friction model.
5.3.5 Further Topics. The above covers the basics of the IPC approach to simulating deformable
bodies. Extensions to this method have been proposed for rigid [Ferguson et al. 2021], nearly
rigid [Lan et al. 2022], reduced models [Lan et al. 2021], and more. We point the interested
reader to these works for more information.
As a shameless plug, we point interested readers to the IPC Toolkit [Ferguson et al. 2020]
for a reference implementation of all these components discussed here for use in any exist
simulator or to PolyFEM [Schneider et al. 2019] for a full finite element simulation using IPC
(through the IPC Toolkit).

145
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

6 ANISOTROPIC FRICTION MODELING


The isotropic Coulomb friction model is used by many rigid body simulations in the field
of computer graphics [Bender et al. 2014], and indeed the focus of many works has been
on the difficult problem of formulating and solving isotropic Coulomb frictional contact and
its approximations. However, many real-world surfaces have characteristics that result in
anisotropic frictional behavior. For instance, consider surfaces with ridges or grooves. The
directional nature of the geometric features means that objects sliding on the surface will
experience frictional resistance that is dependent on the sliding direction.
There has been comparatively less attention in computer graphics on anisotropic models of
frictional contact. Nevertheless, various frameworks have been developed in recent years for
simulating anisotropic friction in computer graphics. In this chapter, we dive into the details
of a handful of approaches that address simulating anisotropic friction effects. Specifically, this
chapter covers friction tensors [Pabst et al. 2009], the Matchstick model [Erleben et al. 2020],
and a texture-based model where friction cones are computed from the normal map textures
of each colliding surface [Andrews et al. 2021]. Additional implementation details about using
these models with numerical solvers from Chapter 3 are also presented.
As we saw in Chapter 1, many physics simulators use friction models expressed as cones
or generic sets of feasible friction forces. Combining feasible set descriptions with extra
constraints, such as the principle of maximum dissipation, allows us to compute the friction
forces at a given instant in time. The benefit of such friction descriptions is that they permit an
easy implementation within a simulator. One can define a projection operator, and iteratively
project the friction force onto the closest feasible value. This property is the governing principle
about which many friction models can be defined. Let us now take a look at how these projection
operators can used for anisotropy.

6.1 The Matchstick Model


The Matchstick model produces a cone based on surface structural directions from each body
at the point of contact. Figure 35 shows simulation examples using this model. We begin by
examining how to generate an anisotropic friction cone based on the kinematic state of two
bodies, A and B. The main idea here is to create a convex cone based on the relative orientation
between the two surfaces.

6.1.1 Friction Cone Modeling. An important difference of anisotropic friction compared to


isotropic friction is that the local material frame of each surface is considered. Regarding
the Matchstick model, the structural directions on each surface are defined with respect to
some material frame. The directions can be interpreted as fiber directions or as micro-scale
geometry features, such as grooves. While other materials (e.g., cloth with warp and weft
directions) can be seen as having multiple material directions. For the sake of brevity, we limit
our presentation to the case of a single material direction.

146
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Fig. 35. The Matchstick model allows for control of frictional behavior in situations such as tire ground
contact, a hopper, and soft robotic gripping, where each example shown here also uses different
simulators with different contact solvers (Vortex, PROX, and Flex).

Fig. 36. The angle between matchsticks determines the friction cone. The Matchstick model interpolates
between isotropic C𝐼 and anisotropic C𝐴 extremes (see Equations 302, 305, and 308).

For any given contact frame (see Figure 4), the material direction of each surface can be
written as unit vectors sA and sB , in the space of the tangent plane. These directions depend
on the point of contact on each surface, and in a typical implementation they can be stored in
a texture or generated procedurally. Given a simple parameterized cone generator, GA↔B , that
computes a friction cone that describes the set of allowable friction forces based on the set of
local parameters, we denote the generated cone by the symbol FA↔B . Relaxing the notation
and not explicitly writing the object pairs, the generator can be defined as
F ≡ G (𝜆𝑛ˆ , v𝑡ˆ, sA (p), sB (p)) . (299)
The normal force magnitude is given by 𝜆𝑛ˆ . The above parameterization could be extended
with even more parameters to account for other dependencies. However, F here simply refers
to any parametric friction cone model to enhance readability.
6.1.2 The Matchstick Model. Next, we derive the Matchstick model for the framework of
anisotropic friction outlined in the previous section. The model is a phenomenological one,
and it is based on several observations about how surfaces with structural features interact as
they slide against each other (see Figure 36). Briefly, the frictional behavior appears isotropic
for a pair of matchsticks when moving in different direction, but keeping structure directions
orthogonal. Whereas the behavior is anisotropic for a pair of matchsticks when sliding in

147
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

different directions while keeping structure directions parallel. The model thus interpolates
between isotropic and anisotropic Coulomb behaviors using the minimum angle between the
structural directions.
With the simplifying assumption that the sign of the structure vector s can be ignored (i.e., if
the friction only depends on the orientation and not the direction), then the Matchstick model
interpolation parameter is based on the angle 𝜃 , and it is defined as
2
𝑑 ≡ 1 − cos−1 |sA · sB | . (300)
𝜋 | {z }
≡𝜃
Let the friction force in the world frame be given by f and let the coefficient of friction for a
planar isotropic Coulomb friction cone be 𝜇, equal to the tangent 𝑡ˆ and binormal 𝑏ˆ direction
coefficients for the isotropic cone, i.e.,
𝜇𝑡𝐼ˆ = 𝜇 𝐼ˆ = 𝜇 , (301)
𝑏
then the isotropic cone is defined by the relationship
" 2 #
1
0
f 𝑇 R𝑇 𝜇 1 2 Rf ≤ 𝜆𝑛ˆ 2 . (302)
0 𝜇
| {z }
≡C𝐼
Here, R can be any rotation matrix for an isotropic cone, but for consistency we define R as
the 2D rotation of (sA + sB ) onto the 𝑡ˆ axis, assuming that sA · sB is positive (given that only
the orientation is needed, we can swap the sign of one of the vectors to ensure positive dot
product). This implies that the tangent plane vectors are defined as
sA + sB
𝑡ˆ ≡ , (303)
∥sA + sB ∥
𝑏ˆ ≡ 𝑛ˆ × 𝑡ˆ . (304)
By construction, 𝑡ˆ and 𝑏ˆ are the major and minor axis of the anisotropic ellipse cone, respectively.
And while the planar rotation matrix R is useful for explaining the model, the column vectors
𝑡ˆ and 𝑏ˆ are needed when assembling the Jacobian matrix.
For anisotropic Coulomb friction, the coefficients of friction are 𝜇𝑡𝐴ˆ ≤ 𝜇 𝐴ˆ , where the 𝐴
𝑏
superscript denotes anisotropy. Similar to the isotropic case, the anisotropic cone is defined by
the quadratic inequality
12 0 
 𝜇𝐴
 Rf ≤ 𝜆𝑛ˆ 2 .

f 𝑇 R𝑇  𝑡ˆ 1 2
(305)
 0 𝐴
𝜇ˆ 
 𝑏
| {z }
≡C𝐴

148
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: Structure directions sA , sB , contact normal 𝑛,


ˆ isotropic friction 𝜇, extreme friction
coefficients 𝜇𝑡𝐴ˆ , 𝜇 𝐴ˆ .
𝑏
Result: Contact plane vectors 𝑡ˆ, 𝑏, ˆ and coefficients of friction 𝜇 ˆ, 𝜇 ˆ .
𝑡 𝑏
1 if sA · sB < 0 then
2 sB ← −sB ;
3 end
4 𝜃 ← cos−1 (sA · sB );
5 𝑑 ← 1 − 2𝜋𝜃 ;
6 𝜇𝑡ˆ ← 𝑑 𝜇𝑡𝐴ˆ + (1 − 𝑑) 𝜇;
7 𝜇𝑏ˆ ← 𝑑 𝜇 𝐴ˆ + (1 − 𝑑) 𝜇;
𝑏
8 𝑡ˆ ← ∥ssAA +s B
+sB ∥ ;
9 𝑏ˆ ← 𝑛ˆ × 𝑡ˆ;
Algorithm 21: MatchStickFrictionGenerator The generator gives both the world
orientation of the friction cone as well as the coefficients of friction, which is an advantage
when working with an analytic cone that is fully described by these parameters.

In the case of the Matchstick model, the friction cone generator G computes the coefficients
by a spherical linear interpolation between the isotropic and anisotropic cones, such that
𝜇𝑡ˆ ≡ 𝑑 𝜇𝑡𝐴ˆ + (1 − 𝑑) 𝜇 , (306)
𝜇𝑏ˆ ≡ 𝑑 𝜇 𝐴ˆ + (1 − 𝑑) 𝜇 . (307)
𝑏
Thus, the actual Coulomb cone based on the kinematic configuration is given by:
"12 #
0 2
f 𝑇 R𝑇 𝜇𝑡ˆ 2 Rf ≤ 𝜆𝑛 . (308)
0 𝜇1ˆ
𝑏
| {z }
≡C𝑀

The Matchstick friction model generator is outlined in Algorithm 21. A nice aspect about the
model is that it has a small memory footprint and fast computational complexity for generating
the cone and using it at run time. In the next section we will outline how the Matchstick model
can be incorporated into different modeling approaches and solvers, before we conclude our
presentation with some implementation notes. Thereby we demonstrate the Matchstick model
to be a general model suitable for any type of simulator.
6.1.3 Fixed-point Solvers. We will now present how the Matchstick model can be used in a
solver. Iterative methods for contact force computations are the natural choice for arbitrary
friction cones. We will first consider the class of methods based on proximal operators as

149
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

described in Section 3.4. In methods based on proximal operators, the next feasible friction
impulse iterate 𝝀𝑡ˆ𝑘+1 is given by projecting the current guess 𝝀𝑡ˆ𝑘 onto the friction cone, such
that  
𝝀𝑡ˆ𝑘+1 ← proxF 𝝀𝑡ˆ𝑘 − 𝑟𝑡ˆ v𝑡ˆ𝑘 , (309)
h i𝑇
and tangential forces 𝝀𝑡ˆ = 𝜆𝑡ˆ 𝜆𝑏ˆ are projected into the anisotropic cone

𝜆𝑡2ˆ 𝜆 2ˆ
( ! )
F ≡ 𝝀𝑡ˆ + 𝑏
≤ 𝜆𝑛ˆ 2 . (310)
𝜇𝑡2ˆ 𝜇 2ˆ
𝑏

Here, 𝑘 is the iteration index and 𝑟𝑡ˆ is a scalar relaxation parameter known as the 𝑟 -factor. The
algorithm then proceeds using a sweeping process. First, Equation 299 is used to instantiate
the current friction cone, F , and then that cone is used in the proximal point update given
by Equation 309. Algorithm 22 illustrates how a PROX-based block Gauss-Seidel variant is
modified to accommodate such friction models. Observe that the only change is the addition of
line 8 in the algorithm, before the friction proximal step, which instantiates the friction model.
6.1.4 LCP-based Solvers. For LCP based approaches, one may discretize a parameterized cone
by shooting rays from the origin of the limit surface in various directions and use the limit
surface points to build a polygonal approximation to the generated cone, such as the one
shown in Figure 6. Each facet of the polyhedral cone will match one complementary constraint
in the LCP model. While it is trivial to generate the polygonal facets, the main drawback is
that one may need many facets to obtain a good approximation. The memory footprint of the
polyhedral LCP has quadratic scaling with the number of constraints and the solver time will
suffer accordingly. Hence, nonlinear complementary formulations can be more attractive for
parametric cones.
6.1.5 NCP-based Solvers. Let us consider how to use a parameterized cone F in a Newton type
framework by using non-smooth functions, such as the Fischer-Burmeister function [Macklin
et al. 2019]. Without loss of generality, assume we have any type of complementary function,
𝜓 (𝑎, 𝑏) : R × R ↦→ R such that
0 ≤𝑎 ⊥𝑏 ≥ 0 ⇔ 𝜓 (𝑎, 𝑏) = 0 . (311)
Using an implicit limit surface of the cone we let 𝜂 be the corresponding implicit function of
F,
𝜂 ≡ f 𝑇 R𝑇 C𝑀 Rf − 𝜆𝑛ˆ 2 . (312)
Then by the principle of maximal dissipation we can write
∇𝜂 (f) = −𝛽 v𝑡ˆ , (313)

150
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Data: Indices of all contacts K, indices of all bodies B, and J, M, b, 𝑟 , 𝝀 0 , 𝜈.


Result:
 𝝀𝑘
𝑘, 𝝀𝑘 , 𝜖 𝑘 ← 0, 𝝀 0, ∞ ;

1

2 while not converged do


3 w ← M−1 J𝑇 𝝀𝑘 ;
4 foreach 𝑖 ∈ K do
5 I ≡ indices of block N𝑖 , F𝑖 ;
6 zI ← 𝝀𝑘I − 𝑟 (JIB w + bI );
7 𝜆𝑛𝑘+1 ← proxN𝑖 (z𝑛 );
8 F ← G(𝜆𝑛ˆ 𝑘+1
𝑖 , . . .); 
𝑘+1
9 𝝀𝑡ˆ𝑖 ← proxF zF𝑖 ; 
w ← w + M−1 J𝑇 BI 𝝀𝑘+1
 𝑘
10 I − 𝝀 I ;
11 end
12 𝜖 𝑘+1 = 𝝀𝑘+1 − 𝝀𝑘 ∞ ;
13 if 𝜖 𝑘+1 > 𝜖 𝑘 then
14 𝑟 ← 𝜈𝑟 ;
15 else   
16 𝝀𝑘 , 𝜖 𝑘 , 𝑘 ← 𝝀𝑘+1, 𝜖 𝑘+1, 𝑘 + 1 ;
17 end
18 end
Algorithm 22: ProxGaussSeidel The PROX Gauss-Seidel variant with an adaptive global
𝑟 -Factor strategy and parametric friction cones. The product M−1 J𝑇 may be precomputed.

where 𝛽 ≥ 0 is an auxiliary scalar variable. We can now restate the model with the help of the
complementary function,
𝜓 (𝛽, −𝜂 (f)) = 0 , (314)
𝜓 (v𝑡ˆ𝑇 v𝑡ˆ, w𝑇 w) = 0 , (315)
where we now introduce w = ∇𝜂 (f) +𝛽 v𝑡ˆ. The above model gives us a root finding problem and
can be solved with a Newton type of method. For this purpose we must obtain the generalized
Jacobian of these equations. The differential becomes

𝑑𝜓 (𝛽, −𝜂 (f)) = 𝜕𝑎𝜓 𝑑𝛽 − 𝜕𝑏𝜓 ∇𝜂𝑇 𝑑f , (316)


𝑑𝜓 (v𝑡ˆ𝑇 v𝑡ˆ, w𝑇 w) = 2𝜕𝑎𝜓 v𝑡ˆ𝑇 𝑑v𝑡ˆ + 2𝜕𝑏𝜓 w𝑇 𝑑w , (317)

151
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Fig. 37. A structure field on a ravine slope can be used to steer a log slide towards (top) or around
(bottom) a cube-shaped building.

where
𝑑w = v𝑡ˆ 𝑑𝛽 + ∇2𝜂 𝑑f + 𝛽 𝑑v𝑡ˆ . (318)
Here we use ∇2 to denotes the Hessian of 𝜂. Assembling all parts we can write
" #  𝑑𝛽 
𝑑𝜓 (𝛽, −𝜂 (f))  
= J (319)
 
𝜓  𝑑f 
𝑑𝜓 (v𝑡ˆ v𝑡ˆ, w w)
𝑇 𝑇  
𝑑v ˆ
 𝑡
where J𝜓 is the Jacobian one will need for implementing a Newton method, and is computed as
" #
𝜕𝑎𝜓 −𝜕𝑏𝜓 ∇𝜂𝑇 0
J𝜓 ≡  .
2 𝜕𝑏𝜓 w𝑇v𝑡ˆ 2 𝜕𝑏𝜓 w𝑇 ∇2𝜂 2 𝜕𝑎𝜓 v𝑡ˆ𝑇 +𝜕𝑏𝜓 w𝑇𝛽
 

Figure 37 shows examples of Flex which uses a fully implicit solver based on a Newton
method using a Fischer-Burmeister formulation.
6.1.6 Implementation Notes. Notice that a friction cone generator G, such as the h one ini
Algorithm 21, returns not only a friction cone F , but also the cone orientation C ≡ 𝑛ˆ 𝑡ˆ 𝑏ˆ .
Here, C is needed for the assembly of the contact Jacobian, as is evident from Equation 22.
Hence, one may wish to invoke the generator when assembling the contact Jacobian or split
the generator implementation into two sub-routines– one for computing the cone and one for
determining the contact frame. The choice is intimately related to how the time-discretization
of the friction cone is implemented. Imagine that the cone generator parametrically depends
on the sliding velocity v𝑡ˆ and that a fully implicit integration scheme is wanted. In this case,
the generator truly needs to be invoked each time before projecting 𝝀𝑡ˆ to the cone. However,

152
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

in most cases the positions and orientations are not updated inside the solver algorithm as
shown in Algorithm 22, and both the cone orientation and limit surface can be computed
outside the solver for improved computational efficiency. However, for the Newton type solver
outlined above, one must update cone orientations continuously as positions and velocities
are solved in a fully coupled way, which gives a fully implicit time-integration method.
We note that an additional torque can be included in the friction model, which introduces an
angular moment about the contact normal based on an additional friction coefficient, 𝜇𝜏 . The
value of this coefficient is computed similar to 𝜇𝑡ˆ and 𝜇𝑏ˆ , and this type of torsional friction
is also known as a Coulomb–Contensou friction model. Inclusion of this torque is optional
from a modeling perspective, but does result in a higher-dimensional limit surface, and thus
2
requires a third diagonal term in C as 𝜇1𝜏 , thus promoting R to a 3D rotation matrix. The
proximal operator for this surface can then be solved numerically, as outlined in Section 3.4.3,
whereas omitting this additional term gives a planar surface and the projection can be solved
analytically.

6.2 Friction Tensors


The friction tensor model was introduced to the graphics community by Pabst et al. [2009].
Material parameters of the model are described by one scalar and two tensors: 𝜅 ∈ R+ and
QA, QB ∈ R2×2 . This gives a total of 9 parameters for planar friction, which can be encoded as
texture maps in a practical implementation. The model defines dynamic friction, f, by a direct
evaluation of
 
f ≡ −λ𝑛ˆ 𝜅 QA + RQB R𝑇 v𝑡ˆ , (320)

where v𝑡ˆ is the unit-length tangential relative sliding vector, λ𝑛ˆ is the magnitude of the normal
force. Observe that it is necessary to first align the tensor from the second surface B with
the first surface A before combining them. This is achieved by a rotation around the contact
normal 𝑛,ˆ which aligns the tangential bases vectors 𝑡ˆA and 𝑡ˆB from each surface, such that

𝜃 ≡ acos 𝑡ˆA · 𝑡ˆB ,




ˆ 𝜙) ,
R ≡ R(𝑛,

and R(𝑛,ˆ 𝜙) is the rotation around 𝑛ˆ with angle 𝜃 . The work of Pabst et al. [2009] provides
many pointers on how to generate and setup these parameters in an implementation.
The friction tensor model is quite easy to add to solvers based on a “lagged” friction model
where direction evaluation of the friction force is sufficient. In some cases, the model can be
converted into a cone description. We therefore present the cone reformation in full detail,
since this gives more insight into the nature of the model.

153
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

We define the linear operator L to derive the cone counterpart of the friction tensor model:
 
f = −λ𝑛ˆ 𝜅 QA + RQB R𝑇 v𝑡ˆ
| {z }
≡L
= −λ𝑛ˆ L v𝑡ˆ
Assuming that L is non-singular, we may now write:
f = −λ𝑛ˆ L v𝑡ˆ (321)
⇒ L−1 f = −λ𝑛ˆ v𝑡ˆ (322)
2
⇒ L−1 f = λ𝑛2ˆ (323)
 
−𝑇 −1
⇒ f L L f = λ𝑛2ˆ
𝑇
(324)
| {z }
≡C𝑃

Observe that this is the same as an elliptical-cone Coulomb friction model we used in Section
6.1.2, and an eigenvalue decomposition will recover the usual cone description
1 0 
 𝜇2
C𝑝 → R  𝑡ˆ
𝑇
1
 R. (325)
0 𝜇 2ˆ 
 𝑏

Next, let us investigate the dissipation of the model. Writing the instantaneous power,
v𝑡ˆ𝑇 Lv𝑡ˆ
v𝑡ˆ · f = −λ𝑛ˆ , (326)
∥v𝑡ˆ ∥
we observe that if QA and QB are symmetric positive definite, then there are sufficient conditions
to state that L will always be symmetric and positive definite. In this case, the friction force
will always be dissipative.
Recall from the principle of maximum dissipation that the negative sliding velocity must be
in the normal cone of the friction cone, or −v𝑡ˆ ∈ NC𝑃 (f), if f is the maximal dissipative force
(see Section 1.5.1). We may now use an implicit function to express the friction cone version
of the friction tensor model:
 
𝜓 (f) ≡ f 𝑇 L−𝑇 L−1 f − λ𝑛2ˆ . (327)

To prove that f is maximal dissipating, there must exist some value 𝛽 > 0 such that
− 𝛽 v𝑡ˆ = ∇f 𝜓 (f) . (328)

154
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

It is straightforward to find an expression for ∇f 𝜓 (f):


   
𝑑 f 𝜓 = 𝑑f 𝑇 L−𝑇 L−1 f + f 𝑇 L−𝑇 L−1 𝑑f (329)
 
𝑇 −𝑇 −1
= 2f L L 𝑑f . (330)
| {z }
≡(∇f 𝜓 )𝑇
Hence,  
−𝑇 −1
− 𝛽 v𝑡ˆ = 2 L L f. (331)
𝛽
Finally, redefining 𝛽 ← 2λ𝑛ˆ and recalling that f = −λ𝑛ˆ Lv𝑡ˆ, we have:
𝛽 v𝑡ˆ = L−𝑇 v𝑡ˆ (332)
This shows that the friction tensor model is only maximal dissipating when the direction of
sliding is an eigenvector of L−𝑇 . This also shows that there can be single cases (two for planar
sliding) where the model is maximally dissipative, but in general v𝑡ˆ can have any direction.
Thus there are infinitely many cases where the principle of maximum dissipation will not hold.
In summary, the friction tensor model cannot be directly plugged into an existing simulator
based on the concept of cones as it requires L to be non-singular and needs the computation of
C𝑝 and its eigenvalue decomposition. Further, when L is symmetric positive definite the model
is always dissipating, but not necessarily maximally dissipating. Hence, the friction tensor
model is best suited for approaches using a direct evaluation of the friction force, and in these
cases it provides a very high level of expressiveness due to using 9 parameters to parameterize
the friction behavior at a single point of contact. Pabst et al. [2009] show that friction tensors
can be extended to support asymmetric behaviors too by adding a selection function to choose
from different underlying tensor parameters based on the current sliding direction.

6.3 Texture Friction


Like the Matchstick model, the texture friction model proposed by Andrews et al. [2021]
computes the limit surface on-the-fly using a surface encoding of geometric details. However,
rather than assuming there are specific structural directions aligned with the material, a normal
map texture is used to evaluate the friction cone for surface patches from each colliding surface.
These are the same textures used to render visual appearance of roughness in many computer
graphics applications, and so there is consistency between the frictional behavior and the
visual appearance of the objects.
The normal textures encode the facet orientations on the surface of simulation objects
due to meso-scale asperities. When asperities, from one surface collide with another surface,
there is elastic deformation, fracture, and even plowing [Sheng Chen and Liu 2016]. This last
phenomenon contributes to friction by asperities from one surface plowing into the another
surface. This is where the texture-based friction model begins.

155
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

n
d
𝜃 m

Fig. 38. A surface asperity shown in blue has meso-facet direction 𝑚ˆ and mean surface direction 𝑛.
ˆ It
ˆ
is being pushed in the direction 𝑑, and thus plows into the opposing surface creating friction.

6.3.1 The Plowing Model. Friction due plowing is based on the angle of a meso-facet 𝜃 , such
that
2
𝜇 = tan𝜃, (333)
𝜋
and 𝜃 = acos(𝑛ˆ · 𝑚)
ˆ is the angle between the mean surface normal 𝑛ˆ and the meso-facet normal
ˆ The principal concepts of the plowing model are illustrated in Figure 38.
𝑚.
From Equation 333, it is clear that the plowing model is capable of generating an isotropic
limit surface based on the orientation of a meso-facet, since we have already seen how this is
done from a single friction coefficient in earlier chapters. However, consider for a moment
the analogy that a meso-facet behaves like a plow blade that grinds against another surface.
It is easy to conceive that the resistance to motion will increase if the plowing direction is
aligned with 𝑚.ˆ The friction can therefore be limited by considering the direction of sliding in
the tangent plane of the contact surface, or 𝑑. ˆ The modified version of the friction model can
be written as:
  2
𝜇𝑑ˆ = 𝑚ˆ ′ · 𝑑ˆ 𝜃, (334)
𝜋
Here, 𝑚ˆ ′ is the facet orientation 𝑚ˆ projected on the tangent space of the contact plane. This
version of the model is now capable of exhibiting anisotropy, since 𝜇 depends on the sliding
direction.
The model is further extended by noting that the meso-facet may be oriented in the direction
opposite plowing. For instance, consider that the asperity shown in Figure 38 begins moving
in the opposite direction, in which case no friction should be generated by the facet on the
right-hand side of the asperity. This one-sided behavior is achieved by the max function:
  2
𝜇𝑑ˆ = max 0, 𝑚ˆ ′ · 𝑑ˆ 𝜃 (335)
𝜋
This version of the model is now anisotropic and asymmetric. Since there are two surfaces A
and B colliding, directional friction coefficients for both can be computed and combined, such

156
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

that
  2   2
𝜇𝑑ˆ = max 0, 𝑚ˆ ′A
·𝑑ˆ ′
𝜃 A + max 0, 𝑚ˆ B · 𝑑ˆ 𝜃B , (336)
𝜋 𝜋
| {z } | {z }
𝜇𝑑,A
ˆ 𝜇𝑑,B
ˆ

where 𝜃 A ,𝑚ˆ ′A and 𝜃 B ,𝑚ˆ ′B are coincident features from surfaces A and B, respectively.
6.3.2 Texture Friction for Surface Patches. Next, we consider how this model can used to
approximate the limit surface for small regions of colliding surfaces. Since the meso-facet
orientations are encoded on surfaces using normal map textures, an efficient way to evaluate
the model at many different points on the surface is by using a GPU-based rendering pipeline.
This also has the benefit that efficient routines for clipping and culling surface geometry are
automatically leveraged.
A patch surrounding each contact point is rendered using a special fragment shader, and the
model in Equation 335 is evaluated for each pixel. The results are rendered into framebuffers
𝐼 A and 𝐼 B , one for each surface. This is done by constructing a small viewing volume around
the contact point that is aligned with the contact frame. The pixels in each framebuffer store
the directional friction coefficients, and computing the aggregate friction coefficients for each
patch involves integrating the coefficients over the patch. The authors Andrews et al. [2021]
propose averaging the coefficients, such that
1 ∑︁ 1 ∑︁
𝜇𝑑ˆ𝑘 = 𝐼 A (𝑖,𝑗)∈P + 𝐼 B (𝑖,𝑗)∈P ,
|P | |P |
where P is set of all pixel coordinates (𝑖, 𝑗) and coordinate 𝑘 selects a direction. This implies
that a discrete number of plowing directions may be rendered using this pipeline.
For example, to generate a limit surface that is compatible with a BLCP formulation, we
can compute directional friction coefficients in the four sliding directions aligned with the
tangent and binormal directions {−𝑡ˆ, −𝑏, ˆ 𝑡ˆ, 𝑏}.
ˆ This results in directional friction coefficients
{𝜇−𝑡ˆ, 𝜇−𝑏ˆ, 𝜇𝑡ˆ, 𝜇𝑏ˆ }. Figure 39 shows normal textures from two surface patches rendering using the
process described above, and the resulting directional coefficient images. This approach is not
limited to just four plowing directions. It is trivial to use a larger number of tangent directions
and evaluate the model for each of these directions, for instance to compute coefficients for a
linear polyhedral cone presented in Section 1.6.
Having computed the coefficients {𝜇 −𝑡ˆ, 𝜇−𝑏ˆ, 𝜇𝑡ˆ, 𝜇𝑏ˆ }, it is now trivial to include them in a BLCP
formulation and solve for frictional forces using a fixed-point iterative solver. For instance,
the projection presented in Section 3.2.2 is modified with friction bounds computed using the
directional coefficients:
𝝀𝑡ˆ ← min (𝜇𝑡ˆ𝝀𝑛ˆ , max ((𝜇 −𝑡ˆ𝝀𝑛ˆ ), 𝝀𝑡ˆ)) (337)

𝝀𝑏ˆ ← min 𝜇𝑏ˆ 𝝀𝑛ˆ , max (𝜇−𝑏ˆ 𝝀𝑛ˆ ), 𝝀𝑏ˆ (338)

157
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

texture patch A texture patch B IA IB

Fig. 39. Patches rendered from surfaces with a sawtooth texture (A) and bumpy texture (B). The
resulting coefficient images for four axis-aligned plowing directions are also shown for both surfaces.
Note that only part of surfaces overlap, and hence only the upper-left corner of each coefficient image
will used to compute the aggregate directional coefficients.

Fig. 40. A cube sliding on a textured plane. When the cube is pulled in a direction aligned with the
ridges of a sawtooth texture, it slides easily (left). The same cube is pulled against the ridges and large
friction forces are generated, causing it to stick.

6.4 Other Anisotropic Approaches


Anisotropic Coulomb friction is supported by many physics engines [CM Labs Simulations
2017; Coumans 2005; Todorov et al. 2012]. An appealing characteristic of the models presented
in this chapter is that material parameters can be stored separately for each object, and
then either the friction forces or a limit surface are computed on-the-fly by combining local
information from each colliding surface. However, more pragmatic approaches than the ones
presented in this chapter are often used. A popular choice is to use a material-pair look-up
table storing one or more Coulomb coefficients. Alternatively, friction coefficients are assigned
to each object, but then averaged when objects collide to compute aggregate coefficients.
Another challenging aspect when dealing with anisotropic friction models is that a common
material frame must be specified in order to compute the direction dependent friction forces.
Many physics engines use the current sliding direction to determine the first principal axis of
the material frame. Another common approach is to assign the material frame from the local
coordinate frame of one of the colliding objects.

158
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

Table 5. Overview of common dynamic friction models used in computer graphics. ANISO denotes
aniosotropic, PMD denotes principle of maximum dissipation, INT denotes intrinsically defined in the
contact frame, 𝜆𝑛ˆ is the normal force/impulse, and v is the relative contact velocity.

Model Name Shape # Params Frame Orientation Scaling ANISO PMD INT
Isotropic Coulomb Circle 1 None Linear in 𝜆𝑛ˆ No Yes Yes (1)
[Baraff 1989]
Anisotropic Ellipse 2 Fixed on one object Linear in 𝜆𝑛ˆ Yes Yes Yes (1)
Coulomb (2) or by sliding velocity
Limit Surfaces Any Cone ∞ Not specified Linear in 𝜆𝑛ˆ Yes Yes (3) Yes
[Goyal et al. 1989]
Friction Tensors Affine Map 9 Fixed to one of the Linear in 𝜆𝑛ˆ Yes No (4) No (5)
[Pabst et al. 2009] structure fields
Cloth Friction Load force > 6 (6) Fixed to material Nonlinear in No Yes Yes
[Chen et al. 2013] curve space 𝜆𝑛ˆ , quadratic
in v
Matchstick Ellipse 3 Mean of both struc- Linear in 𝜆𝑛ˆ Yes Yes Yes
[Erleben et al. 2020] ture field directions
Texture Friction Polyhedral 2 Replaced by Linear in 𝜆𝑛ˆ Yes Yes No
[Andrews et al. 2021] sampling

(1) Many engines either average friction coefficients assigned to objects, or use a material-pair look-up table.
(2) Anisotropic Coulomb friction is used in many physics engines, where the sliding direction is used to determine
the first major principal axis of the contact coordinate system. However, the sliding and least direction of
friction are not always parallel in reality.
(3) Supports non-convex cones giving rise to non-uniqueness even when PMD is applied.
(4) PMD is fulfilled only under restriction of symmetric positive definite friction tensors.
(5) Two separate friction tensors combine to give the intrinsic friction map.
(6) Three nonlinear function are fit to data using linear regression. Hence, more than 6 parameters seems
reasonable as otherwise the 3 nonlinear functions would be no better than a linear fitting.

Table 5 presents a brief overview and comparison of work on friction models used in the
field of computer graphics. The different traits in the table can help guide the selection of a
model for a given application.

159
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

A TUTORIAL: PROGRAMMING A RIGID BODY SIMULATOR WITH


FRICTIONAL CONTACT
This appendix covers the main steps for developing a simple rigid body simulator with frictional
contact. Specifically, this tutorial encompasses the following concepts:
• Semi-implicit integration of rigid bodies (Section 1.2)
• Collision detection between analytic shapes (Section 2.1)
• Building the contact Jacobian for boxed LCPs (Section 1.7)
• Solving boxed LCPs using the PGS method (Section 3.2)
Getting started. As a first step, visit the “Rigid Body Simulations with Frictional Contact”
tutorial website:
https://github.com/siggraphcontact/rigidBodyTutorial
Follow the instructions in the README to build the project files and load the code using your
favorite development environment. Compile and execute the rigidBodyTutorial project and
you should see the simulation viewer appear on your screen as shown in Figure 41.

Fig. 41. The simulation viewer for the rigid body tutorial. You should see a similar view when you run
the tutorial code for the first time.

The starter code is written in C++ and uses Eigen for linear algebra operations. Therefore,
we transition to a less formal presentation of technical information that is closer to the code
you will write for the implementation. Locations in the code where you should implement the
objectives described below are annotated with a //TODO comment. They indicate where you
should implement the objectives described below. Let’s get started!
Step 1: Numerical integration of rigid bodies. The first objective in simulating contact is
having bodies that move and collide. Therefore, for this step, you will update the positions and

160
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

orientations of bodies using a numerical integrator. Implement your changes in the function
step in RigidBodySystem.cpp.
Begin by looping over each RigidBody in the member array m_bodies and use the semi-
implicit time integration scheme described in Section 1.2 to update the positions and orienta-
tions of the rigid bodies. Compute the updated velocities of each rigid body using the forces
(f) and torques (tau). For instance, the code below is a realization of Equation 3 that includes
gyroscopic forces:
body -> xdot += dt * (1/ body ->m) * body ->f
body -> omega += dt * body -> Iinv *
( body -> tau - body -> omega . cross (I* body -> omega ))
The world space inertia and inverse inertia matrices, I and Iinv respectively, are already
computed for you. ANote that bodies with the fixed flag set to true should not move, and
their velocities must be set to zero.
The orientation of each body is stored as a quaternion q, which must be updated using a
special kinematic mapping that maps angular velocities omega to a quaternion differential.
The time rate of change can be computed as:
qdot = 0.5 * H * b -> omega
Here, H is 4 × 3 matrix defined as follows:
−q.x() −q.y() −q.z()
 
 
 q.w() q.z() −q.y()
H =  
 −q.z() q.w() q.x() 

 
 q.y() −q.x() q.w() 
 
Then, an update to the orientation can be computed as Δ q = h* qdot. Take care to renormalize
each quaternion, since they may not be unit length after the integration update. The code
to compute the gravitational force is already provided for you. It may be also a good idea to
re-read Section 1.10.1 when completing this step.
If updates to the rigid bodies are computed correctly, objects in the scene should begin to
fall when you start the simulation.
Step 2: Sphere-OBB Collision Detection. The sphere shown in the test scene (Figure 41)
should eventually fall and collide with the static box underneath. Implement the code for a
sphere-sphere collision test in the function collisionDetectSphereBox, which can be found
in the file collision/CollisionDetect.cpp. The code for sphere-sphere collision detection
is provided in collisionDetectSphereSphere as a guide for your implementation.
Use the process outlined in Section 2.1.2. First, transform the sphere into the local coordinate
system of the box. Then, perform tests between the local sphere center and each face of the
box to determine if the sphere is colliding with the box, and if so, which face of the box.

161
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Fig. 42. The collision point and contact normal are visualized by the viewer. This is the result when
your Sphere-OBB collision detection is working.

If the two shapes are colliding, the function should create an instance of Contact and set the
collision point, the normal, and the penetration depth in the constructor. The normal vector
and collision point should be specified relative to the global coordinate frame, and so additional
transformations are required to map the local normal and collision point to world space.
Add the new contact to the member array m_contacts, which is later used to compute the
contact Jacobian.
Step 3: Compute the contact Jacobian. As we saw in Chapter 1, there are several ways to
create the contact Jacobian for point-based contact, which dependings on the friction model.
However, for this exercise, let’s stick with one of the simplest models to implement– the boxed
LCP. This requires computing a Jacobian with three rows.
First, using the information contained in the Contact class, compute the contact frame that
includes the normal n and the two tangent directions, t and b. The normal has already been
computed during the collision detection phase. However, the tangent directions are computed
to form an orthonormal bases, such that n ⊥ t ⊥ b. There are many valid bases here, but it is
convenient to choose directions that are principally aligned with the global coordinate frame.
For example:
t = n. cross ( Vector3f (1 , 0, 0) )
The above cross product will not work if n and Vector3f(1,0,0) are co-linear, in which case
another axis aligned direction can be used. Recall that your implementation should ensure
that t and b are unit length.
Next, compute the constraint Jacobian based on Equation 43. Use the function computeJacobian
for your implementation. The Jacobian is stored in two 3 × 6 matrices– JA and JB– that
correspond to the first and second body, respectively. Since both the contact point p and the

162
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

JM-1 JT

M-1 0 0 0 JT
1,A 0 JT
3,A 0
J1,A J1,B 0 0 A
A 0 J2,B J2,C 0 0 M-1
B 0 0 JT
1,B JT
2,B 0 0
J3,A 0 J3,C 0 0 0 M-1 0 0 JT JT JT
nො 1 0 0 J4,C J4,D
C 2,C 3,C 4,C
0 0 0 M-1
D 0 0 0 JT
4,D
nො 3
nො 4 D
B J1,A M-1 T -1 T
A J1,A +J1,B MB J1,B J1,B M-1 T
B J2,B J1,A M-1 T
A J3,A 0
C
nො 2 -1 T
J2,B MB J1,B J2,B MB J2,B +J2,C M-1
-1 T T
C J2,C J2,C MC JT
-1
3,C J2,C M-1 T
C J4,C
J3,A M-1 T
A J1,A J3,C M-1 J T
C 2,C J3,A M-1 T -1 T
A J3,A +J3,C MC J3,C J3,C M-1 J T
C 4,C
0 J4,C M-1 T
C J2,C J4,C M-1 J
C 3,C
T J4,C M-1 T -1 T
C J4,C +J4,D MD J4,D

Fig. 43. A rigid body system with four contacts is shown. The system matrix is formed from the
Delassus operator involving the global constraint Jacobian J and mass matrix M. Upon inspection, there
is a clear block structure that may be exploited for a matrix-free implementation of the PGS method.

body positions are represented in global coordinate space, the contact vector arm for the first
and second body are conveniently computed by:

rA = p - bodyA ->x
rB = p - bodyB ->x

Once the vectors of the contact frame and vectors rA and rB have been computed, assemble
JA and JB according to Equation 43.
Step 4: Iterative BLCP solver. For this last objective, you will implement the projected
Gauss-Seidel method in solvers/SolverBoxPGS.h. Specifically, the blocked PGS method
(see Algorithm 8). However, rather than assembling the system matrix A, you will instead
implement a matrix-free version of the algorithm that directly uses the Jacobian matrices
computed in the previous step, as well as the inverse mass matrix of each body, to compute
the terms for each PGS update.
Observe from the example shown in Figure 43 that there are 𝐾 = 4 contacts and 𝑁 = 4 bodies.
The lead matrix is the product of three matrices– the global Jacobian matrix, the inverse mass
matrix, and the transposed Jacobian– or A = JM−1 J𝑇 . However, upon further inspection, it is
easy to see that there is a pattern to how this matrix is built.
Diagonal blocks are specific to a contact, and block (𝑖, 𝑖) corresponds to the 𝑖-th contact with
bodies 𝑝 and 𝑞. It is computed as the sum of matrices J𝑖,𝑝 M𝑝−1 J𝑇𝑖,𝑝 + J𝑖,𝑞 M𝑞−1 J𝑇𝑖,𝑞 . The values of
non-diagonal blocks with coordinates (𝑖, 𝑗) are non-zero only if the 𝑖-th and 𝑗-th contact share
a common body, in which case (𝑖, 𝑗) contains J𝑖,𝑝 M𝑝−1 J𝑇𝑗,𝑝 . . Otherwise, the non-diagonal block
is zero.

163
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

We can take advantage of this structure for the PGS algorithm. Writing the update for
variables of the 𝑖-th contact, x𝑖 :

  −1 ©­ ∑︁ ©­ ª ª
J𝑖,𝑝 M𝑝−1 J𝑇𝑖,𝑝 J𝑖,𝑞 M𝑞−1 J𝑇𝑖,𝑞 −1 −1
𝑇 𝑇
® ®
x𝑖 = + ­b𝑖 −
­
­ J𝑖,𝑝 M J + J𝑖,𝑞 M J ® x 𝑗 ®
­ 𝑝 𝑗,𝑝 𝑞 𝑗,𝑞 ® ®
| {z } ­ 𝑗≠𝑖 ­ | {z } | {z } ® ®
diagA[i] « «coupling body 𝑝 coupling body 𝑞¬ ¬
The term diagA[i] forms a 3×3 matrix, and implies that a small linear system is solved for
the block update of each x𝑖 . The solution is then projected to the bounds defined by the boxed
friction model and stored in the vector of constraint impulses lambda.
Also note that the terms J𝑖,𝑝 M𝑝−1 J𝑇𝑗,𝑝 and J𝑖,𝑞 M𝑞−1 J𝑇𝑗,𝑞 couple contacts 𝑖 and 𝑗 through bodies 𝑝
and 𝑞 respectively. However, there are many instances where these terms are will be zero if all
contacts are considered. Therefore, rather than looping over all contacts, a more efficient way
to evaluate the sum on the right-hand side is to visit the neighboring contacts (e.g., that have a
common body with contact 𝑖). A list of contact constraints involving each body is maintained
by the RigidBody class to make this task easier).
Below, a sketch of the main steps of the matrix-free block PGS solver is provided:
for ( int iter = 0; iter < maxIter ; ++ iter ) {
for ( int i = 0; i < numContacts ; ++ i) {
// Initialize x = rhs vector .
Eigen :: VectorXf x = b[i ];

// Accumulate contributions from other contacts


// coupled with bodyA
accumulateCoupledContacts ( contacts [i],
contacts [i]-> JAMinv ,
contacts [i]-> bodyA , x );

// Accumulate contributions from other contacts


// coupled with bodyB
accumulateCoupledContacts ( contacts [i],
contacts [i]-> JBMinv ,
contacts [i]-> bodyB , x );

// Solve the 3 x3 system and stored the result in lambda .


// diagA * contacts [i]-> lambda = x
//

164
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

// Recall that for isotropic BLCPs :


// Normal impulse : 0 <= lambda [0] < infinity
// Friction impules :
// -mu * lambda [0] <= lambda [1] < mu * lambda [0]
// -mu * lambda [0] <= lambda [2] < mu * lambda [0]
solveContact ( diagA [i], x , contacts [i]-> lambda ,
contacts [i]-> mu );
}
}
The code above assumes that diagA[i] and b[i] have been constructed during an initialization
step. The function accumulateCoupledContacts() loops over all other contacts that share
the body and computes modifications to the right-hand side vector:
x -= ( JMinv * Jother . transpose ()) * lambda_other
The function solveContact() solves the block 3-by-3 system that represents the BLCP of a
single contact. The function also projects the constraint impulses in lambda to the bounds
specified by the contact model.
All done? Congratulations! You have implemented a rigid body simulator with frictional
contact. There are many ways to extend the simulator. For instance, by using other numerical
methods to solve the BLCP, or by adding support for collision handling between other shapes
pairs, or using a non-linear friction cone. You are also encouraged to improve the performance of
the simulator, particularly the PGS solver loop (e.g., by pre-computing the Jacobian “sandwich”
transforms at the start of each time step, or using a gather-scatter strategy for computing the
coupling impulses)

165
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

REFERENCES
V. Acary, F. Cadoux, C. Lemaréchal, and J. Malick. 2011. A formulation of the linear discrete Coulomb friction
problem via convex optimization. ZAMM-Journal of Applied Mathematics and Mechanics/Zeitschrift für
Angewandte Mathematik und Mechanik 91, 2 (2011), 155–175.
S. Ainsley, E. Vouga, E. Grinspun, and R. Tamstorf. 2012. Speculative parallel asynchronous contact mechanics.
ACM Trans. Graph. 31, 6, Article 151 (Nov. 2012), 8 pages. https://doi.org/10.1145/2366145.2366170
S. Andrews, K. Erleben, P. G. Kry, and M. Teichmann. 2017. Constraint reordering for iterative multi-body
simulation with contact. In ECCOMAS ’17: Proc. of the Multibody Dynamics 2007 ECCOMAS Thematic Conference.
ECCOMAS, Prague, Czech Republic.
S. Andrews, L. Nassif, K. Erleben, and P. G. Kry. 2021. Coupling Friction with Visual Appearance. Proc. of the
ACM on Computer Graphics and Interactive Techniques 4, 3 (2021), 20. https://doi.org/10.1145/3480138
M. Anitescu and G. D. Hart. 2004. A constraint-stabilized time-stepping approach for rigid multibody dynamics
with joints, contact and friction. Intl. Journal for Numerical Methods in Engineering 60, 14 (2004), 2335–2371.
https://doi.org/10.1002/nme.1047
M. Anitescu and F. A. Potra. 1997. Formulating Dynamic Multi-Rigid-Body Contact Problems with Friction
as Solvable Linear Complementarity Problems. Nonlinear Dynamics 14 (1997), 231–247. Issue 3. https:
//doi.org/10.1023/A:1008292328909
M. Anitescu and A. Tasora. 2010. An iterative approach for cone complementarity problems for nonsmooth
dynamics. Computational Optimization and Applications 47, 2 (October 2010), 207–235. https://doi.org/10.
1007/s10589-008-9223-4
L. Armijo. 1966. Minimization of functions having Lipschitz continuous first partial derivatives. Pacific J. Math.
16, 1 (1966), 1 – 3.
D. Baraff. 1989. Analytical Methods for Dynamic Simulation of Non-Penetrating Rigid Bodies. In Proceedings of
the 16th Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH ’89). Association for
Computing Machinery, New York, NY, USA, 223–232. https://doi.org/10.1145/74333.74356
D. Baraff. 1993. Issues in computing contact forces for nonpenetrating rigid bodies. Algorithmica. An Intl. Journal
in Computer Science 10, 2-4 (1993), 292–352. https://doi.org/10.1007/BF01891843
D. Baraff. 1994. Fast contact force computation for nonpenetrating rigid bodies. In Proc. of the 21st Annual
Conference on Computer Graphics and Interactive Techniques (SIGGRAPH ’94). ACM, New York, NY, USA, 23–34.
https://doi.org/10.1145/192161.192168
D. Baraff and A. Witkin. 1998. Large Steps in Cloth Simulation. In Proc. of the 25th Annual Conference on
Computer Graphics and Interactive Techniques (SIGGRAPH ’98). ACM, New York, NY, USA, 43–54. https:
//doi.org/10.1145/280814.280821
A. W. Bargteil, T. Shinar, and P. G. Kry. 2020. An Introduction to Physics-Based Animation. In SIGGRAPH Asia
2020 Courses (Virtual Event) (SA ’20). ACM, New York, NY, USA, Article 5, 57 pages. https://doi.org/10.1145/
3415263.3419147
C. Batty, F. Bertails, and R. Bridson. 2007. A fast variational framework for accurate solid-fluid coupling. ACM
Trans. Graph. 26, Article 100 (July 2007). Issue 3. https://doi.org/10.1145/1276377.1276502
J. Baumgarte. 1972. Stabilization of constraints and integrals of motion in dynamical systems. Computer Methods
in Applied Mechanics and Engineering 1, 1 (1972), 1–16. https://doi.org/10.1016/0045-7825(72)90018-7
J. Bender, K. Erleben, and J. Trinkle. 2014. Interactive Simulation of Rigid Body Dynamics in Computer Graphics.
Comp. Graph. Forum 33, 1 (2014), 246–270.
S. Bouaziz, S. Martin, T. Liu, L. Kavan, and M. Pauly. 2014. Projective Dynamics: Fusing Constraint Projections
for Fast Simulation. ACM Trans. Graph. 33, 4 (July 2014), 154:1–154:11.
S. Boyd and L. Vandenberghe. 2004. Convex Optimization. Cambridge University Press, Cambridge. https:
//doi.org/10.1017/CBO9780511804441

166
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

R. Bridson, R. Fedkiw, and J. Anderson. 2002. Robust Treatment of Collisions, Contact and Friction for Cloth
Animation. ACM Trans. Graph. 21, 3 (July 2002), 594–603. https://doi.org/10.1145/566654.566623
T. Brochu, E. Edwards, and R. Bridson. 2012. Efficient Geometrically Exact Continuous Collision Detection. ACM
Trans. Graph. 31, 4, Article 96 (July 2012), 7 pages.
D. T. Chen and D. Zeltzer. 1992. Pump It up: Computer Animation of a Biomechanically Based Model of Muscle
Using the Finite Element Method. In Proc. of the 19th Annual Conference on Computer Graphics and Interactive
Techniques (SIGGRAPH ’92). ACM, New York, NY, USA, 89–98. https://doi.org/10.1145/133994.134016
Y. Chen, M. Li, L. Lan, H. Su, Y. Yang, and C. Jiang. 2022. A Unified Newton Barrier Method for Multibody
Dynamics. ACM Trans. Graph. (SIGGRAPH) 41, 4, Article 66 (2022).
Z. Chen, R. Feng, and H. Wang. 2013. Modeling Friction and Air Effects Between Cloth and Deformable Bodies.
ACM Trans. Graph. 32, 4, Article 88 (July 2013), 8 pages.
M. B. Cline and D. K. Pai. 2003. Post-stabilization for rigid body simulation with contact and constraints.
In 2003 IEEE Intl. Conference on Robotics and Automation, Vol. 3. IEEE, Taipei, Taiwan, 3744–3751. https:
//doi.org/10.1109/ROBOT.2003.1242171
CM Labs Simulations. 2017. Theory Guide: Vortex Software’s Multibody Dynamics Engine. Technical
Report. https://www.cm-labs.com/vortexstudiodocumentation/Vortex_User_Documentation/Content/
Concepts/theoryguide.html
R. Cottle. 1968. Complementary Pivot Theory of Mathematical Programming. Linear Algebra and Its Applications
1 (1968), 103–125. https://doi.org/10.1016/0024-3795(68)90052-9
R. Cottle, J.-S. Pang, and R. E. Stone. 1992. The Linear Complementarity Problem. Academic Press, Boston.
E. Coumans. 2005. The Bullet Physics Library. http://www.pybullet.org.
H. Courtecuisse, J. Allard, C. Duriez, and S. Cotin. 2011. Preconditioner-Based Contact Response and Application to
Cataract Surgery. In Proceedings of the 14th International Conference on Medical Image Computing and Computer-
Assisted Intervention - Volume Part I (Toronto, Canada) (MICCAI’11). Springer-Verlag, Berlin, Heidelberg,
315–322.
G. Daviet. 2020. Simple and Scalable Frictional Contacts for Thin Nodal Objects. ACM Trans. Graph. 39, 4, Article
61 (July 2020), 16 pages. https://doi.org/10.1145/3386569.3392439
G. Daviet, F. Bertails-Descoubes, and L. Boissieux. 2011. A hybrid iterative solver for robustly capturing coulomb
friction in hair dynamics. ACM Trans. Graph. 30, 6, Article 139 (Dec. 2011), 12 pages. https://doi.org/10.1145/
2070781.2024173
A. Enzenhoefer, N. Lefebvre, and S. Andrews. 2019. Efficient Block Pivoting for Multibody Simulations with
Contact. In Proc. of the 2019 ACM SIGGRAPH Symposium on Interactive 3D Graphics and Games (Montreal,
Quebec, Canada) (I3D ’19). ACM, New York, NY, USA, Article 2, 9 pages. https://doi.org/10.1145/3306131.
3317019
K. Erleben. 2005. Stable, Robust, and Versatile Multibody Dynamics Animation. Ph.D. Dissertation. Department of
Computer Science, University of Copenhagen (DIKU).
K. Erleben. 2007. Velocity-Based Shock Propagation for Multibody Dynamics Animation. ACM Trans. Graph. 26,
2 (June 2007), 12–es. https://doi.org/10.1145/1243980.1243986
K. Erleben. 2017. Rigid Body Contact Problems Using Proximal Operators. In Proc. of the 2017 ACM SIGGRAPH /
Eurographics Symposium on Computer Animation (Los Angeles, California) (SCA ’17). ACM, New York, NY,
USA, Article 13, 12 pages. https://doi.org/10.1145/3099564.3099575
K. Erleben, M. Andersen, N. S., and S. M. 2011. num4lcp. https://github.com/erleben/num4lcp.
K. Erleben, M. Macklin, S. Andrews, and P. G. Kry. 2020. The Matchstick Model for Anisotropic Friction Cones.
Comp. Graph. Forum 39, 1 (2020), 450–461. https://doi.org/10.1111/cgf.13885
Z. Ferguson et al. 2020. IPC Toolkit. https://ipc-sim.github.io/ipc-toolkit/

167
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

Z. Ferguson, M. Li, T. Schneider, F. Gil-Ureta, T. Langlois, C. Jiang, D. Zorin, D. M. Kaufman, and D. Panozzo. 2021.
Intersection-Free Rigid Body Dynamics. ACM Trans. Graph. (SIGGRAPH) 40, 4, Article 183 (jul 2021), 16 pages.
M. C. Ferris and T. S. Munson. 1999. Interfaces to PATH 3.0: Design, Implementation and Usage. Comput. Optim.
Appl. 12 (January 1999), 207–227. Issue 1-3. https://doi.org/10.1023/A:1008636318275
A. Fischer. 1992. A special newton-type optimization method. Optimization 24, 3-4 (1992), 269–284. https:
//doi.org/10.1080/02331939208843795
M. Foerg, T. Geier, L. Neumann, and H. Ulbrich. 2006. r-Factor Strategies for the Augmented Lagrangian
Approach in Multi-Body Contact Mechanics. In III European Conference on Computational Mechanics. Springer
Netherlands, Dordrecht, NL, 316. https://doi.org/10.1007/1-4020-5370-3_316
M. Fratarcangeli and F. Pellacini. 2015. Scalable Partitioning for Parallel Position Based Dynamics. Comput.
Graph. Forum 34, 2 (May 2015), 405–413. https://doi.org/10.1111/cgf.12570
S. F. Frisken, R. N. Perry, A. P. Rockwood, and T. R. Jones. 2000. Adaptively Sampled Distance Fields: A General
Representation of Shape for Computer Graphics. In Proc. of the 27th Annual Conference on Computer Graphics
and Interactive Techniques (SIGGRAPH ’00). ACM Press/Addison-Wesley Publishing Co., USA, 249–254. https:
//doi.org/10.1145/344779.344899
M. Geilinger, D. Hahn, J. Zehnder, M. Bächer, B. Thomaszewski, and S. Coros. 2020. ADD: Analytically
Differentiable Dynamics for Multi-Body Systems with Frictional Contact. ACM Trans. Graph. 39, 6, Article 190
(Nov. 2020), 15 pages. https://doi.org/10.1145/3414685.3417766
E. G. Gilbert, D. W. Johnson, and S. S. Keerthi. 1988. A fast procedure for computing the distance between
complex objects in three-dimensional space. IEEE Journal on Robotics and Automation 4, 2 (1988), 193–203.
https://doi.org/10.1109/56.2083
H. Goldstein, C. Poole, and J. Safko. 2002. Classical mechanics. Addison-Wesley, USA. 638 pages.
S. Goyal, A. Ruina, and J. Papadopoulos. 1989. Limit Surface and Moment Funktion Descriptions of Planar Sliding.
In Proc. of the 1989 IEEE Intl. Conference on Robotics and Automation (Vol. 2). IEEE, Scottsdale, AZ, 794–799.
D. Harmon, E. Vouga, B. Smith, R. Tamstorf, and E. Grinspun. 2009. Asynchronous Contact Mechanics. ACM
Trans. Graph. 28, 3, Article 87, 12 pages. https://doi.org/10.1145/1531326.1531393
D. Harmon, E. Vouga, R. Tamstorf, and E. Grinspun. 2008. Robust Treatment of Simultaneous Collisions. ACM
Trans. Graph. 27, 3 (aug 2008), 1–4. https://doi.org/10.1145/1360612.1360622
S. Hasegawa, N. Fujii, Y. Koike, and M. Sato. 2003. Real-Time Rigid Body Simulation Based on Volumetric
Penalty Method. In HAPTICS ’03: Proc. of the 11th Symposium on Haptic Interfaces for Virtual Environment and
Teleoperator Systems. IEEE Computer Society, Los Alamitos, CA, USA, 326. https://doi.org/10.1109/HAPTIC.
2003.1191304
J. Jansson and J. S. M. Vergeest. 2002. A discrete mechanics model for deformable bodies. Computer-Aided Design
34, 12 (2002), 913–928.
J. Jansson and J. S. M. Vergeest. 2003. Combining Deformable- and Rigid-Body Mechanics Simulation. Vis. Comput.
19, 5 (Aug. 2003), 280–290. https://doi.org/10.1007/s00371-002-0187-6
M. Jean. 1999. The non-smooth contact dynamics method. Computer Methods in Applied Mechanics and Engineering
177, 3–4 (July 1999), 235–257. https://doi.org/10.1016/S0045-7825(98)00383-1
M. W. Jones, J. A. Baerentzen, and M. Sramek. 2006. 3D distance fields: A survey of techniques and applications.
IEEE Transactions on visualization and Computer Graphics 12, 4 (2006), 581–599.
F. Jourdan, P. Alart, and M. Jean. 1998. A Gauss-Seidel like algorithm to solve frictional contact problems.
Computer Methods in Applied Mechanics and Engineering 155, 1 (1998), 31 – 47.
J. J. Júdice and F. M. Pires. 1994. A block principal pivoting algorithm for large-scale strictly monotone linear
complementarity problems. Computers & operations research 21, 5 (1994), 587–596.
C. Kane, E. A. Repetto, M. Ortiz, and J. E. Marsden. 1999. Finite element analysis of nonsmooth contact. CMAME
180, 1-2 (1999).

168
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

D. M. Kaufman, S. Sueda, D. L. James, and D. K. Pai. 2008. Staggered Projections for Frictional Contact in Multibody
Systems. ACM Trans. Graph. 27, 5, Article Article 164 (Dec. 2008), 11 pages. https://doi.org/10.1145/1409060.
1409117
T. Kim and D. Eberle. 2020. Dynamic Deformables: Implementation and Production Practicalities. In ACM
SIGGRAPH 2020 Courses (Virtual Event, USA) (SIGGRAPH ’20). ACM, New York, NY, USA, Article 23, 182 pages.
https://doi.org/10.1145/3388769.3407490
Y. J. Kim, M. A. Otaduy, M. C. Lin, and D. Manocha. 2002. Fast Penetration Depth Computation for Physically-
Based Animation. In Proc. of the 2002 ACM SIGGRAPH/Eurographics Symposium on Computer Animation (San
Antonio, Texas) (SCA ’02). ACM, New York, NY, USA, 23–31. https://doi.org/10.1145/545261.545266
D. Koschier, C. Deul, and J. Bender. 2016. Hierarchical <i>Hp</i>-Adaptive Signed Distance Fields. In Proc. of
the 2016 ACM SIGGRAPH/Eurographics Symposium on Computer Animation (Zurich, Switzerland) (SCA ’16).
Eurographics Association, Goslar, DEU, 189–198.
C. Lacoursiere and M. Linde. 2011. Spook: a variational time-stepping scheme for rigid multibody systems subject to
dry frictional contacts. Technical Report. HPC2N and Department of Computer Science, Umeaa University,
Sweeden.
L. Lan, D. M. Kaufman, M. Li, C. Jiang, and Y. Yang. 2022. Affine Body Dynamics: Fast, Stable & Intersection-free
Simulation of Stiff Materials. ACM Trans. Graph. (SIGGRAPH) 41, 4, Article 67 (2022).
L. Lan, Y. Yang, D. Kaufman, J. Yao, M. Li, and C. Jiang. 2021. Medial IPC: Accelerated Incremental Potential
Contact with Medial Elastics. ACM Trans. Graph. (SIGGRAPH) 40, 4, Article 158 (July 2021), 16 pages.
R. I. Leine and C. Glocker. 2003. A set-valued force law for spatial coulomb-contensou friction. European Journal
of Mechanics - A/Solids 22, 2 (2003), 193–216. https://doi.org/10.1016/S0997-7538(03)00025-1
M. Li, Z. Ferguson, T. Schneider, T. Langlois, D. Zorin, D. Panozzo, C. Jiang, and D. M. Kaufman. 2020. Incremental
Potential Contact: Intersection- and Inversion-free Large Deformation Dynamics. ACM Trans. Graph.
(SIGGRAPH) 39, 4 (2020).
M. Li, D. M. Kaufman, and C. Jiang. 2021. Codimensional Incremental Potential Contact. ACM Trans. Graph.
(SIGGRAPH) 40, 4, Article 170 (July 2021), 24 pages.
X. Li, Y. Fang, M. Li, and C. Jiang. 2022a. BFEMP: Interpenetration-free MPM–FEM coupling with barrier contact.
Computer Methods in Applied Mechanics and Engineering 390 (2022), 114350.
X. Li, M. Li, and C. Jiang. 2022b. Energetically Consistent Inelasticity for Optimization Time Integration. ACM
Trans. Graph. (SIGGRAPH) 41, 4, Article 52 (2022).
J. Lloyd. 2005. Fast Implementation of Lemke’s Algorithm for Rigid Body Contact Simulation. In ICRA ’05:
Proc. of the 2005 IEEE Intl. Conference on Robotics and Automation. IEEE, Barcelona, Spain, 4538–4543. https:
//doi.org/10.1109/ROBOT.2005.1570819
P. Lötstedt. 1984. Numerical Simulation of Time-Dependent Contact and Friction Problems in Rigid Body
Mechanics. SIAM journal on scientific and statistical computing 5, 2 (1984), 370–393.
M. Macklin, K. Erleben, M. Müller, N. Chentanez, S. Jeschke, and Z. Corse. 2020a. Local Optimization for Robust
Signed Distance Field Collision. Proc. of the ACM on Computer Graphics and Interactive Techniques 3, 1 (2020),
1–17.
M. Macklin, K. Erleben, M. Müller, N. Chentanez, S. Jeschke, and T. Y. Kim. 2020b. Primal/Dual Descent Methods for
Dynamics. In Proc. of the 2020 ACM SIGGRAPH/Eurographics Symposium on Computer Animation (Virtual Event,
Canada) (SCA ’20). Eurographics Association, Goslar, DEU, Article 9, 12 pages. https://doi.org/10.1111/cgf.14104
M. Macklin, K. Erleben, M. Müller, N. Chentanez, S. Jeschke, and V. Makoviychuk. 2019. Non-Smooth Newton
Methods for Deformable Multi-Body Dynamics. ACM Trans. Graph. 38, 5, Article Article 140 (Oct. 2019),
20 pages. https://doi.org/10.1145/3338695
H. Mazhar, T. Heyn, D. Negrut, and A. Tasora. 2015. Using Nesterov’s Method to Accelerate Multibody Dynamics
with Friction and Contact. ACM Trans. Graph. 34, 3, Article 32 (May 2015), 14 pages. https://doi.org/10.1145/

169
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

2735627
M. McKenna and D. Zeltzer. 1990. Dynamic simulation of autonomous legged locomotion. In Proc. of the 17th
Annual Conference on Computer Graphics and Interactive Techniques (SIGGRAPH ’90). ACM, Dallas, TX, USA,
29–38. https://doi.org/10.1145/97879.97882
X. Merlhiot. 2007. A robust, efficient and time-stepping compatible collision detection method for non-smooth
contact between rigid bodies of arbitrary shape. In ECCOMAS ’07: Proc. of the 2007 Multibody Dynamics
ECCOMAS Thematic Conference. ECCOMAS, Milano, Italy, 20.
M. Moore and J. Wilhelms. 1988. Collision detection and response for computer animationr3. In Proc. of the 15th
annual conference on Computer graphics and interactive techniques (SIGGRAPH ’88). ACM, New York, NY, USA,
289–298. https://doi.org/10.1145/54852.378528
J. J. Moreau. 1999. Numerical aspects of the sweeping process. Computer Methods in Applied Mechanics and
Engineering 177, 3–4 (July 1999), 329–349.
M. Müller, N. Chentanez, T.-Y. Kim, and M. Macklin. 2015. Air Meshes for Robust Collision Handling. ACM Trans.
Graph. (SIGGRAPH) 34, 4, Article 133 (July 2015).
T. S. Munson, F. Facchinei, M. C. Ferris, A. Fischer, and C. Kanzow. 2001. The Semismooth Algorithm for
Large Scale Complementarity Problems. INFORMS Journal on Computing 13, 4 (2001), 294–311. https:
//doi.org/10.1287/ijoc.13.4.294.9734
K. G. Murty. 1974. Note on a Bard-type scheme for solving the complementarity problem. Opsearch 11, 2-3 (1974),
123–130.
K. G. Murty and F.-T. Yu. 1988. Linear Complementarity, Linear and Nonlinear Programming. Vol. 3. Helderman-
Verlag, Berlin, Germany. 629 pages.
R. Narain, M. Overby, and G. E. Brown. 2016. ADMM ⊇ Projective Dynamics: Fast Simulation of General
Constitutive Models. In Proc. of the 2016 ACM SIGGRAPH/Eurographics Symposium on Computer Animation
(Zurich, Switzerland) (SCA ’16). Eurographics Association, 21–28.
X. Ni, L. V. Kale, and R. Tamstorf. 2015. Scalable Asynchronous Contact Mechanics Using Charm++. In 2015 IEEE
International Parallel and Distributed Processing Symposium. 677–686.
S. M. Niebe. 2014. Rigid Bodies in Contact: and Everything in Between. Ph.D. Dissertation. Department of Computer
Science, Faculty of Science, University of Copenhagen.
J. Nocedal and S. J. Wright. 2006. Numerical optimization. Springer-Verlag, New York. 664 pages. https:
//doi.org/10.1007/978-0-387-40065-5
M. Otaduy, R. Tamstorf, D. Steinemann, and M. Gross. 2009a. Implicit Contact Handling for Deformable Objects.
Comp. Graph. Forum 28 (04 2009).
M. A. Otaduy, R. Tamstorf, D. Steinemann, and M. Gross. 2009b. Implicit Contact Handling for Deformable Objects.
Comp. Graph. Forum (Proc. of Eurographics) 28, 2 (apr 2009). http://www.gmrv.es/Publications/2009/OTSG09
S. Pabst, B. Thomaszewski, and W. Straßer. 2009. Anisotropic Friction for Deformable Surfaces and Solids. In Proc.
of the 2009 ACM SIGGRAPH/Eurographics Symposium on Computer Animation (New Orleans, Louisiana) (SCA
’09). ACM, New York, NY, USA, 149–154. https://doi.org/10.1145/1599470.1599490
N. Parikh and S. Boyd. 2014. Proximal Algorithms. Found. Trends Optim. 1, 3 (Jan. 2014), 127–239.
A. Peiret, S. Andrews, J. Kovecses, P. G. Kry, and M. Teichmann. 2019. Schur Complement-based Substructuring
of Stiff Multibody Systems with Contact. ACM Trans. Graph. 38, 5, Article 150 (2019), 17 pages. https:
//doi.org/10.1145/3355621
M. Poulsen, S. Niebe, and K. Erleben. 2010. Heuristic Convergence Rate Improvements of the Projected Gauss-
Seidel Method for Frictional Contact Problems. In WSCG ’10: In Proc. of the 18th Intl. Conf. in Central Europe on
Computer Graphics, Visualization and Computer Vision. University of West Bohemia, Plzen, Czech Republic,
135–142.

170
Contact and Friction Simulation SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada

S. Redon, A. Kheddar, and S. Coquillart. 2002. Fast Continuous Collision Detection between Rigid Bodies. Computer
Graphics Forum 21 (May 2002).
T. Schneider, J. Dumas, X. Gao, D. Zorin, and D. Panozzo. 2019. Polyfem.
G. Sheng Chen and X. Liu. 2016. Chapter 3 - Friction. In Friction Dynamics, Gang Sheng Chen and Xiandong Liu
(Eds.). Woodhead Publishing, Cambridge, UK, 91–159. https://doi.org/10.1016/B978-0-08-100285-8.00003-1
E. Sifakis and J. Barbic. 2012. FEM Simulation of 3D Deformable Solids: A Practitioner’s Guide to Theory,
Discretization and Model Reduction. In ACM SIGGRAPH 2012 Courses (Los Angeles, California) (SIGGRAPH
’12). ACM, New York, NY, USA, Article 20, 50 pages. https://doi.org/10.1145/2343483.2343501
M. Silcowitz, S. Niebe, and K. Erleben. 2009. Nonsmooth Newton Method for Fischer Function Reformulation of
Contact Force Problems for Interactive Rigid Body Simulation. In Proc. of the 6th Workshop on Virtual Reality
Interaction and Physical Simulation (Karlsruhe, DE) (VRIPHYS ’09). The Eurographics Association, Karlsruhe,
DE, 105–114. https://doi.org/10.2312/PE/vriphys/vriphys09/105-114
M. Silcowitz, S. Niebe, and K. Erleben. 2010a. A nonsmooth nonlinear conjugate gradient method for interactive
contact force problems. The Visual Computer 26, 6 (2010), 893–901. https://doi.org/10.1007/s00371-010-0502-6
M. Silcowitz, S. Niebe, and K. Erleben. 2010b. Projected Gauss-Seidel Subspace Minimization Method for Interactive
Rigid Body Dynamics. In VISIGRAPP ’10: Proc. of the 5th Intl. Conference on Computer Graphics Theory and
Applications. Springer Berlin Heidelberg, Angers, France, 218–229. https://doi.org/10.1007/978-3-642-25382-
9_15
M. Silcowitz-Hansen. 2010. Jinngine: a Physics Engine Written In Java. https://github.com/rzel/jinngine
J. M. Snyder. 1992. Interval Analysis for Computer Graphics. In Proceedings of the 19th Annual Conference on
Computer Graphics and Interactive Techniques (SIGGRAPH ’92). Association for Computing Machinery, New
York, NY, USA, 121–130.
D. E. Stewart and J. C. Trinkle. 1996. An Implicit Time-Stepping Scheme for Rigid Body Dynamics with Inelastic
Collisions and Coulomb Friction. Intl. Journal of Numerical Methods in Engineering 39, 15 (1996), 2673–2691.
C. W. Studer. 2008. Augmented Time-stepping Integration of Non-smooth Dynamical Systems. Ph.D. Dissertation.
ETH Zurich. https://doi.org/10.3929/ethz-a-005556821
I. E. Sutherland and G. W. Hodgman. 1974. Reentrant polygon clipping. Commun. ACM 17, 1 (1974), 32–42.
https://dl.acm.org/doi/10.1145/360767.360802
M. Tang, R. Tong, Z. Wang, and D. Manocha. 2014. Fast and Exact Continuous Collision Detection with Bernstein
Sign Classification. ACM Trans. Graph. 33 (Nov. 2014), 186:1–186:8. Issue 6.
A. Tasora, D. Mangoni, S. Benatti, and R. Garziera. 2021. Solving variational inequalities and cone complementarity
problems in nonsmooth dynamics using the alternating direction method of multipliers. Intl. Journal for
Numerical Methods in Engineering 122, 16 (2021). https://doi.org/10.1002/nme.6693
J. Teran, E. Sifakis, G. Irving, and R. Fedkiw. 2005. Robust Quasistatic Finite Elements and Flesh Simulation.
In Proceedings of the 2005 ACM SIGGRAPH/Eurographics Symposium on Computer Animation (Los Angeles,
California) (SCA ’05). Association for Computing Machinery, New York, NY, USA, 181–190.
D. Terzopoulos, J. Platt, A. Barr, and K. Fleischer. 1987. Elastically Deformable Models. In Proc. of the 14th Annual
Conference on Computer Graphics and Interactive Techniques (SIGGRAPH ’87). Association for Computing
Machinery, New York, NY, USA, 205–214. https://doi.org/10.1145/37401.37427
E. Todorov, T. Erez, and Y. Tassa. 2012. MuJoCo: A physics engine for model-based control. In 2012 IEEE/RSJ
International Conference on Intelligent Robots and Systems. 5026–5033. https://doi.org/10.1109/IROS.2012.
6386109
G. Van Den Bergen. 2003. Collision detection in interactive 3D environments. CRC Press, San Francisco, USA. 277
pages.
M. Verschoor and A. C. Jalba. 2019. Efficient and accurate collision response for elastically deformable models.
ACM Trans. Graph. 38, 2 (2019), 1–20.

171
SIGGRAPH ’22 Courses, August 07-11, 2022, Vancouver, BC, Canada Andrews, Erleben, and Ferguson

B. Wang, Z. Ferguson, X. Jiang, M. Attene, D. Panozzo, and T. Schneider. 2022. Fast and Exact Root Parity for
Continuous Collision Detection. Computer Graphics Forum (Proceedings of Eurographics) 41, 2 (2022), 9.
B. Wang, Z. Ferguson, T. Schneider, X. Jiang, M. Attene, and D. Panozzo. 2021. A Large-Scale Benchmark and
an Inclusion-Based Algorithm for Continuous Collision Detection. ACM Trans. Graph. 40, 5, Article 188 (sep
2021), 16 pages.
H. Wang. 2015. A Chebyshev Semi-iterative Approach for Accelerating Projective and Position-based Dynamics.
ACM Trans. Graph. 34, 6 (Oct. 2015), 246:1–246:9.
H. Xu and J. Barbič. 2014. Signed distance fields for polygon soup meshes. In Proc. of the 40th Graphics Interface
Conference (GI ’14). Canadian Information Processing Society, Montreal, Canada, 35–41. https://dl.acm.org/
doi/pdf/10.5555/2619648.2619655
H. Xu, Y. Zhao, and J. Barbič. 2014. Implicit Multibody Penalty-based Distributed Contact. IEEE Transactions on
Visualization and Computer Graphics 20, 9 (Sep. 2014), 1266–1279. https://doi.org/10.1109/TVCG.2014.2312013
Y. Zhao, J. Choo, Y. Jiang, M. Li, C. Jiang, and K. Soga. 2022. A barrier method for frictional contact on embedded
interfaces. Computer Methods in Applied Mechanics and Engineering 393 (2022), 114820.

172

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy