0% found this document useful (0 votes)
9 views10 pages

Position Based Dynamics: Matthias Mu Ller, Bruno Heidelberger, Marcus Hennix, John Ratcliff

Uploaded by

xyang337
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)
9 views10 pages

Position Based Dynamics: Matthias Mu Ller, Bruno Heidelberger, Marcus Hennix, John Ratcliff

Uploaded by

xyang337
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/ 10

J. Vis. Commun. Image R.

18 (2007) 109–118
www.elsevier.com/locate/jvci

q
Position based dynamics
a,*
Matthias Müller , Bruno Heidelberger a, Marcus Hennix a, John Ratcliff b

a
AGEIA Technologies, Technoparkstrasse 1, 8005 Zürich, Switzerland
b
AGEIA Technologies, 4041 Forest Park Avenue, St. Louis, MO 63108, USA

Received 8 January 2007; accepted 9 January 2007


Available online 12 February 2007

Abstract

The most popular approaches for the simulation of dynamic systems in computer graphics are force based. Internal and external
forces are accumulated from which accelerations are computed based on Newton’s second law of motion. A time integration method
is then used to update the velocities and finally the positions of the object. A few simulation methods (most rigid body simulators)
use impulse based dynamics and directly manipulate velocities. In this paper we present an approach which omits the velocity layer
as well and immediately works on the positions. The main advantage of a position based approach is its controllability. Overshooting
problems of explicit integration schemes in force based systems can be avoided. In addition, collision constraints can be handled easily
and penetrations can be resolved completely by projecting points to valid locations. We have used the approach to build a real time cloth
simulator which is part of a physics software library for games. This application demonstrates the strengths and benefits of the method.
 2007 Elsevier Inc. All rights reserved.

Keywords: Physically based simulation; Game physics; Integration schemes; Cloth simulation

1. Introduction step, internal and external forces are accumulated. Exam-


ples of internal forces are elastic forces in deformable
Research in the field of physically based animation in objects or viscosity and pressure forces in fluids. Gravity
computer graphics is concerned with finding new methods and collision forces are examples of external forces. New-
for the simulation of physical phenomena such as the ton’s second law of motion relates forces to accelerations
dynamics of rigid bodies, deformable objects or fluid flow. via the mass. So using the density or lumped masses of ver-
In contrast to computational sciences where the main focus tices, the forces are transformed into accelerations. Any
is on accuracy, the main issues here are stability, robustness time integration scheme can then be used to first compute
and speed while the results should remain visually plausi- the velocities from the accelerations and then the positions
ble. Therefore, existing methods from computational sci- from the velocities. Some approaches use impulses instead
ences can not be adopted one to one. In fact, the main of forces to control the animation. Because impulses
justification for doing research on physically based simula- directly change velocities, one level of integration can be
tion in computer graphics is to come up with specialized skipped.
methods, tailored to the particular needs in the field. The In computer graphics and especially in computer games
method we present falls into this category. it is often desirable to have direct control over positions of
The traditional approach to simulating dynamic objects objects or vertices of a mesh. The user might want to attach
has been to work with forces. At the beginning of each time a vertex to a kinematic object or make sure the vertex
always stays outside a colliding object. The method we pro-
q
pose here works directly on positions which makes such
Reprinted with permission from Proc. Virtual Reality Interactions and
manipulations easy. In addition, with the position based
Physical Simulations, Vriphys, Madrid, Spain, pp. 71–80, Nov. 6–7, 2006.
*
Corresponding author. Fax: +41 44 445 2147. approach it is possible to control the integration directly
E-mail address: mmueller@ageia.com (M. Müller). thereby avoiding overshooting and energy gain problems

1047-3203/$ - see front matter  2007 Elsevier Inc. All rights reserved.
doi:10.1016/j.jvcir.2007.01.005
110 M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118

in connection with explicit integration. So the main fea- Müller et al. ([2]) simulate deformable objects by
tures and advantages of position based dynamics are moving points towards certain goal positions which are
found by matching the rest state to the current state of
• Position based simulation gives control over explicit the object. Their integration method is the closest to
integration and removes the typical instability problems. the one we propose here. They only treat one specialized
• Positions of vertices and parts of objects can directly be global constraint and, therefore, do not need a position
manipulated during the simulation. solver.
• The formulation we propose allows the handling of gen- Fedor ([9]) uses Jakobsen’s approach to simulate char-
eral constraints in the position based setting. acters in games. His method is tuned to the particular prob-
• The explicit position based solver is easy to understand lem of simulating human characters. He uses several
and implement. skeletal representations and keeps them in sync via
projections.
Faure ([10]) uses a Verlet integration scheme by modify-
2. Related work ing the positions rather than the velocities. New positions
are computed by linearizing the constraints while we work
The recent state of the art report ([1]) gives a good with the non linear constraint functions directly.
overview of the methods used in computer graphics to We define general constraints via a constraint function
simulate deformable objects, e.g. mass-spring systems, as ([11]) and ([12]). Instead of computing forces as the
the finite element method or finite difference approaches. derivative of a constraint function energy, we directly solve
Apart from the citation of ([2]), position based dynamics for the equilibrium configuration and project positions.
does not appear in this survey. However, parts of the posi- With our method we derive a bending term for cloth which
tion based approach have appeared in various papers is similar to the one proposed in ([13]) and ([14]) but
without naming it explicitly and without defining a com- adopted to the point based approach.
plete framework. In Section 4 we use the position based dynamics
Jakobsen ([3]) built his Fysix engine on a position approach for the simulation of cloth. Cloth simulation
based approach. His central idea was to use a Verlet has been an active research field in computer graphics in
integrator and manipulate positions directly. Because recent years. Instead of citing the key papers of the field
velocities are implicitly stored by current and the previ- individually we refer the reader to ([1]) for a comprehensive
ous positions, the velocities are implicitly updated by survey.
the position manipulation. While he focused mainly on
distance constraints, he only gave vague hints on how 3. Position based simulation
more general constraints could be handled. In this paper
we present a fully general approach which handles In this section we will formulate the general position
general constraints. We also focus on the important issue based approach. With cloth simulation, we will give a par-
of conservation of linear and angular momenta by posi- ticular application of the method in the subsequent and in
tion projection. We work with explicit velocities instead the results section. We consider a three dimensional world.
of storing previous positions which makes damping and However, the approach works equally well in two
friction simulation much easier. dimensions.
Desbrun ([4]) and Provot ([5]) use constraint projection
in mass spring systems to prevent springs from overstret- 3.1. Algorithm overview
ching. In contrast to a full position based approach, projec-
tion is only used as a polishing process for those springs We represent a dynamic object by a set of N vertices and
that are stretched too much and not as the basic simulation M constraints. A vertex i 2 [1, . . . , N] has a mass mi, a posi-
method. tion xi and a velocity vi.
Bridson et al. use a traditional force based approach A constraint j 2 [1, . . . , M] consists of
for cloth simulation ([6]) and combine it with a geomet-
ric collision resolving algorithm based on positions to • a cardinality nj,
make sure that the collision resolving impulses are kept • a function C j : R3nj ! R,
within stable bounds. The same holds for the kinemati- • a set of indices fi1 ; . . . inj g, ik 2 [1, . . . N],
cal collision correction step proposed by Volino et al. • a stiffness parameter kj 2 [0 . . . 1] and
([7]). • a type of either equality or inequality.
A position based approach has been used by Clavet
et al. ([8]) to simulate viscoelastic fluids. Their approach Constraint j with type equality is satisfied if
is not fully position based because the time step appears C j ðxi1 ; . . . ; xinj Þ ¼ 0. If its type is inequality then it is satis-
in various places of their position projections. Thus, the fied if C j ðxi1 ; . . . ; xinj Þ P 0. The stiffness parameter kj
integration is only conditionally stable as regular explicit defines the strength of the constraint in a range from zero
integration. to one.
M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118 111

