0% found this document useful (0 votes)
41 views

Real Time Physics Class Notes

This document provides an overview of real-time physics simulation techniques. It discusses the schedule for a workshop on real-time physics, which will cover topics like deformable objects, multimodal physics and user interaction, fluids, and a unified solver. It then provides biographies and research backgrounds for some of the speakers, including their work on techniques like mass-spring systems, implicit integration, and position-based dynamics that enable real-time physics simulations. The document emphasizes challenges in bringing offline physics techniques to real-time and highlights dimensionality reduction and implicit solvers as important approaches.

Uploaded by

y5t9ftfg42
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)
41 views

Real Time Physics Class Notes

This document provides an overview of real-time physics simulation techniques. It discusses the schedule for a workshop on real-time physics, which will cover topics like deformable objects, multimodal physics and user interaction, fluids, and a unified solver. It then provides biographies and research backgrounds for some of the speakers, including their work on techniques like mass-spring systems, implicit integration, and position-based dynamics that enable real-time physics simulations. The document emphasizes challenges in bringing offline physics techniques to real-time and highlights dimensionality reduction and implicit solvers as important approaches.

Uploaded by

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

Real Time Physics

y
www.matthiasmueller.info/realtimephysics

Matthias Müller Doug James Jos Stam Nils Thuerey

Cornell University
Schedule
• 8:30 Introduction, Matthias Müller
• 8:45 Deformable Objects, Matthias Müller
• 9:30 Multimodal Physics and User Interaction
Doug James

• 10:15 Break
• 10:30 Fluids, Nils Thuerey
• 11:15 Unified Solver, Jos Stam
• 12:00 Q & A
Real Time Demos
Before Real Time Physics
y

• Myy Ph.d. thesis:


– Find 3d shape of dense polymer systems

!BIOSYM molecular_data 4 !BIOSYM archive


@molecule POLYCARB_B0 PBC=OFF

CARB_1:C C cp C1/1.5 C5/1.5 HC C 3.313660622 -2.504962206 -11.698267937


CARB_1:HC H hc C HC 2.429594755 -2.005253792 -12.065854073
CARB_1:C1
_ C cp C/1.5 C2/1.5 H1 C1 4.420852184 -1.754677892 -11.284504890
CARB_1:H1 H hc C1 H1 4.390906811 -0.676178515 -11.332902908
CARB_1:C2 C cp C1/1.5 C3/1.5 C7 C2 5.566863537 -2.402448654 -10.808005333
CARB_1:C3 C cp C2/1.5 C4/1.5 H3 C3 5.605681896 -3.800502777 -10.745265961
CARB_1:H3 H hc C3 H3 6.489747524 -4.300211430 -10.377680779
CARB_1:C4 C cp C3/1.5 C5/1.5 H4 C4 4.498489857 -4.550786972 -11.159029007
CARB_1:H4 H hc C4 H4 4.528435707 -5.629286766 -11.110631943
... ...
... ...
Meeting
g Real Time Physics
y
• Post doc at MIT (1999-2001)
– Plan: Parallelization of packing algorithms
– Prof had left MIT before I arrived!

• Change of research focus


– Computer graphics lab on same floor
– Real
Real-time
time physics needed for a
virtual sculptor

B C tler et al.
B.Cutler al
1999
• Among my literature search:
– D. James et al., ArtDefo, Accurate Real Time
Deformable Objects, Siggraph 1999
– J.Stam, Stable Fluids, Siggraph 1999
• They brought physics brought to life!
• My assignment: make this real-time:
– J. O‘Brien at al., Graphical Modeling and Animation of
Brittle Fracture, Siggraph 1999
ArtDefo
• Boundary element method
• Haptic interaction
Doug
g James
• CV
– 2001: PhD in applied mathematics, University of British Columbia
– 2002: Assistant prof, Carnegie Mellon University
– 2006: Associate prof, Cornell Universtiy
– National Science Foundation CAREER award

• Research interests
– Physically based animation
– Haptic force feedback rendering
– Reduced-order modeling
Stable Fluids
• Semi-Lagrangian advection
• Equation splitting
Jos Stam
• CV
– PhD in computer science, University of Toronto
– Postdoc in Paris and Helsinki
– Senior research scientist at Alias|Wavefront, now Autodesk
– SIGGRAPH Technical Achievement Award

