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 SC2 P HYSICALLY B ASED M ODELING
A Newtonian Particle A Newtonian Particle • Differential equation: f = ma • Forces can depend on: – Position, Velocity, Time = f x x t ( , , ) ɺ x ɺɺ m S IGGRAPH 2001 C OURSE N OTES SC3 P HYSICALLY B ASED M ODELING
Second Order Equations Second Order Equations = f x x t Not in our standard form ( , , ) ɺ x ɺɺ because it has 2nd m derivatives x v = Add a new variable, v, to get ɺ = a pair of coupled 1st order v f m ɺ equations. S IGGRAPH 2001 C OURSE N OTES SC4 P HYSICALLY B ASED M ODELING
Phase Space Phase Space x Concatenate x and v to make a 6-vector: Position in Phase v Space. x ɺ Velocity in Phase Space : v another 6-vector. ɺ x v ɺ = A vanilla 1st-order differential v f m ɺ equation. S IGGRAPH 2001 C OURSE N OTES SC5 P HYSICALLY B ASED M ODELING
Particle Structure Particle Structure x Position Position in v Phase Space Velocity f Force Accumulator m mass S IGGRAPH 2001 C OURSE N OTES SC6 P HYSICALLY B ASED M ODELING
Solver Interface Solver Interface x 6 Dim(state) v x v f Get/Set State v m f m Deriv Eval S IGGRAPH 2001 C OURSE N OTES SC7 P HYSICALLY B ASED M ODELING
Particle Systems Particle Systems n time particles x x x x x x v v v v v v … f f f f f f m m m m m m S IGGRAPH 2001 C OURSE N OTES SC8 P HYSICALLY B ASED M ODELING
Solver Interface Solver Interface Particle System n time particles Dim(State) Dim(State) Diffeq Solver Get/Set State Get/Set State 6n x 1 v 1 x 2 v 2 x n v n v 1 f 1 m 1 v 2 f 2 v n f n Deriv Eval Deriv Eval m 2 m n S IGGRAPH 2001 C OURSE N OTES SC9 P HYSICALLY B ASED M ODELING
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. S IGGRAPH 2001 C OURSE N OTES SC10 P HYSICALLY B ASED M ODELING
Forces Forces • Constant gravity • Position/time dependent force fields • Velocity-Dependent drag • n-ary springs S IGGRAPH 2001 C OURSE N OTES SC11 P HYSICALLY B ASED M ODELING
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 S IGGRAPH 2001 C OURSE N OTES SC12 P HYSICALLY B ASED M ODELING
Particle Systems, with forces Particle Systems, with forces particles n time forces nforces … F x x x F F F F v v v m … f f f A list of force objects to invoke m m S IGGRAPH 2001 C OURSE N OTES SC13 P HYSICALLY B ASED M ODELING
Gravity Gravity Force Law: Particle system f G = m grav F G sys x apply_fun p v f m p->f += p->m * F->G p->f += p->m * F->G S IGGRAPH 2001 C OURSE N OTES SC14 P HYSICALLY B ASED M ODELING
Viscous Drag Viscous Drag Force Law: Particle system f v = − k drag drag F k sys x apply_fun p v f m p->f -= F->k * p->v p->f -= F->k * p->v S IGGRAPH 2001 C OURSE N OTES SC15 P HYSICALLY B ASED M ODELING
Damped Damped Spring Force Law: Spring v x x ∆ ⋅∆ ∆ ( ) f x = − ∆ − + k r k s d 1 x x ∆ ∆ Particle system f f = − 2 1 x F p1 sys v kd x f v ks apply_fun p2 f m m S IGGRAPH 2001 C OURSE N OTES SC16 P HYSICALLY B ASED M ODELING
x x x Deriv Eval Loop Deriv Eval Loop 1 v v v m … f f f … F F F F F m m 2 Clear Force Invoke apply_force Accumulators functions x x x 3 v v v m … f f f Return [v, f/ m,… ] to solver. m m S IGGRAPH 2001 C OURSE N OTES SC17 P HYSICALLY B ASED M ODELING
Solver Interface Solver Interface Dim(state) Solver System Get/Set State You are Here Deriv Eval S IGGRAPH 2001 C OURSE N OTES SC18 P HYSICALLY B ASED M ODELING
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. S IGGRAPH 2001 C OURSE N OTES SC19 P HYSICALLY B ASED M ODELING
Normal and Tangential Components Normal and Tangential Components V N V T V N V N = ( N ⋅ V ) N V T = V - V N S IGGRAPH 2001 C OURSE N OTES SC20 P HYSICALLY B ASED M ODELING
Collision Detection Collision Detection ( ) X - P ⋅ N < ε X N ⋅ V < 0 V N P • Within ε of the wall. • Within ε of the wall. • Heading in. • Heading in. S IGGRAPH 2001 C OURSE N OTES SC21 P HYSICALLY B ASED M ODELING
Collision Response Collision Response V N -k r V N V T V T V ′ V Before After V ′ = V T - k r V N S IGGRAPH 2001 C OURSE N OTES SC22 P HYSICALLY B ASED M ODELING
Conditions for Contact Conditions for Contact ( ) X - P ⋅ N < ε F X N ⋅ V < ε V P • On the wall N • On the wall • Moving along the wall • Moving along the wall • Pushing against the wall • Pushing against the wall S IGGRAPH 2001 C OURSE N OTES SC23 P HYSICALLY B ASED M ODELING
Contact Force Contact Force F ′ = F T F -F N The wall pushes back, cancelling the normal component of F. F ′ (An example of a N constraint force. ) S IGGRAPH 2001 C OURSE N OTES SC24 P HYSICALLY B ASED M ODELING
Basic 2-D Interaction Basic 2-D Interaction Cursor Cursor Operations: X X X Nail Mouse Nail Mouse – Create Spring Spring – Attach – Drag – Nail S IGGRAPH 2001 C OURSE N OTES SC25 P HYSICALLY B ASED M ODELING
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. S IGGRAPH 2001 C OURSE N OTES SC26 P HYSICALLY B ASED M ODELING
Recommend
More recommend