Based on this data and a time step Dt, the dynamic the vertices to a physically valid configuration pi computed
object is simulated as follows: by the constraint solver. The only possible source for insta-
bilities is the solver itself which uses the Newton-Raphson
(1) forall vertices i method to solve for valid positions (see Section 3.3). How-
(2) initialize xi ¼ x0i , vi ¼ v0i , wi = 1/mi ever, its stability does not depend on the time step size but
(3) endfor on the shape of the constraint functions.
(4) loop The integration does not fall clearly into the category of
(5) forall vertices i do vi ‹ vi + Dtwifext(xi) implicit or explicit schemes. If only one solver iteration is
(6) dampVelocities(v1, . . . , vN) performed per time step, it looks more like an explicit
(7) forall vertices i do pi ‹ xi + Dtvi scheme. By increasing the number of iterations, however,
(8) forall vertices i do a constrained system can be made arbitrarily stiff and the
generateCollisionConstraints(xi fi pi) algorithm behaves more like an implicit scheme. Increasing
(9) loop solverIterations times the number of iterations shifts the bottleneck from collision
(10) projectConstraints(C 1 ; . . . ; C MþM coll ; p1 ; . . . ; pN ) detection to the solver.
(11) endloop
(12) forall vertices i 3.2. The solver
(13) vi ‹ (pi  xi)/Dt
(14) xi ‹ p i The input to the solver are the M + Mcoll constraints
(15) endfor and the estimates p1, . . . , pN for the new locations of the
(16) velocityUpdate(v1, . . . , vN) points. The solver tries to modify the estimates such that
(17) endloop they satisfy all the constraints. The resulting system of
equations is non-linear. Even a simple distance constraint
Lines (1)–(3) just initialize the state variables. The core C(p1, p2) = jp1  p2j  d yields a non-linear equation. In
idea of position based dynamics is shown in lines (7), (9)– addition, the constraints of type inequality yield inequali-
(11) and (13)–(14). In line (7), estimates pi for new locations ties. To solve such a general set of equations and inequal-
of the vertices are computed using an explicit Euler integra- ities, we use a Gauss–Seidel-type iteration. The original
tion step. The iterative solver (9)–(11) manipulates these Gauss–Seidel algorithm (GS) can only handle linear sys-
position estimates such that they satisfy the constraints. tem. The part we borrow from GS is the idea of solving
It does this by repeatedly project each constraint in a each constraint independently one after the other. How-
Gauss–Seidel type fashion (see Section 3.2). In steps (13) ever, in contrast to GS, solving a constraint is a non linear
and (14), the positions of the vertices are moved to the opti- operation. We repeatedly iterate through all the constraints
mized estimates and the velocities are updated accordingly. and project the particles to valid locations with respect to
This is in exact correspondence with a Verlet integration the given constraint alone. In contrast to a Jacobi-type iter-
step and a modification of the current position ([3]), ation, modifications to point locations immediately get vis-
because the Verlet method stores the velocity implicitly as ible to the process. This speeds up convergence significantly
the difference between the current and the last position. because pressure waves can propagate through the material
However, working with velocities allows for a more intui- in a single solver step, an effect which is dependent on the
tive way of manipulating them. order in which constraints are solved. In over-constrained
The velocities are manipulated in line (5), (6) and (16). situations, the process can lead to oscillations if the order
Line (5) allows to hook up external forces to the system is not kept constant.
if some of the forces cannot be converted to positional con-
straints. We only use it to add gravity to the system in 3.3. Constraint projection
which case the line becomes vi ‹ vi + Dtg, where g is the
gravitational acceleration. In line (6), the velocities can be Projecting a set of points according to a constraint
damped if this is necessary. In Section 3.5 we show how means moving the points such that they satisfy the con-
to add global damping without influencing the rigid body straint. The most important issue in connection with mov-
modes of the object. Finally, in line (16), the velocities of ing points directly inside a simulation loop is the
colliding vertices are modified according to friction and conservation of linear and angular momentum. Let Dpi
restitution coefficients. be the displacement of vertex i by the projection. Linear
The given constraints C1, . . . , CM are fixed throughout momentum is conserved if
X
the simulation. In addition to these constraints, line (8) mi Dpi ¼ 0; ð1Þ
generates the Mcoll collision constraints which change from i
time step to time step. The projection step in line (10) con-
which amounts to conserving the center of mass. Angular
siders both, the fixed and the collision constraints.
momentum is conserved if
The scheme is unconditionally stable. This is because the X
integration steps (13) and (14) do not extrapolate blindly ri  mi Dpi ¼ 0; ð2Þ
into the future as traditional explicit schemes do but move i
112 M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118

Fig. 1. A known deformation benchmark test, applied here to a cloth character under pressure.

where the ri are the distances of the pi to an arbitrary com- Cðp1 ; . . . ; pn Þ


