1cs533d-winter-2005 Notes  Assignment 2 instability - don’t worry about it right now  Please read D. Baraff, “Fast contact force computation for nonpenetrating.

Slides:



Advertisements
Similar presentations
Numeric Integration Methods Jim Van Verth Red Storm Entertainment
Advertisements

Lecture 7 Rolling Constraints The most common, and most important nonholonomic constraints They cannot be written in terms of the variables alone you must.
1cs533d-winter-2005 Notes  Assignment 1 is not out yet :-)  courses/533d-winter-2005.
Lecture 2. A Day of Principles The principle of virtual work d’Alembert’s principle Hamilton’s principle 1 (with an example that applies ‘em all at the.
© 2011 Autodesk Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the.
Integration Techniques
EARS1160 – Numerical Methods notes by G. Houseman
1cs533d-winter-2005 Notes  Please read O'Brien and Hodgins, "Graphical modeling and animation of brittle fracture", SIGGRAPH '99 O'Brien, Bargteil and.
Notes Assignment questions… cs533d-winter-2005.
1cs542g-term Notes. 2 Solving Nonlinear Systems  Most thoroughly explored in the context of optimization  For systems arising in implicit time.
1Notes. 2Heightfields  Especially good for terrain - just need a 2d array of heights (maybe stored as an image)  Displacement map from a plane  Split.
1Notes  Handing assignment 0 back (at the front of the room)  Read the newsgroup!  Planning to put 16mm films on the web soon (possibly tomorrow)
1Notes. 2 Triangle intersection  Many, many ways to do this  Most robust (and one of the fastest) is to do it based on determinants  For vectors a,b,c.
1Notes  Reference  Witkin and Baraff, “Physically Based Modelling” course, SIGGRAPH 2001  Link on the course website.
Course Outline 1.MATLAB tutorial 2.Motion of systems that can be idealized as particles Description of motion; Newton’s laws; Calculating forces required.
1cs533d-winter-2005 Notes  More optional reading on web for collision detection.
1cs533d-winter-2005 Notes  Assignment 2 going okay? Make sure you understand what needs to be done before the weekend  Read Guendelman et al, “Nonconvex.
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
1cs533d-winter-2005 Notes  More reading on web site Baraff & Witkin’s classic cloth paper Grinspun et al. on bending Optional: Teran et al. on FVM in.
1cs533d-term Notes  list Even if you’re just auditing!
1cs533d-winter-2005 Notes  Some example values for common materials: (VERY approximate) Aluminum: E=70 GPa =0.34 Concrete:E=23 GPa =0.2 Diamond:E=950.
1cs533d-term Notes. 2 Poisson Ratio  Real materials are essentially incompressible (for large deformation - neglecting foams and other weird composites…)
1cs533d-term Notes  Typo in test.rib --- fixed on the web now (PointsPolygon --> PointsPolygons)
1cs426-winter-2008 Notes  SIGGRAPH crunch time - my apologies :-)
Chapter 4 Dynamics: Newton’s Laws of Motion
3.7. O THER G AME P HYSICS A PPROACHES Overview of other game engine physics approaches.
Fast and Simple Physics using Sequential Impulses
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
Advanced Programming for 3D Applications CE Bob Hobbs Staffordshire university Human Motion Lecture 3.
ME451 Kinematics and Dynamics of Machine Systems
ME451 Kinematics and Dynamics of Machine Systems Numerical Solution of DAE IVP Newmark Method November 1, 2013 Radu Serban University of Wisconsin-Madison.
Numerical Methods Applications of Loops: The power of MATLAB Mathematics + Coding 1.
ME451 Kinematics and Dynamics of Machine Systems Dynamics of Planar Systems December 1, 2011 Solving Index 3 DAEs using Newmark Method © Dan Negrut, 2011.
Modeling and Solving Constraints Erin Catto Blizzard Entertainment.
Large Steps in Cloth Simulation - SIGGRAPH 98 박 강 수박 강 수.
Chapter 4 Dynamics: Newton’s Laws of Motion. Units of Chapter 4 Force Newton’s First Law of Motion Mass Newton’s Second Law of Motion Newton’s Third Law.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Optimization & Constraints Add mention of global techiques Add mention of calculus.
 d.s. wu 1 Penalty Methods for Contact Resolution interactive contact resolution that usually works pi david s wu.
