notes rigid collision algorithms
play

Notes Rigid Collision Algorithms Use the same collision response - PDF document

Notes Rigid Collision Algorithms Use the same collision response algorithm as Assignment 2 instability - dont worry with particles about it right now Identify colliding points as perhaps the deepest Please read penetrating


  1. Notes Rigid Collision Algorithms � Use the same collision response algorithm as � Assignment 2 instability - don’t worry with particles about it right now • Identify colliding points as perhaps the deepest � Please read penetrating points, or the first points to collide • Make sure they are colliding, not separating! • D. Baraff, “Fast contact force computation for � Problem: multiple contact points nonpenetrating rigid bodies”, SIGGRAPH ‘94 • Fixing one at a time can cause rattling. • D. Baraff, “Linear-time dynamics using • Can fix by being more gentle in resolving contacts - Lagrange multipliers”, SIGGRAPH ’96 negative coefficient of restitution � Problem: multiple collisions (stacks) • Fixing one penetration causes others • Solve either by resolving simultaneously or enforcing order of resolution cs533d-winter-2005 1 cs533d-winter-2005 2 Stacking Stacking continued � Guendelman et al. “shock propagation” � Advantages: � After applying contact impulses (but penetrations • Simple, fast remain) � Problems: • Form contact graph: “who is resting on whom” • Overly stable sometimes � Check new position of each object against the other objects’ old positions --- any penetrations indicate a directed edge • Doesn’t really help with loops • Find “bottom-up” ordering: order fixed objects such as the ground first, then follow edges � To resolve problems, need to really solve � Union loops into a single group the global contact problem (not just at • Fix penetrations in order, freezing objects after they single contact points) are fixed � Slight improvement: combine objects into a single composite rigid body rather than simply freezing cs533d-winter-2005 3 cs533d-winter-2005 4 The Contact Problem Frictional Contact Problem � See e.g. Baraff “Fast contact force � Include tangential contact impulses computation…”, SIGGRAPH’94 • Either relative velocity is zero (static friction) � Identify all contact points or tangential impulse is on the friction cone • Where bodies are close enough • By approximating the friction cone with planar � For each contact point, find relative velocity as a facets, can reduce to LCP again (linear) function of contact impulses • Just as we did for pairs � Note: modeling issue - the closer to the � Frictionless contact problem: true friction cone you get, the more • Find normal contact impulses that cause normal variables and equations in the LCP relative velocities to be non-negative • Subject to constraint: contact impulse is zero if normal relative velocity is positive • Called a linear complementary problem (LCP) cs533d-winter-2005 5 cs533d-winter-2005 6

  2. Constrained Dynamics Constrained Dynamics � We just dealt with one constraint: rigid motion only � More general constraints on motion are useful too • E.g. articulated rigid bodies, gears, scripting part of the motion, … � Same basic issue: modeling the constraint forces • Principle of virtual work - constraint forces shouldn’t influence the unconstrained part of the motion cs533d-winter-2005 7 cs533d-winter-2005 8 Three major approaches Equality constraints � Generally, want motion to satisfy C(x,v)=0 � “Soft” constraint forces (penalty terms) • C is a vector of constraints • Like repulsions � Inequalities also possible - C(x,v) � 0 - but let’s � Solve explicitly for unknown constraint ignore for now forces (lagrange multipliers) • Generalizes notion of contact forces • Also can do things like joint limits, etc. • Closely related: projection methods • Generally need to solve with heavy-duty optimization, � Solve in terms of reduced number of may run into NP-hard problems • One approach: figure out or guess which constraints degrees of freedom (generalized are “active” (equalities) and just do regular equality coordinates) constraints, maybe iterating cs533d-winter-2005 9 cs533d-winter-2005 10 Soft Constraints Potential force � First assume C=C(x) � We’ll use the gradient of the potential as a • No velocity dependence force: T T F = � � E � � = � K � C � � C � � � � � We won’t exactly satisfy constraint, but will add � � x � � � x � some force to not stray too far � This is just a generalized spring pulling the • Just like repulsion forces for contact/collision system back to constraint � First try: � But what do undamped springs do? • define a potential energy minimized when C(x)=0 • C(x) might already fit the bill, if not use 2 KC T C E = 1 • Just like hyper-elasticity! cs533d-winter-2005 11 cs533d-winter-2005 12

  3. Rayleigh Damping Issues � Need to pick K and D � Need to add damping force that doesn’t • Don’t want oscillation - critical damping damp valid motion of the system • If K and D are very large, could be expensive (especially if C is nonlinear) � Rayleigh damping: • If K and D are too small, constraint will be grossly • Damping force proportional to the negative violated rate of change of C(x) � Big issue: the more the applied forces try to � No damping valid motions that don’t change C(x) violate constraint, the more it is violated… • Damping force parallel to elastic force • Ideally want K and D to be a function of the applied � This is exactly what we want to damp forces T � C T F d = � D � C � � C = � D � C � � ˙ � x v � � � � � � x � � � x � cs533d-winter-2005 13 cs533d-winter-2005 14 Pseudo-time Stepping Issues � Alternative: simulate all the applied force � Still can be slow dynamics for a time step • Particularly if there are lots of adjoining � Then simulate soft constraints in pseudo-time constraints • No other forces at work, just the constraints � Could be improved with implicit time steps • “Real” time is not advanced • Get to equilibrium as fast as possible… • Keep going until at equilibrium � This will come up again… • Non-conflicting constraints will be satisfied • Balance found between conflicting constraints • Doesn’t really matter how big K and D are (adjust the pseudo-time steps accordingly) cs533d-winter-2005 15 cs533d-winter-2005 16 Constraint forces Virtual work � Idea: constraints will be satisfied because � Assume for now C=C(x) F total =F applied +F constraint � Require that all the (real) work done in the system is by the applied forces � Have to decide on form for F constraint • The constraint forces do no work � [example: y=0] � Work is F c • � x � We have too much freedom… • So pick the constraint forces to be perpendicular to all valid velocities � Need to specify the problem better • The valid velocities are along isocontours of C(x) T • Perpendicular to them is the gradient: � C � x � So we take T � � F c = � C � � � � � x � cs533d-winter-2005 17 cs533d-winter-2005 18

  4. What is � ? Finding constraint forces � Say C(x)=0 at start, want it to remain 0 � Rearranging gives: � x M � 1 F a � � ˙ � C � x M � 1 F c = � � C C ( x ) = � C x = � C � Take derivative: ˙ ˙ C � x v = 0 � x v � x � Plug in the form we chose for constraint force: � Take another to get to accelerations � x M � 1 F a � � ˙ � T � � C � x M � 1 � C � = � � C C ( x ) = � ˙ x + � ˙ v = � ˙ � x v C C � x v + � C C � � ˙ ˙ C ˙ ˙ v = 0 ˙ � x � � � x � v � x � Note: SPD matrix! � Plug in F=ma, set equal to 0 � ˙ � x v + � C C � x M � 1 F a + F c ( ) = 0 ( ) cs533d-winter-2005 19 cs533d-winter-2005 20 Modified equations of motion Velocity constraints � So can write down (exact) differential equations � How do we handle C(v)=0? � C of motion with constraint force � Take time derivative as before: ˙ v = 0 � Could run our standard solvers on it � v � Problem: drift � And again apply principle of virtual work just like • We make numerical errors, both in the regular before: T F c = � C � � dynamics and the constraints! � � � � � v � � We’ll just add “stabilization”: additional soft � And end up solving: constraint forces to keep us from going too far • Don’t worry about K and D in this context! � T � � C � v M � 1 � C � = � � C � v M � 1 F a • Don’t include them in formula for � - this is � � � v post-processing to correct drift � � cs533d-winter-2005 21 cs533d-winter-2005 22 J notation Discrete projection method � Both from C(x)=0 and two time derivatives, and � It’s a little ugly to have to add even more stuff for C(v)=0 and one time derivative, get constraint dealing with drift - and still isn’t exactly on force equation: constraint � Instead go to discrete view JM � 1 F c = � JM � 1 F a � c (treat numerical errors as applied forces too) � After a time step (or a few), calculate constraint (J is for Jacobian) impulse to get us back � We assume F c =J T � • Similar to what we did with collision and contact � This gives SPD system for � : JM -1 J T � =b � Can still have soft or regular constraint forces for better accuracy… cs533d-winter-2005 23 cs533d-winter-2005 24

Recommend


More recommend