• Research interests
– Natural phenomena
– Physics based simulation
– Rendering and surface modeling
Animation of Brittle Fracture
• Finite elements, separation tensor
• Great results but 5-10 min/frame

J. O‘Brien et al.
Real-Time Fracture of Stiff Materials
• Hybrid rigid body – static FEM
• Not quite as realistic but 30 fps

M.Müller et al. Eurographics CAS 2001


Deformables and Water
• Post doc with ETH computer graphics lab

2004 2003 Video by D.Charypar


2003, D Charypar

FEM base deformables SPH fluids


NovodeX - AGEIA
• 2003 NovodeX as ETH spin-off
• 2004 Acquisition by AGEIA
• 2007 Nils Thuereyy AGEIA p
post doc
Nils Thuerey
y
• CV
– 2007: PhD in computer science from University Erlangen
– 2007: Post doc with AGEIA
– 2008: Post doc with ETH

• Research interests
– Lattice-Boltzmann based fluid simulation
– Real-time height
g field fluid simulation
– Fluid Control
Offline Physics
y
• Applications
– Special effects in movies and commercials

• Typical setup
– Millions of particles / triangles / tetrahedra / grid cells
– Expensive photorealistic rendering
– Impressive high quality results
– Seconds up to hours per frame

• Characteristics
– Predictable,
Predictable re-run
re run possible,
possible no interaction
Real Time Physics
y
• Applications
– Interactive
I t ti systems
t
– Virtual surgery simulators („respectable“, „scientific“)
– Games
G (not
( t so respectable
t bl but
b t true
t i 99%)
in

• Requirements
– Fast, 40-60 fps of which physics only gets a small fraction
– Stable in any possible, non-predictable situation

• Challenge:
– Approach offline results while meeting all requirements!
From Offline to Real Time
• Resolution reduction
– Blobby and coarse look
– Details disappear

• Use specialized real time techniques!


– Physics
y low-res,, appearance
pp hi-res ((shader effects))
– Reduction of dimension from 3d to 2d (height field fluids, BEM)
– Level of detail (LOD)
( )
– No equation solving, procedural animation for specific effects
Deformable Objects
Examples
p of Deformable Objects
j

• 1d: Ropes,
Ropes hair

• 2d: Cloth, clothing

• 3d: Fat,
Fat tires,
tires organs
Dimensionality
y

• Every real object is 3d


• Approximated object with lower dimentional models if
possible
• Dimension reduction substantially saves simulation time
Mass
ass Spring
Sp g Syste
Systems
s
Mass Spring
p g Meshes

• Rope: chain
– Additional springs for bending
and torsional resistance needed

• Cloth: triangle mesh


– Additional springs for bending
restistance needed

• Soft
S ft body:
b d tetrahedral
t t h d l mesh
h
Mass Spring
p g Physics
y
• Mass point: mass m, position x, velocity v
v
x m
f -f
• Springs: xi xj

l0
x j − xi ⎡ x j − xi ⎤
f= ⎢ k s ( x j − x i − lo ) + k d ( v j − v i ) ⋅ ⎥
x j − x i ⎢⎣ x j − xi ⎥⎦

• Scalars ks, kd, stretching, damping coefficients


Time Integration
g
• Newton: v& = f / m
x& = v

• Explicit Euler: vi
t +1
= v i + Δt
t 1
∑ f (x i
t t t t
, vi , x j , v j )
mi j
t +1 t +1
= x i + Δt v i
t
xi

• Assumes velocity and force constant within Δt


• Correct would be:
t + Δt
x(t + Δt ) = x(t ) + ∫ v(t )dt
t
Explicit
p Euler Issues
• Accuracy
– Better with higher order schemes e.g. Runge Kutta
– Not critical in real time environments

• Stability Δt2f/m
– Overshooting
– Big issue in
real time systems!
Implicit
p Integration
g
• Use values of next time step on the right
1
∑ f (x i , v i , x j , v j )
t +1 t +1 t +1 t +1 t +1
= v i + Δt
t
vi
mi j
t +1 t +1
= x i + Δt v i
t
xi

• Intuitively
– Don‘t extrapolate blindly
– Arrive at a physical configuration
Implicit
p Integration
g Issues
• Unconditionally stable (for any Δt)!
• Have to solve system of equations for velocities
– n mass p
points,, 3n unknowns
– Non linear when the forces are non-linear
in the positions as with springs
– Linearize forces at each time step (Newton-Raphson)

• Slow → Take large


g time steps
p
• Temproal details disappear, numerical damping
Position
os t o Based
ased Dynamics
y a cs
Force Based Update
p

penetration causes forces change velocities change


forces velocities positions

• Reaction lag
• Small ks → squashy system
• Large ks → stiff system, overshooting
Position Based Update
p

penetration move objects so that


update velocities!
detection only they do not penetrate

• Controlled position change


• Only as much as needed → no overshooting
• Velocity update needed to get 2nd order system!
Position Based Integration
g
Init all xi0, vi0
Loop
pi = xit + Δt·vit // prediction
xit+1 = modify pi // position correction
ui = [xit+1 – xit] /Δt // velocity update
vit+1 = modifyy ui // velocityy correction
End loop

• Explicit,
Explicit Verlet related
• If correction done by a solver → semi implicit
Position Correction
• Move vertices out of other objects
• Move vertices such that constraints are satisfied
• Example:
p Particle on circle
prediction

new velocity
correction
Velocity
y Correction
• External forces: vt = ut + Δt·g/m
• Internal damping
• Friction
• Restitution
corrected
velocity
l it
prediction
friction
restitution
collision correction
Internal Distance Constraint
x1 − x 2
Δx2 Δx1 = −
w1
( x1 − x 2 − l0 )
Δx1 l0 w1 + w2 x1 − x 2
m2
x1 − x 2
m1 Δx 2 = +
w2
( x1 − x 2 − l0 )
w1 + w2 x1 − x 2
wi = 1 / mi
• Conservation of momentum
• Stiffness: scale corrections by k ∈ [0..1]
• Easy to tune but effect dependent on time step!
General Internal Constraint
• Define constraint via scalar function:
Cstretch (x1 , x 2 ) = x1 − x 2 − l0
Cvolume (x1 , x 2 , x 3 , x 4 ) = [(x 2 − x1 ) × (x 3 − x1 )]⋅ (x 4 − x1 ) − 6 v0

C=0 ∇C

Rigid body modes


General Position Correction

• Correction along gradient


Δx i = − s wi ∇ xi C (x1 ,..., x n )

• Scalar s tells us how far to go


C (x1 ,..., x n )
s=
∑ w j ∇ xC (x1 ,..., x n )
2
j
Shape
p Matching
g Idea
• Optimally match
undeformed
d f d with
ith Δxi
deformed shape
pi
• Only
O l allow
ll t
translation
l ti
and rotation
• Global
Gl b l correction,
ti no
propagation needed
• No mesh needed!
Shape
p Matching
g
• Let xi be the undeformed vertex positions
• The optimal translation is
t = p cm − x cm where p cm = ∑ mi p i / ∑ mi and x cm = ∑ mi x i / ∑ mi
i i i i

• The optimal linear transformation is


−1
⎛ T ⎞⎛ T ⎞
A = ⎜ ∑ mi (p i − p cm )(x i − x cm ) ⎟⎜ ∑ mi (x i − x cm )(x i − x cm ) ⎟
⎝ i ⎠⎝ i ⎠
• The optimal rotation R is the rotational part of A
(use polar decomposition)
2d Shape
p Matching
g Demo
Working
g with Points and Edges
g
• No notion of volume or area
– Spring stiffness (N/m) not related to 3d stiffness (N/m2)

• Volumetric behavior dependent on


– Tesselation of volume
– Hand tune spring stiffnesses

• Often OK in real time environments


– Evenly tesselated physics meshes
– Fixed time step
Co-Rotated
Co otated Finite
te Elements
e e ts
Continuum Mechanics on one Slide

• Body as continuous set of points p(x)

• Deformation continuous function p(x)


• Elasticity
Elasticit theor
theory yields
ields felast(x)
( ) from p(x)
( )
• PDE of motion (Newton): x

ρ p tt (x, t ) = f elast (x, t ) + f ext (x, t )

• Solve for p(x,t)


p(x t)
• Analytical solution only for very simple problems
Finite Element Method on one Slide
• Represent body by set of finite elements (tetrahedra)
• Represent continuous p(x) by vectors pi on vertices
x3
p3
p1

x2 x1 p0
x0 p2

• pi induce simple continuous p(x) within each element


• Continuous elasticity theory yields forces at vertices
Hyper
yp Spring
p g
• Vertex forces depend on displacements of all 4 vertices
[f 0 , f1 , f 2 , f 3 ] = Ftetra (p 0 , p1 , p 2 , p 3 , x 0 , x1 , x 2 , x 3 )

• Tetrahedron acts like a hyper spring


• Compare to: [f0, f1] = Fspring(p0,p1,l0)
• Given Ftetra () -blackbox, simulate as mass spring system
• Ftetra () is non linear, expensive
Linearization
• Linearization Ftetra () of yields

⎡f 0 ⎤ ⎡p 0 − x 0 ⎤
⎢f ⎥ ⎢p − x ⎥
⎢ 1 ⎥ = K ⎢ 1 1 ⎥, K ∈ R12×12
⎢f 2 ⎥ ⎢p 2 − x 2 ⎥
⎢ ⎥ ⎢ ⎥
⎣f 3 ⎦ ⎣p 3 − x 3 ⎦

• K depends on x0, x1, x2, x3 and can be pre-computed


(see class notes for how to compute)

• Much faster to evaluate


Linearization Artifact
• Linearization only valid close to
the point off linearization

x p

linearized non-linear
Corotational Formulation
• Only rotations problematic, translations OK
• Extract rotation: RK(RTp-x)

f R
p-x

RT

RTp-x
p K(RTp-x)
Rotational Part
• Modified force computation
⎡f 0 ⎤ ⎡R 0 0 0 ⎤ ⎛⎜ ⎡R T p 0 ⎤ ⎡x 0 ⎤ ⎞
⎢f ⎥ ⎢ 0 R 0 0 ⎥ ⎜ ⎢ T ⎥ ⎢ ⎥⎟
⎢ 1⎥ = ⎢ ⎥K⎜ ⎢ R p1 ⎥ − ⎢ x1 ⎥ ⎟
⎢f 2 ⎥ ⎢ 0 0 R 0 ⎥ ⎜ ⎢R T p 2 ⎥ ⎢x 2 ⎥ ⎟
⎢ ⎥ ⎢ ⎥ ⎜ ⎢ T ⎥ ⎢ ⎥ ⎟⎟
⎣ 3 ⎦ ⎣ 0 0 0 R⎦ ⎝
f ⎣⎢ R p 3 ⎥⎦ ⎣ x 3 ⎦ ⎠

• Transformation matrix
A = [p1 − p 0 , p 2 − p 0 , p 3 − p 0 ][x1 − x 0 , x 2 − x 0 , x 3 − x 0 ]−1

• Rotation via polar decomposition of A


Advantages
g
• Matrix K can still be precomputed
• Artifacts removed
• Faster force computation in explicit
formulation
• Implicit time integration yields linear system
→ no Newton-Raphson
p solver needed
FEM Demo
Conclusions
• Trade-off speed, accuracy, stability
• Choose method accordingly
• Stability most important in real time systems
– Non predictable situations
– No time step adaptions
– No roll backs
• Remaining choice: accuracy vs. speed
Cloth in Games
Mesh Generation
• Input
– Graphical triangle surface mesh
– Extreme case: Triangle
g soup
p
• Output
– Input independent tesselation
– User specify resolution (LOD)
– Equally sized elements (stability, spatial hashing)
Surface Creation

• Input triangle mesh

• Each triangle adds density


to a regular
egu a ggrid
d
• Extract iso surface using
marching
g cubes
• Optional: Keep largest
connected mesh onlyy
• Quadric simplification
Tetrahedra Creation
• Delaunay
Tetrahedralization on
vertices of surface mesh
• Triangles of surface mesh
are used for clipping
tetrahedra (if necessary)
• Graphical mesh is moved
along with tetra mesh
using barycentric coords

You might also like