Lecture 22: Spring and Mass Systems

CS-184: Computer Graphics
Lecture #22: Spring and Mass systems
Prof. James O’Brien
University of California, Berkeley
V2009-F-22-1.0
Today
• Spring
and Mass systems
Distance springs
Spring dampers
• Edge springs
•
•
2
Tuesday, November 24, 2009
A Simple Spring
• Ideal
zero-length spring
f a→b = ks(b − a)
• Force
pulls points together
• Strength
f b→a = −f a→b
proportional to distance
3
A Simple Spring
• Energy
potential
E = 1/2 ks(b − a) · (b − a)
2
1
0
-1
-2
8
f a→b = ks(b − a)
6
f b→a = −f a→b
4
2
0
-2
-1
0
1
2
�
∂E ∂E ∂E
f a = −∇aE = −
,
,
∂ax ∂ay ∂az
�
4
Tuesday, November 24, 2009
A Simple Spring
• Energy
potential: kinetic vs elastic
1
E = 1/2 ks(b − a) · (b − a)
0.5
-6
-4
-2
2
4
6
E = 1/2 m(ḃ − ȧ) · (ḃ − ȧ)
-0.5
-1
5
Non-Zero Length Springs
f a→b = ks
b−a
(||b − a|| − l)
||b − a||
Rest length
2
1
0
-1
-2
3
E = ks (||b − a|| − l)2
2
1
0
-2
-1
0
1
2
6
Tuesday, November 24, 2009
Comments on Springs
• Springs
with zero rest length are linear
• Springs
with non-zero rest length are nonliner
Force magnitude linear w/ discplacement (from rest length)
Force direction is non-linear
• Singularity at
•
•
||b − a|| = 0
7
Damping
• “Mass
proportional” damping
f
ȧ
f = −kdȧ
Behaves like viscous drag on all motion
• Consider a pair of masses connected by a spring
• How to model rusty vs oiled spring
• Should internal damping slow group motion of the pair?
• Can help stability... up to a point
•
8
Tuesday, November 24, 2009
Damping
• “Stiffness
proportional” damping
f a = −kd
•
•
b−a
||b − a||2
(b − a) · (ḃ − ȧ)
Behaves viscous drag on change in spring length
Consider a pair of masses connected by a spring
• How to model rusty vs oiled spring
• Should internal damping slow group motion of the pair?
9
Spring Constants
• Two
ways to model a single spring
l/2
l
l/2
∆l
∆l/2
∆l/2
10
Tuesday, November 24, 2009
Spring Constants
• Constant
ks gives inconsistent results with different
discretizations
• Change
in length is not what we want to measure
• Strain: change
in length as fraction of original length
�=
∆l
l0
Nice and simple for 1D...
11
Structures from Springs
• Sheets
• Blocks
• Others
12
Tuesday, November 24, 2009
Structures from Springs
• They
behave like what they are (obviously!)
This structure will not resist
shearing
This structure will not resist outof-plane bending either...
13
Structures from Springs
• They
behave like what they are (obviously!)
This structure will resist shearing
but has anisotopic bias
This structure still will not resist
out-of-plane bending
14
Tuesday, November 24, 2009
Structures from Springs
• They
behave like what they are (obviously!)
This structure will resist shearing
Less bias
Interference between spring sets
This structure still will not resist
out-of-plane bending
15
Structures from Springs
• They
behave like what they are (obviously!)
This structure will resist shearing
Less bias
Interference between spring sets
This structure will resist out-ofplane bending
Interference between spring sets
Odd behavior
How do we set spring constants?
Tuesday, November 24, 2009
16
independent material property, the middle factor scales this
is parallel
to n̂2and
. Fromuthe and
condition
edge,
u4 areaccording
a linear
combination of u1 and
2 is parallel
ge, as in Baraff
and to n̂1 and umon
3
to the anisotropy of the mesh (so
the look of the
of orthogonality to the in-axis stretching of edge 3–4, we
24
cloth
doesn’t
change
remeshing),
u
based
on
the
barycentric
coordinates
of significantly
x1 and xwith
re- and the
. . We label the
see elethat u4 − u3 must be
2 in the span of n̂1 and n̂2 . Orthog2flatwith
sine
factor
measures
how
far
from
the
cloth
is. This is
onality to the rigid body
translations
implies
that
the
sum
spect to the common edge. The
bending
elastic
andthatdamping
s xi and velocities
v,
the simplest
quantity
to compute
smoothly and monou1 + u2 i+ u3 + u4 is zero, and hence u3 + u4 is also in the
increases from
when sharply
forces
be inproportional
totonically
this mode.
Onea minimum
immediate
ob- folded at
of n̂1 and n̂2 , thus
u3 and must
u4 are each
this span. Fiormals n1 and nspan
2.
θ = −π, is zero when flat at θ = 0, and rises to a maximum
nally, after making u orthogonal to rigid rotations (which we
servation is that orthogonality
toother
rigid
body modes implies
at the
sharply
can conveniently choose to be about the axes n̂1 , n̂2 and ê)
! folded state θ = π. We use the formula
sin (θ/2) = ± (1 − n̂1 · n̂2 )/2 where the sign is chosen to
v1 , v2 , v3 , v4 ) and
the
we end
up with
these forces conserve linear and
angular momentum. In fact,
match the sign of sin θ, which is just n̂1 × n̂2 · ê. Naturally
nonlinear models,
including
powers of θ
3 , F4 ) live in a 12 dievery bending model based more
on complex
two triangles
thate.g.does
not
for increased resistance at sharper angles, are possible. But
a basis for this space
4
e
use exactly these force directions
violate
either
theallfunwe stresswill
that these
factors must
multiply
of the forces so
Bridson et al. / Simulation of Clothing
motion. For bending 3 damental
force influence
directions and proportionalities
do not change.
conservation laws that
orthewill
in-plane (i.e.
n
n
modes
theModel
threeforrigid
In many cases an artist desires that particular folds should
An
Accurate
Bending
non-bending) deformations. consistently
While some
may argue
that in
clothing to define their
N appear in a character’s
N
ous)
body
rotaphysicsrigid
of cloth
bending
are poorly understood.
dy-n
u1 =
|E|
= |E|
look.
Even1 2the bestutailoring
may2subtly
not do thiscouwhen the charreality,The
in-plane
and
bending
deformations
are
n
2
2
|N2in
| cloth simulation that can
acter is|Nin1 |motion, but one tool
of the
anisotropic
fibers twined together and woven into
xics1,
two in-plane
pled,
the
exact
nature
of
this
coupling
varies
between
mateovercome
this
is
sculpting
folds
directly
into
the garment.
eet of fabric constantly interacting
with massive defor2
stretching
of edge 3– 1
(x
−even
xcan
E the
N1 simplest
(x2 −model
x4 )fabrics,
· EthisNwith
rest an1 We
4 ) · straightforwardly
2 non-zero
rials
and is
not understood
for
thus
ons and friction is certainly more difficult
to model
with
u
=
+
Figure 1: A bending element with dihedral angle π − θ. 3
gles.
manifolds
such|E|
as skin, skin-tight
|E| Other |N
|2
|N2 |2 synthetic suits,
ngle,
and thus
should
o-dimensional
continuum
than for example
steel.
How1
it is wisest to avoid adding arbitrary and artificial coupling.
, severalThis
basic qualitative
properties of such a model can
c The Eurographics Association 2003.
!
tions.
leaves the
(x1 − x3 ) · E N1
(x − x ) · E N
dentified that are essential for a plausible simulation, and
− 2 of 3elastic2 2 force
For simplicity we uchoose
the
magnitude
4=−
houtisthese
the aunique
mode
model is incorrect.
|E|
|E|
|N1 |2
|N2 |
so that
arbitrary
scaling
facup
to
an
arbitrary
scaling
factor,
where
N
=
(x1 − x3 ) ×
n order to handle unstructured triangle meshes and get
1
2 (x2 −x4 )×(x2 −x3 ) are the area weighted
(x1 −x4 ) and|E|
N2 =
r,le
more
over bending than in vertex-centric
butrobust
doescontrol
not cause
e
is the
common
= ke and E = x4 − xsin
(θ/2)
ui , edge. Thus u1 and
we posit Let
as ourusbasic
yels,
motion.
callbending element two trian- Fi normals
|N1 | +proportional
|N2 | 3 to their distance
u2 are inversely
from the comsharing an edge. Our bending elements will be based on
ion ofangle
orthogonality
mon edge, and u3 and u4 are a linear combination of u1 and
dihedral
and its rate of change, as in Baraff and
e
i =the
1,ele. . . , 4. The
elastic
bending coordinates
stiffnessofkx1 and
is ax2 meshu2 based
on the barycentric
with rekin5 2,
andwe
extended
Grinspun
We label
nd
findinthat
u1 et al.24 . for
spect toproperty,
the commonthe
edge.middle
The bending
elasticscales
and damping
t as in figure 1, with vertex positions
xi independent
and velocities vi , material
factor
this
. .From
the
condition
forces must be proportional to this mode. One immediate ob1,
. . , 4, and
angle
θ between the normals n1 and n2 .
according
to
the
anisotropy
of
the
mesh
(so
the
look
of
the
From
Bridson
et
al.,
2003,
also
see
Grinspun
et
al.,
2003
servation is that orthogonality to rigid body modes implies
ng of edge 3–4, we
he vector of the four velocities v = (v1 , cloth
v2 , v3 , v4doesn’t
) and the change
these forces
conserve linear
and angular
momentum.
In fact,
significantly
with
remeshing),
and
the
forn̂of1 bending
and n̂forces
F = (F1 , F2 , F3 , F4 ) live in a 12 di2 . Orthogevery bending model based on two triangles that does not
sine
how far from flat the cloth is. This is
sional
linear
space.
Onesum
can select a basis
for factor
this spacemeasures
mplies
that
the
use exactly these force directions will violate either the funtifying twelve distinct “modes” of motion.
For
bending quantity
the
simplest
to conservation
compute laws
thatorsmoothly
monodamental
will influenceand
in-plane
(i.e.
is also
infirst
theeleven modes the three rigid
natural
for the
3 + uto
4 select
non-bending)
deformations.when
While some
may argue
that at
in
tonically
increases
from
a
minimum
sharply
folded
y translations,
three (instantaneous)
rigid body rotaeach
in thisthespan.
Fireality, in-plane and bending deformations are subtly couthe two in-plane motions of vertex 1,θthe
in-plane
=two
−π,
is zero when
atnature
θ =of0,this
and
risesvaries
to abetween
maximum
pled, theflat
exact
coupling
mateds,ions
rotations
(which we
of vertex 2, and the one in-line stretching of edge 3–
rials folded
and is not state
understood
forπ.
even
theuse
simplest
thus
at
the
other
sharply
θ
=
We
the
formula
he
n̂1change
, n̂2 and
ê) angle, and thus should ! it is wisest to avoid adding arbitrary and artificialfabrics,
oneaxes
of these
the dihedral
coupling.
sin
(θ/2)
participate in bending force calculations.
This
leaves=
the± (1 − n̂1 · n̂2 )/2 where the sign is chosen to
simplicity we choose the magnitude of elastic force
fth mode, the bending mode, which is match
the uniquethe
mode
sign ofso For
sin
θ, which is just n̂1 × n̂2 · ê. Naturally
that
ogonal to the other eleven up to an arbitrary scaling facmore
complex
nonlinear
models, e.g.
including powers of θ
This mode changes the dihedral angle but does not cause
|E|2
Fie = ke angles,
sin (θ/2) ui ,
in-plane deformation or rigid body motion.
Let us call resistance at sharper
for increased
But
|N1 | + |N2 | are possible.
= (u1 , u2 , u3 , u4 ). From the condition of orthogonality
e
we
stress
that
these
factors
must
multiply
all
of
the
forces
so
for i = 1, . . . , 4. The elastic bending stiffness k is a meshhe in-plane motions of vertices 1 and 2, we find that u1
independent
material
property, the middle
this
thatthethe
force directions
and
proportionalities
dofactor
not scales
change.
arallel to n̂1 and u2 is parallel to n̂2 . From
condition
Edge Springs
^
^
^
1
^
1
2
^
2
17
Example: Thin Material
according to the anisotropy of the mesh (so the look of the
^
rthogonality
to the in-axis stretching of edge 3–4, we
n2
doesn’tdesires
change significantly
with remeshing),
and the
cases cloth
an artist
that particular
folds should
that u4 − u3 must be in the span of n̂1 andInn̂2many
. Orthogsine factor measures how far from flat the cloth is. This is
ity to the rigid body translations implies
that
the
sum
consistently appear
in a character’s
clothing
to define
their
the simplest
quantity to compute
that smoothly
and mono+^u2 + u3 + u4 is zero, and hence u3 + u4 is also in the
^
tonically
increases
fromnot
a minimum
when
sharply
folded
at
look.
Even
the
best
tailoring
may
do
this
when
the
char1 n̂ and n̂ ,nthus
nnof
u
and
u
are
each
in
this
span.
Fi1
2 2
3
4
θ = −π, is zero when flat at θ = 0, and rises to a maximum
y, after making u orthogonal to rigid rotations
acter(which
is in we
motion,
but
one
tool
in
cloth
simulation
that
can
at the other sharply
conveniently choose to be about the axes n̂1 , n̂2 and ê)
! folded state θ = π. We use the formula
overcome this is sin
sculpting
into
garment.
(θ/2) = ± folds
(1 − n̂1directly
· n̂2 )/2 where
the the
sign is
chosen to
end up with
match the sign
of sin θ,this
which
is just
n̂1 × n̂2 · ê. rest
Naturally
We can straightforwardly
model
with
non-zero
anmore complex nonlinear models, e.g. including powers of θ
hedral angle π − θ.
gles. Other manifolds
such resistance
as skin,atskin-tight
synthetic
suits,
for increased
sharper angles,
are possible.
But
^
4
e
we stress that these factors must multiply all of the forces so
3
that the force directions and proportionalities do not change.
c The Eurographics Association 2003.
!
^
n2
^
n
1
^
n1
1
^
n2
In many cases an artist desires that particular folds should
consistently appear in a character’s clothing to define their
look. Even the best tailoring may not do this when the character is in motion, but one tool in cloth simulation that can 18
overcome this is sculpting folds directly into the garment.
We can straightforwardly model this with non-zero rest angles. Other manifolds such as skin, skin-tight synthetic suits,
Tuesday,
2 November 24, 2009
gure 1: A bending element with dihedral angle π − θ.
c The Eurographics Association 2003.
!
Suggested Reading
Physically Based Modeling: Principles and Practice
• Andy Witkin and David Baraff
• http://www-2.cs.cmu.edu/~baraff/sigcourse/index.html
• Grinspun, Hirani, Desbrun, and Peter Schroder, "Discrete Shells," SCA 2003
• Bridson, Marino, and Fedkiw, "Simulation of Clothing with Folds and Wrinkles," SCA 2003
• O’Brien and Hodgins, “Graphical Modeling and Animation of Brittle Fracture,” SIGGRAPH 99
•
19
Tuesday, November 24, 2009