s¼P 2
ð7Þ
mon rotation center. If a projection violates one of these
j jrpj Cðp1 ; . . . ; pn Þj
constraints, it introduces so called ghost forces which act
like external forces dragging and rotation the object. How- is the same for all points. If the points have individual
ever, only internal constraints need to conserve the masses, we extend the Newton–Raphson process by weight-
momenta. Collision or attachment constraints are allowed ing the corrections proportional to the inverse masses wi = 1/mi
to have global effects on the object. n  wi
The method we propose for constraint projection con- Dpi ¼ s P rpi Cðp1 ; . . . ; pn Þ; ð8Þ
j wj
serves both momenta for internal constraints. Again, the
point based approach is more direct in that we can directly To give an example, let us consider the distance constraint
use the constraint function while force based methods function C(p1,p2) = jp1  p2j  d. The derivative with re-
derive forces via an energy term (see ([11,12])). Let us look spect to the points are rp1 Cðp1 ; p2 Þ ¼ n and
at a constraint with cardinality n on the points p1, . . . , pn rp2 Cðp1 ; p2 Þ ¼ n with n ¼ jpp1 p 2
. The scaling factor s is,
jp1 p2 jd 1 p2 j
with constraint function C and stiffness k. We let p be the thus, s ¼ 1þ1 and the final corrections
T
concatenation ½pT1 ; . . . ; pTn  . For internal constraints, C is w1 p  p2
independent of rigid body modes, i.e. translation and rota- Dp1 ¼  ðjp1  p2 j  dÞ 1 ; ð9Þ
w1 þ w2 jp1  p2 j
tion. This means that rotating or translating the points w2 p  p2
does not change the value of the constraint function. Dp2 ¼ þ ðjp  p2 j  dÞ 1 ; ð10Þ
w1 þ w2 1 jp1  p2 j
Therefore, the gradient $pC is perpendicular to rigid body
modes because it is the direction of maximal change. If the which are the formulas proposed in ([3]) for the projection
correction Dp is chosen to be along $Cp both momenta are of distance constraints (see Fig. 2). They pop up as a spe-
automatically conserved if all masses are equal (we handle cial case of the general constraint projection method.
different masses later). Given p we want to find a correction We have not considered the type and the stiffness k of
Dp such that C(p + Dp) = 0. This equation can be approx- the constraint so far. Type handling is straight forward.
imated by If the type is equality we always perform a projection. If
the type is inequality, the projection is only performed if
Cðp þ DpÞ  CðpÞ þ rp CðpÞ  Dp ¼ 0: ð3Þ C(p1, . . ., pn) < 0. There are several ways of incorporating
Restricting Dp to be in the direction of $pC means choosing the stiffness parameter. The simplest variant is to multiply
a scalar k such that the corrections Dp by k 2 [0 . . . 1]. However, for multiple
iteration loops of the solver, the effect of k is non-linear.
Dp ¼ krp CðpÞ: ð4Þ The remaining error for a single distance constraint after
n
ns solver iterations is Dpð1  kÞ s . To get a linear relation-
Substituting Eq. (4) into Eq. (3), solving for k and substi-
ship we multiply the corrections not by k directly but by
tuting it back into Eq. (4) yields the final formula for Dp 1=n
k 0 ¼ 1  ð1  kÞ s . With this transformation the error
n
CðpÞ becomes Dpð1  k 0 Þ s ¼ Dpð1  kÞ and, thus, becomes line-
Dp ¼  rp CðpÞ; ð5Þ
jrp CðpÞj2 arly dependent on k and independent of ns as desired. How-

which is a regular Newton-Raphson step for the iterative


solution of the non-linear equation given by a single con- Δp2
d m2
straint. For the correction of an individual point pi we have Δp1 p2
m1
Dpi ¼ srpi Cðp1 ; . . . ; pn Þ; ð6Þ p1

where the scaling factor Fig. 2. Projection of the constraint C(p1, p2) = jp1  p2j  d. The correc-
tions Dpi are weighted according to the inverse masses wi = 1/mi.
M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118 113

ever, the resulting material stiffness is still dependent on the 3.5. Damping
time step of the simulation. Real time environments typi-
cally use fixed time steps in which case this dependency is In line (6) of the simulation algorithm the velocities are
not problematic. dampened before they are used for the prediction of the
new positions. Any form of damping can be used and many
3.4. Collision detection and response methods for damping have been proposed in the literature
(see ([1])). Here we propose a new method with some inter-
One advantage of the position based approach is how esting properties:
simply collision response can be realized. In line (8) of the P  P 
simulation algorithm the Mcoll collision constraints are gen- (1) xcm ¼ P i xi mi =P i mi
erated. While the first M constraints given by the object rep- (2) vcm ¼P i vi mi = i mi
resentation are fixed throughout the simulation, the (3) L =P iri · (mivi)
additional Mcoll constraints are generated from scratch at (4) I ¼ i~ri~rTi mi
each time step. The number of collision constraints Mcoll (5) x = I1L
varies and depends on the number of colliding vertices. (6) forall vertices i
Both, continuous and static collisions can be handled. For (7) Dvi = vcm + x · ri  vi
continuous collision handling, we test for each vertex i the (8) vi ‹ vi + kdamping Dvi
ray xi fi pi. If this ray enters an object, we compute the entry (9) endfor
point qc and the surface normal nc at this position. An
inequality constraint with constraint function C(p) = Here ri = xi  xcm, ~ri is the 3 by 3 matrix with the prop-
(p  qc) Æ nc and stiffness k = 1 is added to the list of con- erty ~ri v ¼ ri  v, and kdamping 2 [0 . . . 1] is the damping
straints. If the ray xi fi pi lies completely inside an object, coefficient. In lines (1)–(5) we compute the global linear
continuous collision detection has failed at some point. In velocity xcm and angular velocity x of the system. Lines
this case we fall back to static collision handling. We com- (6)–z(9) then only damp the individual deviations Dvi of
pute the surface point qs which is closest to pi and the surface the velocities vi from the global motion vcm + x · ri. Thus,
normal ns at this position. An inequality constraint with con- in the extreme case kdamping = 1, only the global motion
straint function C(p) = (p  qs) Æ ns and stiffness k = 1 is survives and the set of vertices behaves like a rigid body.
added to the list of constraints. Collision constraint genera- For arbitrary values of kdamping, the velocities are globally
tion is done outside of the solver loop. This makes the sim- dampened but without influencing the global motion of the
ulation much faster. There are certain scenarios, however, vertices.
where collisions can be missed if the solver works with a fixed
collision constraint set. Fortunately, according to our 3.6. Attachments
experience, the artifacts are negligible.
Friction and restitution can be handled by manipulating With the position based approach, attaching vertices to
the velocities of colliding vertices in step (16) of the algo- static or kinematic objects is quite simple. The position of
rithm. The velocity of each vertex for which a collision con- the vertex is simply set to the static target position or
straint has been generated is dampened perpendicular to updated at every time step to coincide with the position
the collision normal and reflected in the direction of the of the kinematic object. To make sure other constraints
collision normal. containing this vertex do not move it, its inverse mass wi
The collision handling discussed above is only correct is set to zero.
for collisions with static objects because no impulse is
transferred to the collision partners. Correct response for 4. Cloth simulation
two dynamic colliding objects can be achieved by simulat-
ing both objects with our simulator, i.e. the N vertices and We have used the point based dynamics framework to
M constraints which are the input to our algorithm simply implement a real time cloth simulator for games. In this
represent two or more independent objects. Then, if a point section we will discuss cloth specific issues thereby giving
q of one objects moves through a triangle p1, p2, p3 of concrete examples of the general concepts introduced in
another object, we insert an inequality constraint with con- the previous section.
straint function C(q, p1, p2, p3) = ±(q  p1) Æ [(p2  p1) ·
(p3  p1)] which keeps the point q on the correct side of 4.1. Representation of cloth
the triangle. Since this constraint function is independent
of rigid body modes, it will correctly conserve linear and Our cloth simulator accepts as input arbitrary triangle
angular momentum. Collision detection gets slightly more meshes. The only restriction we impose on the input mesh
involved because the four vertices are represented by rays is that it represents a manifold, i.e. each edge is shared by at
xi fi pi. Therefore the collision of a moving point against most two triangles. Each node of the mesh becomes a sim-
a moving triangle needs to be detected (see section about ulated vertex. The user provides a density q given in mass
cloth self collision). per area [kg/m2]. The mass of a vertex is set to the sum
114 M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118

of one third of the mass of each adjacent triangle. For each p2 n1


edge, we generate a stretching constraint with constraint n1
function p1,2
ϕ
p4
C stretch ðp1 ; p2 Þ ¼ jp1  p2 j  l0 ; p3 p1
p3 n2 p4
stiffness kstretch and type equality. The scalar l0 is the initial n2
length of the edge and kstretch is a global parameter pro-
vided by the user. It defines the stretching stiffness of the Fig. 4. For bending resistance, the constraint function C(p1, p2, p3,
p4) = arccos(n1 Æ n2)  u0 is used. The actual dihedral angle u is measure as
cloth. For each pair of adjacent triangles (p1, p3, p2) and the angle between the normals of the two triangles.
(p1, p2, p4) we generate a bending constraint with constraint
function
corners of rigid bodies against the cloth triangles are also
C bend ðp1 ;p2 ;p3 ;p4 Þ tested.
 
ðp2 p1 Þðp3 p1 Þ ðp2 p1 Þðp4 p1 Þ
¼ arccos  u0 ;
jðp2 p1 Þðp3 p1 Þj jðp2 p1 Þðp4 p1 Þj 4.3. Self collision
stiffness kbend and type equality. The scalar u0 is the initial
dihedral angle between the two triangles and kbend is a glo- Assuming that the triangles all have about the same size,
bal user parameter defining the bending stiffness of the we use spatial hashing to find vertex triangle collisions
cloth (see Fig. 4). The advantage of this bending term over ([15]). If a vertex q moves through a triangle p1, p2, p3,
adding a distance constraint between points p3 and p4 or we use the constraint function
over the bending term proposed by ([13]) is that it is inde- ðp2  p1 Þ  ðp3  p1 Þ
pendent of stretching. This is because the term is indepen- Cðq;p1 ;p2 ;p3 Þ ¼ ðq  p1 Þ   h; ð11Þ
jðp2  p1 Þ  ðp3  p1 Þj
dent of edge lengths. This way, the user can specify cloth
with low stretching stiffness but high bending resistance where h is the cloth thickness (see Fig. 5). If the vertex en-
for instance (see Fig. 3). ters from below with respect to the triangle normal, the
Eqs. (9) and (10) define the projection for the stretching constraint function has to be
constraints. In the Appendix B we derive the formulas to
ðp3  p1 Þ  ðp2  p1 Þ
project the bending constraints. Cðq; p1 ; p2 ; p3 Þ ¼ ðq  p1 Þ  h ð12Þ
jðp3  p1 Þ  ðp2  p1 Þj

4.2. Collision with rigid bodies


p2 n
n
For collision handling with rigid bodies we proceed as q
described in Section 3.4. To get two-way interactions, we
q
apply an impulse miDpi/Dt to the rigid body at the con- p1
h
p1
p3
tact point, each time vertex i is projected due to collision p2
p3
with that body. Testing only cloth vertices for collisions is
not enough because small rigid bodies can fall through Fig. 5. Constraint function C(q, p1, p2, p3) = (q  p1) Æ n  h makes sure
large cloth triangles. Therefore, collisions of the convex that q stays above the triangle p1, p2, p3 by the the cloth thickness h.

Fig. 3. With the bending term we propose, bending and stretching are independent parameters. The top row shows ðk stretching ; k bending Þ ¼ ð1; 1Þ; ð12 ; 1Þ and
1
ð100 ; 1Þ. The bottom row shows ðk stretching ; k bending Þ ¼ ð1; 0Þ; ð12 ; 0Þ and ð100
1
; 0Þ.
M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118 115

experiments have been carried out to analyze the character-


istics and the performance of the proposed method. All test
scenarios presented in this section have been performed on
a PC Pentium 4, 3 GHz.

5.1. Independent bending and stretching

Our bending term only depends on the dihedral angle of


Fig. 6. This folded configuration demonstrates stable self collision and adjacent triangles, not on edge lengths, so bending and
response. stretching resistances can be chosen independently. Fig. 3
shows a cloth bag with various stretching stiffnesses, first
with bending resistance enabled and then disabled. As the
to keep the vertex on the original side. Projecting these con-
top row shows, bending does not influence stretching
straints conserves linear and angular momentum which is
resistance.
essential for cloth self collision since it is an internal pro-
cess. Fig. 6 shows a rest state of a piece of cloth with self
collisions. Testing continuous collisions is insufficient if 5.2. Attachments with two way interaction
cloth gets into a tangled state, so methods like the ones
proposed by ([16]) have to be applied. We can simulate both, one way and two way coupled
attachment constraints. The cloth stripes in Fig. 8 are
4.4. Cloth balloons attached via one way constraints to the static rigid bodies
at the top. In addition, two way interaction is enabled
For closed triangle meshes, overpressure inside the mesh between the stripes and the bottom rigid bodies. This con-
can easily be modeled (see Fig. 7). We add an equality con- figuration results in realistically looking swing and twist
straint concerning all N vertices of the mesh with constraint motions of the stripes. The scene features 6 rigid bodies
function and 3 pieces of cloth which are simulated and rendered
! with more than 380 fps.
ntriangles
X
Cðp1 ; . . . ; pN Þ ¼ ðpti  pti Þ  pti  k pressure V 0 ð13Þ
i¼1
1 2 3 5.3. Real time self collision

and stiffness k = 1 to the set of constraints. Here ti1 , ti2 and The piece of cloth shown in Fig. 6 is composed of 1364
ti3 are the three indices of the vertices belonging to triangle vertices and 2562 triangles. The simulation runs at 30 fps
i. The sum computes the actual volume of the closed mesh. on average including self collision detection, collision han-
It is compared against the original volume V0 times the dling and rendering. The effect of friction is shown in
overpressure factor kpressure. This constraint function yields Fig. 9, where the same piece of cloth is tumbling in a rotat-
the gradients ing barrel.
X X X
rpi C ¼ ðptj  ptj Þ þ ðptj  ptj Þ þ ðptj  ptj Þ: ð14Þ
2 3 3 1 1 2
j:t1j ¼i j:t2j ¼i j:t3j ¼i 5.4. Tearing and stability

