SC1 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
SC1 P HYSICALLY B ASED M ODELING Overview Overview One Lousy - - PowerPoint PPT Presentation
SC1 P HYSICALLY B ASED M ODELING Overview Overview One Lousy - - PowerPoint PPT Presentation
S IGGRAPH 2001 C OURSE N OTES SC1 P HYSICALLY B ASED M ODELING Overview Overview One Lousy Particle Particle Systems Forces: gravity, springs Implementation and Interaction Simple collisions S IGGRAPH 2001 C OURSE N OTES
Overview Overview
- One Lousy Particle
- Particle Systems
- Forces: gravity, springs …
- Implementation and Interaction
- Simple collisions
SC2 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
A Newtonian Particle A Newtonian Particle
- Differential equation: f = ma
- Forces can depend on:
– Position, Velocity, Time
( , , ) t m = f x x x ɺ ɺɺ
SC3 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Second Order Equations Second Order Equations
Not in our standard form because it has 2nd derivatives Add a new variable, v, to get a pair of coupled 1st order equations.
( , , ) t m = f x x x ɺ ɺɺ m = = x v v f ɺ ɺ
SC4 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Phase Space Phase Space
Concatenate x and v to make a 6-vector: Position in Phase Space. Velocity in Phase Space: another 6-vector. A vanilla 1st-order differential equation.
x v x v ɺ ɺ m = x v v f ɺ ɺ
SC5 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Particle Structure Particle Structure
x v f
m
Position Velocity Force Accumulator mass Position in Phase Space
SC6 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Solver Interface Solver Interface
x v f
m
Get/Set State Deriv Eval
6
Dim(state)
v
f m
x v
SC7 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Particle Systems Particle Systems
x v f
m
x v f
m
x v f
m
x v f
m
x v f
m
particles n time
…
x v f
m
SC8 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Solver Interface Solver Interface
6n x1 v1 x2 v2 xn vn v1 f1 m1 v2 f2 m2 vn fn mn
particles n time
Deriv Eval Deriv Eval Get/Set State Get/Set State Dim(State) Dim(State)
Particle System Diffeq Solver
SC9 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Deriv Eval Loop Deriv Eval Loop
- Clear forces
– Loop over particles, zero force accumulators.
- Calculate forces
– Sum all forces into accumulators.
- Gather
– Loop over particles, copying v and f/m into destination array.
SC10 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Forces Forces
- Constant
gravity
- Position/time dependent
force fields
- Velocity-Dependent
drag
- n-ary
springs
SC11 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Force Structures Force Structures
- Unlike particles, forces are
heterogeneous.
- Force Objects:
– black boxes – point to the particles they influence – add in their own forces (type dependent)
- Global force calculation:
– loop, invoking force objects
SC12 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Particle Systems, with forces Particle Systems, with forces
x v f
m
x v f
m …
x v f
m
particles n time forces nforces
… F
F
F F F
A list of force
- bjects to invoke
SC13 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Gravity Gravity
x v f
m
G apply_fun p sys
p->f += p->m * F->G p->f += p->m * F->G
F Force Law:
Particle system
grav
m = f G
SC14 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Viscous Drag Viscous Drag
x v f
m
k apply_fun p sys
p->f -= F->k * p->v p->f -= F->k * p->v
F Force Law:
Particle system
drag drag
k = − f v
SC15 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Damped Spring Damped Spring
x v f
m
F
x v f
m
ks p2 p1 kd apply_fun sys Particle system
Force Law:
( )
1 2 1 s d
k r k ∆ ⋅∆ ∆ = − ∆ − + ∆ ∆ = − v x x f x x x f f
SC16 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Deriv Eval Loop Deriv Eval Loop
… F
F
F F F
Clear Force Accumulators Invoke apply_force functions
x v f
m
x v f
m …
x v f
m
x v f
m
x v f
m …
x v f
m
Return [v, f/m,…] to solver.
1 2 3
SC17 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Solver Interface Solver Interface
Get/Set State
System
Dim(state)
Solver
Deriv Eval
You are Here
SC18 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Bouncing off the Walls Bouncing off the Walls
- Later: rigid body
collision and contact.
- For now, just simple
point-plane collisions.
- Add-ons for a particle
simulator.
SC19 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Normal and Tangential Components Normal and Tangential Components
VN = (N⋅V)N VT = V - VN
VT VN V N
SC20 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Collision Detection Collision Detection
N X V P
N⋅V < 0
( )
X - P ⋅N < ε
- Within ε of the wall.
- Heading in.
- Within ε of the wall.
- Heading in.
SC21 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Collision Response Collision Response
VN VT
- krVN
V V′ = VT - krVN V′ VT
Before After
SC22 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Conditions for Contact Conditions for Contact
N P V F X
- On the wall
- Moving along the wall
- Pushing against the wall
- On the wall
- Moving along the wall
- Pushing against the wall
N⋅V < ε
( )
X - P ⋅N < ε
SC23 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Contact Force Contact Force
The wall pushes back, cancelling the normal component of F. (An example of a constraint force.) F F′ N
F′ = FT
- FN
SC24 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Basic 2-D Interaction Basic 2-D Interaction
X X X
Operations: – Create – Attach – Drag – Nail
Cursor Cursor Mouse Spring Mouse Spring Nail Nail
SC25 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING
Try this at home! Try this at home!
The notes give you everything you need to build a basic interactive mass/spring simulator—try it.
SC26 SIGGRAPH 2001 COURSE NOTES PHYSICALLY BASED MODELING