1 / 46

Animation CS 551 / 651

Animation CS 551 / 651. Rigid-body Simulation Mirtich Paper. Mirtich, 2000. Assignment 1 Rigid-body Simulator. Email sent to class on Saturday Due: Monday, Sept 29 th at 5:00 p.m. Wednesday’s Class. I’ll be out of town Hopefully not trapped on a runway someplace

kenna
Télécharger la présentation

Animation CS 551 / 651

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. AnimationCS 551 / 651 Rigid-body SimulationMirtich Paper Mirtich, 2000

  2. Assignment 1Rigid-body Simulator • Email sent to class on Saturday • Due: Monday, Sept 29th at 5:00 p.m.

  3. Wednesday’s Class • I’ll be out of town • Hopefully not trapped on a runway someplace • Julian will be the projectionist • “Extras” from computer graphics DVDs

  4. Rotation in 3-D • Looks similar to 2-D Case • Specify arbitrray rotation as three angles • One per coordinate axis • Called an Euler Angle • Common representation • But order of rotations matters

  5. Rotation Matrices • Orthonormal matrix: • orthogonal (columns/rows linearly independent) • normalized (columns/rows length of 1) • The inverse of an orthogonal matrix is just its transpose:

  6. Rotation Matrix • 9 DOFs must reduce to 3 • Rows must be unit length (-3 DOFs) • Rows must be orthogonal (-3 DOFs) • Drifting matrices is very bad • Numerical errors results when trying to gradually rotate matrix by adding derivatives • Resulting matrix may scale / shear • Gram-Schmidt algorithm will re-orthogonalize your matrix • Difficult to interpolate between matrices

  7. Angular Velocity Vector • In 2D we just had w, a scalar • In 3D we need a vector, call it w

  8. Calculating change in r • Computing change in r requires cross product • Cool matrix math does the same • Rotationmatrix

  9. Kinematics for point on moving body Centripetal acceleration term!

  10. 3D Dynamics • Very similar to 2D • Angular momentum becomes a vector: r x p • r = vector from origin to point • p = linear momentum at point • It measures the amount of momentum that is perpendicular to r

  11. Total angular momentum linear momentum substitute

  12. Inertia Tensor • Use the tilde operator

  13. Pieces come together • Linear terms are identical to their 2-D analogs • Angular terms follow same pattern • Orient the default inertial matrix to align with current orientation • Compute angular velocity by multiplying angular momentum by inertial matrix • Use angular velocity to compute change in orientation

  14. Timewarp Rigid Body Simulation • Presented at SIGGRAPH 2000 • Brian Mirtich • MERL, A Mitsubishi Electric Research Lab (Cambridge, MA)

  15. Big Idea • Simulations are slow • What part is so slow??? • Simulations are discontinuous • What’s the source of discontinuities? • But not discontinuities are unpredictable and only affect parts of simulation

  16. General rigid body simulator • Nontrivial geometries • All pairs can potentially collide • Second-order physics equations of motion • Could be deployed on multiprocessor (simulation farm)

  17. Discontinuities • When do they occur? • When the state or equations of motion change • Collisions • New contacts • Changing from rolling to sliding dynamics • Particle simulation example • Computing state of particle arbitrary time in the future is easy … f(t)

  18. Discontinuities • What trouble do they cause? • Integrator must be stopped and restarted with new state, forces, or equations • Main control loop constantly checking for discontinuities so appropriate handling takes place • Two common methods • Retroactive detection and conservative advancement

  19. Retroactive Detection • Catch discontinuities after the happen • Detect when two objects go through one another • Use root finding to detect exact time of impact • Roll back the clock to time of impact • All objects or just some? • Continue simulation only up to impact

  20. Retroactive Detection • What’s bad about this algorithm? • You’re repeating work • Simulate, back up, simulate again • Additional collisions may be encountered during subsequent smaller simulation timesteps (and others won’t take place after all) • Synchronization requires repeated simulation of all objects if they are involved in collision or not • Doesn’t scale well in number of discontinuities

  21. Conservative Advancement • Don’t simulate past discontinuities • Heuristics predict future discontinuities and impending events are stored in a priority queue • Upon approaching time of event in priority queue, take small steps

  22. Conservative Advancement • What’s bad about this method? • Conservative, but slow as number of discontinuities increases • All simulated objects move forward at small timestep • Difficult to compute tight bounds on discontinuities

  23. Timewarp Algorithm • Derived from a 1985 paper by David Jefferson • Be optimistic • Each object simulates as quickly as possible • Be responsive • If an object is informed of an event in the past, it must reset its state to that previous time

  24. Timewarp • Multiple processes • Each models part of the system • Each has its own “time” called Local Virtual Time (LVT) • Process clocks are not synchronized

  25. Timewarp • Message Passing • When a process experiences an event • message is sent to all processes with timestamp = LVT of sending process • When a process receives a message • If (message time > recipient’s LVT) • Message is placed on time-based queue • Process will advance clock to next event on queue • What if (message time < recipient’s LVT)?

  26. Rollback • Occurs when a recipient has simulated “past” the time at which another process has generated an event • Go back in time (how?) • Put all processed events back on queue • “unsend” events sent to other processes • For each message sent, an antimessage is stored on a queue that can be easily flushed

  27. Rollback • Overhead • Keeping track of previous states • Keeping track of processed events • Keeping track of submitted events • Global Virtual Time (GVT) • The minimum of all LVTs • All states before GVT can be purged • Monotonically increasing

  28. Timewarp for rigid body sim • Every simulated body is a process • The state = position & velocity • Global event queue stores all bodies’ events • Event = timestamp and list of affected bodies • Main loop • Pull front item from event queue • Simulate affected bodies to that time • This can be put on a uniprocessor

  29. Types of events • Collision Check • Between pairs of bodies • Group Check • Collision check for contacting bodies • Splitting groups of bodies when no longer contacting • Redraw • At every new rendered frame, copy positions to buffer • Callback • User-defined functions to be executed

  30. Collisions • Safe-time • Each body keeps track of the last time it was known not to be in collision with other bodies • This helps limit how far a body must roll back upon detection of a collision • Safe-time is included in collision/group check events • Upon collision checking, safe-time is updated

  31. Collisions (A collides with B) • Vertical connections join post-collision states • Gray states are new states after A-B collision check event

  32. Collision (between A and B)

  33. Multibodies • Jointed (articulated) bodies like a human • All bodies must be treated in unison • Easily integrated into their system

  34. Contact Groups • Bodies in persistent contact • Simulated as a unit • Membership of group is dynamic • Complicated state keeping so, upon rollback, a body can be detached from its group and simulated

  35. Collision checks • Active Pairs • The set of all bodies that must be checked for potential collisions • We want to keep this set small

  36. Active Pairs • Looking for collisions • Each body has an axis-aligned bounding box • For each timestep between GVT and LVT • Record location of bounding box • Compute bounding box (swept volume) of all bounding boxes over time • Using six heaps for max/min {x, y, z} • GVT increment causes volume to shrink

  37. Looking for collisions • If swept volumes do not intersect • Collision free between [GVT, tmin (A, B)] • Depending on LVT of A and B • A and B not an active pair

  38. Looking for collisions • If newest timestep for B causes overlapping swept volume with A • Collision check at time tmin (A, B) • B, before integration (last known free time) • Rollback will resolve collisions

  39. Results • Applications • Atoms: 200 spheres and 100 water molecules in divided box • Cars: 4 multibody vehicles and 400 pendula • Robots: 20 eight-link manipulators throwing blocks • Avalanche: 300 rocks tumbling down mountainside

  40. Results • Note average integration step vs. time between discontinuities

  41. Results • Atoms for 2 seconds • Average integration step

  42. Results • Atoms for 2 seconds • Total simulation time

  43. Euler Angles • (qx, qy, qz) = RzRyRx • Rotate qx degrees about x-axis • Rotate qy degrees about y-axis • Rotate qz degrees about z-axis • Axis order is not defined • (y, z, x), (x, z, y), (z, y, x)… are all legal • Pick one

  44. Euler Angles • Rotations not uniquely defined • ex: (z, x, y) = (90, 45, 45) = (45, 0, -45)takes positive x-axis to (1, 1, 1) • cartesian coordinates are independent of one another, but Euler angles are not • Gimbal Lock • Term derived from mechanical problem that arises in gimbal mechanism that supports a compass or a gyro

  45. Gimbal Lock

  46. Gimbal Lock • Occurs when two axes are aligned • Second and third rotations have effect of transforming earlier rotations • ex: Rot x, Rot y, Rot z • If Rot y = 90 degrees, Rot z == -Rot x

More Related