STAR Sti, main features V. Perevoztchikov Brookhaven National Laboratory,USA.
Dynamics: Newton’s Laws of Motion. Concepts Force Newton’s First Law of Motion Mass Newton’s Second Law of Motion Newton’s Third Law of Motion Weight.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
ME451 Kinematics and Dynamics of Machine Systems Introduction to Dynamics 6.1 October 09, 2013 Radu Serban University of Wisconsin-Madison.
Dynamics: Newton’s Laws of Motion
Dynamics: Newton’s Laws of Motion
ME451 Kinematics and Dynamics of Machine Systems Singular Configurations 3.7 October 07, 2013 Radu Serban University of Wisconsin-Madison.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
Modeling and Solving Constraints
1cs426-winter-2008 Notes  Will add references to splines on web page.
Rigid Body Dynamics (II). Bodies intersect ! classify contacts Bodies separating –v rel >  –No response required Colliding contact (Last time) –v rel.
1 Lecture 15: Stability and Control III — Control Philosophy of control: closed loop with feedback Ad hoc control thoughts Controllability Three link robot.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
© 2005 Pearson Prentice Hall This work is protected by United States copyright laws and is provided solely for the use of instructors in teaching their.
Dynamics: Newton’s Laws of Motion. Force A force is a push or pull. An object at rest needs a force to get it moving; a moving object needs a force to.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
Chapter 4 Dynamics: Newton’s Laws of Motion. Units of Chapter 4 Force Newton’s First Law of Motion Mass Newton’s Second Law of Motion Newton’s Third Law.
Concepts for Programming a Rigid Body Physics Engine Part 2 Presented by Scott Hawkins.
ME451 Kinematics and Dynamics of Machine Systems Dynamics of Planar Systems December 9, 2010 Solving Index 3 DAEs using Newmark Method © Dan Negrut, 2010.
Advanced Computer Graphics Rigid Body Simulation
Dynamics: Newton’s Laws of Motion
3.7. Other Game Physics Approaches
Chapter 4 Dynamics: Newton’s Laws of Motion
Physics: Principles with Applications, 6th edition
Handling of Resting Contact
Physics: Principles with Applications, 6th edition
Computer Animation Algorithms and Techniques
Chapter 4 Dynamics: Newton’s Laws of Motion
Physics: Principles with Applications, 6th edition
Presentation transcript:

1cs533d-winter-2005 Notes  Assignment 2 instability - don’t worry about it right now  Please read D. Baraff, “Fast contact force computation for nonpenetrating rigid bodies”, SIGGRAPH ‘94 D. Baraff, “Linear-time dynamics using Lagrange multipliers”, SIGGRAPH ’96

2cs533d-winter-2005 Rigid Collision Algorithms  Use the same collision response algorithm as with particles Identify colliding points as perhaps the deepest penetrating points, or the first points to collide Make sure they are colliding, not separating!  Problem: multiple contact points Fixing one at a time can cause rattling. Can fix by being more gentle in resolving contacts - negative coefficient of restitution  Problem: multiple collisions (stacks) Fixing one penetration causes others Solve either by resolving simultaneously or enforcing order of resolution

3cs533d-winter-2005 Stacking  Guendelman et al. “shock propagation”  After applying contact impulses (but penetrations remain) Form contact graph: “who is resting on whom”  Check new position of each object against the other objects’ old positions --- any penetrations indicate a directed edge Find “bottom-up” ordering: order fixed objects such as the ground first, then follow edges  Union loops into a single group Fix penetrations in order, freezing objects after they are fixed  Slight improvement: combine objects into a single composite rigid body rather than simply freezing

4cs533d-winter-2005 Stacking continued  Advantages: Simple, fast  Problems: Overly stable sometimes Doesn’t really help with loops  To resolve problems, need to really solve the global contact problem (not just at single contact points)

5cs533d-winter-2005 The Contact Problem  See e.g. Baraff “Fast contact force computation…”, SIGGRAPH’94  Identify all contact points Where bodies are close enough  For each contact point, find relative velocity as a (linear) function of contact impulses Just as we did for pairs  Frictionless contact problem: Find normal contact impulses that cause normal 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)

6cs533d-winter-2005 Frictional Contact Problem  Include tangential contact impulses Either relative velocity is zero (static friction) or tangential impulse is on the friction cone By approximating the friction cone with planar facets, can reduce to LCP again  Note: modeling issue - the closer to the true friction cone you get, the more variables and equations in the LCP

7cs533d-winter-2005 Constrained Dynamics

8cs533d-winter-2005 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

9cs533d-winter-2005 Three major approaches  “Soft” constraint forces (penalty terms) Like repulsions  Solve explicitly for unknown constraint forces (lagrange multipliers) Closely related: projection methods  Solve in terms of reduced number of degrees of freedom (generalized coordinates)

10cs533d-winter-2005 Equality constraints  Generally, want motion to satisfy C(x,v)=0 C is a vector of constraints  Inequalities also possible - C(x,v)≥0 - but let’s ignore for now Generalizes notion of contact forces Also can do things like joint limits, etc. Generally need to solve with heavy-duty optimization, may run into NP-hard problems One approach: figure out or guess which constraints are “active” (equalities) and just do regular equality constraints, maybe iterating

11cs533d-winter-2005 Soft Constraints  First assume C=C(x) No velocity dependence  We won’t exactly satisfy constraint, but will add some force to not stray too far Just like repulsion forces for contact/collision  First try: define a potential energy minimized when C(x)=0 C(x) might already fit the bill, if not use Just like hyper-elasticity!

12cs533d-winter-2005 Potential force  We’ll use the gradient of the potential as a force:  This is just a generalized spring pulling the system back to constraint  But what do undamped springs do?

13cs533d-winter-2005 Rayleigh Damping  Need to add damping force that doesn’t damp valid motion of the system  Rayleigh damping: Damping force proportional to the negative rate of change of C(x)  No damping valid motions that don’t change C(x) Damping force parallel to elastic force  This is exactly what we want to damp

14cs533d-winter-2005 Issues  Need to pick K and D Don’t want oscillation - critical damping If K and D are very large, could be expensive (especially if C is nonlinear) If K and D are too small, constraint will be grossly violated  Big issue: the more the applied forces try to violate constraint, the more it is violated… Ideally want K and D to be a function of the applied forces

15cs533d-winter-2005 Pseudo-time Stepping  Alternative: simulate all the applied force dynamics for a time step  Then simulate soft constraints in pseudo-time No other forces at work, just the constraints “Real” time is not advanced Keep going until at equilibrium 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)

16cs533d-winter-2005 Issues  Still can be slow Particularly if there are lots of adjoining constraints  Could be improved with implicit time steps Get to equilibrium as fast as possible…  This will come up again…

17cs533d-winter-2005 Constraint forces  Idea: constraints will be satisfied because F total =F applied +F constraint  Have to decide on form for F constraint  [example: y=0]  We have too much freedom…  Need to specify the problem better

18cs533d-winter-2005 Virtual work  Assume for now C=C(x)  Require that all the (real) work done in the system is by the applied forces The constraint forces do no work  Work is F c ∆x So pick the constraint forces to be perpendicular to all valid velocities The valid velocities are along isocontours of C(x) Perpendicular to them is the gradient:  So we take

19cs533d-winter-2005 What is ?  Say C(x)=0 at start, want it to remain 0  Take derivative:  Take another to get to accelerations  Plug in F=ma, set equal to 0

20cs533d-winter-2005 Finding constraint forces  Rearranging gives:  Plug in the form we chose for constraint force:  Note: SPD matrix!

21cs533d-winter-2005 Modified equations of motion  So can write down (exact) differential equations of motion with constraint force  Could run our standard solvers on it  Problem: drift We make numerical errors, both in the regular dynamics and the constraints!  We’ll just add “stabilization”: additional soft constraint forces to keep us from going too far Don’t worry about K and D in this context! Don’t include them in formula for - this is post-processing to correct drift

22cs533d-winter-2005 Velocity constraints  How do we handle C(v)=0?  Take time derivative as before:  And again apply principle of virtual work just like before:  And end up solving:

23cs533d-winter-2005 J notation  Both from C(x)=0 and two time derivatives, and C(v)=0 and one time derivative, get constraint force equation: (J is for Jacobian)  We assume F c =J T  This gives SPD system for : JM -1 J T =b

24cs533d-winter-2005 Discrete projection method  It’s a little ugly to have to add even more stuff for dealing with drift - and still isn’t exactly on constraint  Instead go to discrete view (treat numerical errors as applied forces too)  After a time step (or a few), calculate constraint impulse to get us back Similar to what we did with collision and contact  Can still have soft or regular constraint forces for better accuracy…

25cs533d-winter-2005 The algorithm  Time integration takes us over ∆t from (x n, v n ) to (x n+1 , v n+1  )  We want to add an impulse v n+1 = v n+1  + M -1 i x n+1 = x n+1  + ∆t M -1 i such that new x and v satisfy constraint: C(x n+1, v n+1 )=0  In general C is nonlinear: difficult to solve But if we’re not too far from constraint, can linearize and still be accurate

26cs533d-winter-2005 The constraint impulse  Plug in changes in x and v:  Using principle of virtual work: where

27cs533d-winter-2005 Projection  We’re solving JM -1 J T =-C Same matrix again - particularly in limit  In case where C is linear, we actually are projecting out part of motion that violates the constraint

28cs533d-winter-2005 Nonlinear C  We can accept we won’t exactly get back to constraint But notice we don’t drift too badly: every time step we do try to get back the entire way  Or we can iterate, just like Newton Keep applying corrective impulses until close enough to satisfying constraint  This is very much like running soft constraint forces in pseudo-time with implicit steps, except now we know exactly the best parameters