These gradients have to be scaled by the scaling factor gi- Fig. 10 shows a piece of cloth consisting of 4264 vertices
ven in Eq. (7) and weighted by the masses according to and 8262 triangles that is torn open by an attached cube
Eq. (8) to get the final projection offsets Dpi. and finally ripped apart by a thrown ball. This scene is sim-
ulated and rendered with 47 fps on average. Tearing is sim-
5. Results ulated by a simple process: whenever the stretching of an
edge exceeds a specified threshold value, we select one of
We have integrated our method into Rocket ([17]), a the edge’s adjacent vertices. We then put a split plane
game-like environment for physics simulation. Various through that vertex perpendicular to the edge direction

Fig. 7. Simulation of overpressure inside a character.


116 M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118

Fig. 8. Cloth stripes are attached via one way interaction to static rigid bodies at the top and via two way constraints to rigid bodies at the bottom.

Fig. 9. Influenced by collision, self collision and friction, a piece of cloth tumbles in a rotating barrel.

Fig. 10. A piece of cloth is torn open by an attached cube and ripped apart by a thrown ball.

Fig. 11. Three inflated characters experience multiple collisions and self collisions.

and split the vertex. All triangles above the split plane are 5.5. Complex simulation scenarios
assigned to the original vertex while all triangles below are
assigned to the duplicate. Our method remains stable even The presented method is especially suited for complex
in extreme situations as shown in Fig. 1, a scene inspired by simulation environments (see Fig. 12). Despite the exten-
([18]). An inflated character model is squeezed through sive interaction with animated characters and geometrically
rotating gears resulting in multiple constraints, collisions complex game levels, simulation and rendering of multiple
and self collisions acting on single cloth vertices (Fig. 11). pieces of cloth can still be done at interactive speed.
M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118 117

Fig. 12. Extensive interaction between pieces of cloth and an animated game character (left), a geometrically complex game level (middle) and hundreds of
simulated plant leaves (right).

2 on onx onx
3
6. Conclusions op1x
x
op1y op1z
on 6 7
6 on ony ony 7
We have presented a position based dynamics frame- ¼ 6 op1xy op1y op1z 7 ðA:1Þ
op1 4 5
work that can handle general constraints formulated via onz onz onz
op1x op1y op1z
constraint functions. With the position based approach it 02 3 1
is possible to manipulate objects directly during the simula- 0 p2z p2y
1 B6 p
tion. This significantly simplifies the handling of collisions, ¼ @4 2z 0 p2x 7 TC
5 þ nðn  p2 Þ A: ðA:2Þ
jp1  p2 j
attachment constraints and explicit integration and it p2y p2x 0
makes direct and immediate control of the animated scene
possible.
We have implemented a robust cloth simulator on top of Shorter and for both arguments we have
this framework which provides features like two way inter-
action of cloth with rigid bodies, cloth self collision and on 1 TÞ
response and attachments of pieces of cloth to dynamic ¼ ðp~2 þ nðn  p2 Þ ; ðA:3Þ
op1 jp1  p2 j
rigid bodies.

on 1
¼ ðp~1 þ nðn  p1 ÞTÞ ; ðA:4Þ
7. Future work op2 jp1  p2 j

A topic we have not treated in this paper is rigid body where ~p is the matrix with the property ~px ¼ p  x.
simulation. However, the approach we presented could
quite easily be extended to handle rigid objects as well.
Instead of computing a set of linear and angular impulses
for the resolution of collisions as regular rigid body solvers Appendix B. Bending constraint projection
typically do, movements and rotations would be applied to
the bodies at the contact points and the linear and angular The constraint function for bending is C =
velocities would have to be adjusted accordingly after the arccos(d)  u0, where d ¼ n1  n2 ¼ nT1 n2 . Without loss of
solver has completed. generality we set p1 = 0 and get for the normals
n1 ¼ jpp2 p 3
and n2 ¼ jpp2 p 4
. With dxd arccosðxÞ ¼  pffiffiffiffiffiffiffi
1
we
2 p3 j 2 p4 j 1x2
get the following gradients:
Acknowledgment
 T !
The authors thank our employer AGEIA for making the 1 on1
research and development on this topic possible. rp3 C ¼  pffiffiffiffiffiffiffiffiffiffiffiffiffi2 n2 ; ðA:6Þ
1d op3
 T !
1 on2
rp4 C ¼  pffiffiffiffiffiffiffiffiffiffiffiffiffi2 n1 ; ðA:7Þ
Appendix A. Gradient of the normalized cross product 1d op4
 T  T !
1 on1 on2
Constraint functions often contain normalized cross rp2 C ¼  pffiffiffiffiffiffiffiffiffiffiffiffiffi2 n2 þ n1 ; ðA:8Þ
products. To derive the projection corrections, the gradient 1d op 2 op2
of the constraint function is needed. Therefore it is useful rp1 C ¼ rp2 C  rp3 C  rp4 C: ðA:9Þ
to know the gradient of a normalized cross product with
respect to both arguments. Given the normalized cross
product n ¼ jpp1 p2
, the derivative with respect to the first Using the gradients of normalized cross products, first
1 p2 j
vector is compute
118 M. Müller et al. / J. Vis. Commun. Image R. 18 (2007) 109–118

p2  n2 þ ðn1  p2 Þd [7] P. Volino, M. Courchesne, N. Magnenat-Thalmann, Versatile and


q3 ¼ ; ðA:10Þ efficient techniques for simulating cloth and other deformable objects,
jp2  p3 j
Proceedings of ACM Siggraph (1995) 137–144.
p  n1 þ ðn2  p2 Þd [8] S. Clavet, P. Beaudoin, P. Poulin, Particle-based viscoelastic fluid
q4 ¼ 2 ; ðA:11Þ
jp2  p4 j simulation, Proceedings of the ACM SIGGRAPH Symposium on
Computer Animation (2005) 219–228.
p  n2 þ ðn1  p3 Þd p4  n1 þ ðn2  p4 Þd
q2 ¼  3  ; ðA:12Þ [9] M. Fedor, Fast character animation using particle dynamics, in:
jp2  p3 j jp2  p4 j Proceedings of International Conference on Graphics, Vision and
Image Processing, GVIP05.
q1 ¼ q2  q3  q4 : ðA:13Þ
[10] F. Faure, Interactive solid animation using linearized displacement
Then the final correction is constraints, in: Eurographics Workshop on Computer Animation and
pffiffiffiffiffiffiffiffiffiffiffiffiffi Simulation (EGCAS) (1998) 61–72.
4wi 1  d 2 ðarccosðdÞ  u0 Þ [11] D. Baraff, A. Witkin, Large steps in cloth simulation, Proceedings of
Dpi ¼  P P 2
qi : ðA:14Þ ACM Siggraph (1998) 43–54.
j wj j jqj j [12] M. Teschner, B. Heidelberger, M. Müller, M. Gross, A versatile
and robust model for geometrically complex deformable solids,
Proceedings of Computer Graphics International (CGI) (2004)
References 312–319.
[13] E. Grinspun, A. Hirani, M. Desbrun, P. Schroder, Discrete shells, in:
[1] A. Nealen, M. Müller, R. Keiser, E. Boxerman, M. Carlson, Proceedings of the ACM SIGGRAPH Symposium on Computer
Physically based deformable models in computer graphics, Euro- Animation, 2003.
graphics 2005 state of the art report. [14] R. Bridson, S. Marino, R. Fedkiw, Simulation of clothing with folds
[2] M. Müller, B. Heidelberger, M. Tescher, M. Gross, Meshless and wrinkles, in: Proceedings of the ACM SIGGRAPH Symposium
deformations based on shape matching, Proceedings of ACM on Computer Animation (2003) 28–36.
Siggraph (2005) 471–478. [15] M. Teschner, B. Heidelberger, M. Müller, D. Pomeranerts, M. Gross,
[3] T. Jakobsen, Advanced character physics the fysix engine, Optimized spatial hashing for collision detection of deformable
www.gamasutra.com. objects, Proceedings of Vision, Modeling, Visualization VMV 2003
[4] M. Desbrun, P. Schröder, A. Barr, Interactive animation of (2003) 47–54.
structured deformable objects, in: Proceedings of Graphics Interface’ [16] D. Baraff, A.Witkin, M. Kass, Untangling cloth, in: Proceedings of
99 (1999) 1–8. the ACM SIGGRAPH (2003) 862–870.
[5] X. Provot, Deformation constraints in a mass-spring model to [17] J. Ratcliff, Rocket - a viewer for real-time phyics simulations,
describe rigid cloth behavior, Proceedings of Graphics Interface www.physicstools.org.
(1995) 147–154. [18] G. Irving, J. Teran, R. Fedkiw, Invertible finite elements for robust
[6] R. Bridson, R. Fedkiw, J. Anderson, Robust treatment of collisions, simulation of large deformation, in: Proceedings of the ACM
contact and friction for cloth animation, Proceedings of ACM SIGGRAPH Symposium on Computer Animation (2004)
Siggraph (2002) 594–603. 131–140.

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