iterative dynamics with temporal coherence
play

Iterative Dynamics with Temporal Coherence Erin Catto - PowerPoint PPT Presentation

Iterative Dynamics with Temporal Coherence Erin Catto ecatto@crystald.com Crystal Dynamics Menlo Park, California Game Developers Conference, 2005 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 1 / 15 Introduction The Problem


  1. Iterative Dynamics with Temporal Coherence Erin Catto ecatto@crystald.com Crystal Dynamics Menlo Park, California Game Developers Conference, 2005 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 1 / 15

  2. Introduction The Problem Many rigid body physics algorithms are slow, use too much memory, are difficult to implement, or have other nasty limitations. The Idea Use an approximate contact model that is easy to solve. Use a sloppy but fast constraint solver. Clean up the solution over several frames. The Toolkit Contact point calculator. Rigid bodies, constraints, and Jacobians. Gauss-Seidel constraint solver and simple integrator. Contact cache. Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 2 / 15

  3. High Level Algorithm Time Stepping Generate contact points. 1 Initialize contact forces λ using a contact cache (generated in the 2 previous step). Compute the Jacobian J for non-penetration and friction 3 constraints. Form an equation for λ . 4 Use a Gauss-Seidel solver to refine λ . 5 Compute new velocities v and ω using λ . 6 Compute new positions x and q from v and ω . 7 Store λ in the contact cache. 8 Go to step 1. 9 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 3 / 15

  4. Constraints Pairwise position constraint C ( x i , q i , x j , q j ) = 0 Velocity constraint and Jacobian dC dt = JV The Recipe Determine each constraint equation as a function of body 1 positions and rotations. Differentiate the constraint equation with respect to time. 2 Identify the coefficient matrix of V . This matrix is J . 3 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 4 / 15

  5. Contact Constraint Normal constraint C n = ( x 2 + r 2 − x 1 − r 1 ) · n 1 dC n x 2 = ( v 2 + ω 2 × r 2 − v 1 − ω 1 × r 1 ) · n 1 dt r 2 n 1 Friction constraint dC u 1 r 1 = ( v 2 + ω 2 × r 2 − v 1 − ω 1 × r 1 ) · u 1 dt x 1 dC u 2 = ( v 2 + ω 2 × r 2 − v 1 − ω 1 × r 1 ) · u 2 dt Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 5 / 15

  6. Equations of Motion Kinematics dx = v dt dq 1 = 2 q ∗ ω dt Newton’s Law for a system of constrained rigid bodies M dV dt = J T λ + F ext JV = ζ Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 6 / 15

  7. Time Stepping Approximate acceleration dt ≈ V 2 − V 1 dV ∆ t Eliminate V 2 JB λ = η where B = M − 1 J T and η = 1 ∆ t ζ − J ( 1 ∆ t V 1 + M − 1 F ext ) Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 7 / 15

  8. Constraint Forces Contact and friction are simulated by bounding λ . Normal force: 0 ≤ λ n < ∞ Approximate friction model: − µ m c g ≤ λ u 1 ≤ µ m c g − µ m c g ≤ λ u 2 ≤ µ m c g In general: i ≤ λ i ≤ λ + λ − i Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 8 / 15

  9. Gauss-Seidel An iterative method for solving linear equations. The basic algorithm: approximately solve Ax = b given x 0 . Iterate for a fixed number of steps. x = x 0 for iter = 1 to iteration limit do for i = 1 to n do � � b i − � n ∆ x i = j = 1 A ij x j / A ii x i = x i + ∆ x i end for end for Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 9 / 15

  10. Projected Gauss-Seidel Solve JB λ = η given λ 0 . Clamp λ i to its bounds. Use sparsity to avoid forming the s -by- s matrix JB . See the paper for details. The Jacobian J is sparse because constraints are pairwise.   J 11 J 12 . . . . J sp =   . .   J s 1 J s 2   b 11 b 12 . . . . J map =   . .   b s 1 b s 2 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 10 / 15

  11. Temporal Coherence Why? When things move fast, sloppiness is okay. When things settle down, jiggle looks bad. Gauss-Seidel is iterative. It needs a good starting guess to be accurate. Issues Contact points appear and disappear. How can contact points persist? There is too much stuff to keep track of ( n 2 pairs). Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 11 / 15

  12. Contact Caching The Idea Build a contact cache at the end of each time step. Rediscover all the contact points at the beginning of the next time step. Try to match the the new points to the cached points. If there is a cache hit then λ = λ cache , else λ = 0. Matching Points Compare global coordinates of the points 1 Compare local coordinates of the points. 2 Compare contact identifiers. 3 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 12 / 15

  13. Contact Identifiers Typical contact configuration: Box 2 n 1 Box 1 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 13 / 15

  14. Edge Labels Clipping leads to contact identifiers. e 2,3 p (1,3)(1,4) p (2,2)(1,3) e 1,3 e 2,2 e 2,4 e 1,4 e 1,2 p (2,1)(2,2) e 2,1 p (1,4)(2,1) e 1,1 Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 14 / 15

  15. Box Stacking Without Caching With Caching Erin Catto (Crystal Dynamics) Iterative Dynamics GDC 2005 15 / 15

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend