UNC Chapel Hill M. C. Lin Reading Assignment & References D. Baraff and A. Witkin, “Physically Based Modeling: Principles and Practice,” Course Notes,

Slides:



Advertisements
Similar presentations
Collision Response Jim Van Verth
Advertisements

COMP Robotics: An Introduction
Beams and Frames.
Chapter 15: Kinetics of a Particle: Impulse and MomentumTextbook: Engineering Mechanics- STATICS and DYNAMICS- 11th Ed., R. C. Hibbeler and A. Gupta Course.
Continuous Collision Detection: Progress and Challenges Gino van den Bergen dtecta
Color Problem Have a black-box function that returns a bright color in 24-bit RGB Want a paler version of the output What to do?
1Notes  Demetri Terzopoulos talk: Thursday, 4pm Dempster 310.
Ch. 7: Dynamics.
Game Physics Chris Miles. The Goal To learn how to create game objects with realistic physics models To learn how to simulate aspects of reality in order.
UNC Chapel Hill M. C. Lin References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics.
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.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Continuous Collision Detection David Knott COMP 259 class presentation.
Mechanics of Rigid Bodies
Rigid Body Dynamics (I) COMP259 March 28, 2006 Nico Galoppo von Borries.
UNC Chapel Hill M. C. Lin Review Particle Dynamics (see transparencies in class)
Introduction to ROBOTICS
Computer graphics & visualization Rigid Body Simulation.
Linear Momentum and Collisions
Computer graphics & visualization Collision Detection – Narrow Phase.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Physically Based Animation.
Spring Topic Outline for Physics 1 Spring 2011.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Game Physics – Part IV Moving to 3D
Central Force Motion Chapter 8
UNC Chapel Hill M. C. Lin Rigid Body Dynamics (I) An Introduction.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Collision handling: detection and response
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
Sect 5.4: Eigenvalues of I & Principal Axis Transformation
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Collisions & Contact.
Math / Physics 101 GAM 376 Robin Burke Fall 2006.
Rigid Body Motion. Game Physics “Linear physics”– physics of points –particle systems, ballistic motion… –key simplification: no orientation “Rotational.
Questions From Reading Activity? Big Idea(s):  The interactions of an object with other objects can be described by forces.  Interactions between.
Concepts for Programming a Rigid Body Physics Engine Part 1 Presented by Scott Hawkins.
Lecture Fall 2001 Physically Based Animation Ordinary Differential Equations Particle Dynamics Rigid-Body Dynamics Collisions.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
Chapter 11 Angular Momentum. Angular momentum plays a key role in rotational dynamics. There is a principle of conservation of angular momentum.  In.
Dynamics of Linked Hierarchies
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Rigid Body Dynamics CSE169: Computer Animation
FROM PARTICLE TO RIGID BODY.
Rick Parent - CIS682 Rigid Body Dynamics simulate basic physics of an object subject to forces Keyframing can be tedious - especially to get ‘realism’
A Fast Algorithm for Incremental Distance Calculation Ming C. Lin and John F. Canny University of California, Berkeley 1991 Original slides by Adit Koolwal.
Dynamics. Motion with Regard to Mass Particle Dynamics Mass concentrated in point Newton’s Equation Governs Motion f = M x.
A Fast Algorithm for Incremental Distance Calculation Ming C. Lin & John Canny University of California, Berkeley 1991 Presentation by Adit Koolwal.
Honours Graphics 2008 Session 9. Today’s focus Physics in graphics Understanding:
Fundamentals of Computer Animation Rigid Body Simulation (1)
1 Angular Momentum Chapter 11 © 2012, 2016 A. Dzyubenko © 2004, 2012 Brooks/Cole © 2004, 2012 Brooks/Cole Phys 221
Advanced Computer Graphics Rigid Body Simulation
ECE 383 / ME 442 Fall 2015 Kris Hauser
Physically-Based Motion Synthesis in Computer Graphics
Manipulator Dynamics 1 Instructor: Jacob Rosen
PHYS 1443 – Section 003 Lecture #18
Lecture Rigid Body Dynamics.
References Additional lecture notes for 2/18/02.
Handling of Resting Contact
Review Particle Dynamics (see transparencies in class) UNC Chapel Hill
Devil physics The baddest class on campus AP Physics
Manipulator Dynamics 2 Instructor: Jacob Rosen
Review ODE Basics Particle Dynamics (see transparencies in class)
References Collision Detection between Geometric Models: A Survey, by M. Lin and S. Gottschalk, Proc. of IMA Conference on Mathematics of Surfaces 1998.
Review ODE Basics Particle Dynamics (see transparencies in class)
Rigid Body Dynamics (unconstrained)
Computer Animation Algorithms and Techniques
Selected Problems in Dynamics: Stability of a Spinning Body -and- Derivation of the Lagrange Points John F. Fay June 24, 2014.
Reading Assignment & References
Review ODE Basics Particle Dynamics (see transparencies in class)
Presentation transcript:

UNC Chapel Hill M. C. Lin Reading Assignment & References D. Baraff and A. Witkin, “Physically Based Modeling: Principles and Practice,” Course Notes, SIGGRAPH B. Mirtich, “Fast and Accurate Computation of Polyhedral Mass Properties,” Journal of Graphics Tools, volume 1, number 2, D. Baraff, “Dynamic Simulation of Non-Penetrating Rigid Bodies”, Ph.D. thesis, Cornell University, B. Mirtich and J. Canny, “Impulse-based Simulation of Rigid Bodies,” in Proceedings of 1995 Symposium on Interactive 3D Graphics, April B. Mirtich, “Impulse-based Dynamic Simulation of Rigid Body Systems,” Ph.D. thesis, University of California, Berkeley, December, B. Mirtich, “Hybrid Simulation: Combining Constraints and Impulses,” in Proceedings of First Workshop on Simulation and Interaction in Virtual Environments, July 1995.

UNC Chapel Hill M. C. Lin Algorithm Overview 0 Initialize(); 1 for t = 0; t < t f ; t += h do 2Read_State_From_Bodies(S); 3Compute_Time_Step(S,t,h); 4Compute_New_Body_States(S,t,h); 5Write_State_To_Bodies(S); 6Zero_Forces(); 7Apply_Env_Forces(); 8Apply_BB_Forces();

UNC Chapel Hill M. C. Lin Outline Rigid Body Preliminaries –Coordinate system, velocity, acceleration, and inertia State and Evolution Quaternions Collision Detection and Contact Determination Colliding Contact Response

UNC Chapel Hill M. C. Lin Coordinate Systems Body Space (Local Coordinate System) –bodies are specified relative to this system –center of mass is the origin (for convenience) World Space –bodies are transformed to this common system: p(t) = R(t) p 0 + x(t) –R(t) represents the orientation

UNC Chapel Hill M. C. Lin Coordinate Systems

UNC Chapel Hill M. C. Lin Velocities How do x(t) and R(t) change over time? v(t) = dx(t)/dt Let  (t) be the angular velocity vector –Direction is the axis of rotation –Magnitude is the angular velocity about the axis Then

UNC Chapel Hill M. C. Lin Velocities

UNC Chapel Hill M. C. Lin Angular Velocities

UNC Chapel Hill M. C. Lin Accelerations How do v(t) and dR(t)/dt change over time? First we need some more machinery –Inertia Tensor –Forces and Torques –Momentums Actually formulate in terms of momentum derivatives instead of velocity derivatives

UNC Chapel Hill M. C. Lin Inertia Tensor 3x3 matrix describing how the shape and mass distribution of the body affects the relationship between the angular velocity and the angular momentum I(t) Analogous to mass – rotational mass We actually want the inverse I -1 (t)

UNC Chapel Hill M. C. Lin Inertia Tensor Ixx = Ixy = Iyx = Iyy =Izz = Iyz = Izy = Ixz = Izx =

UNC Chapel Hill M. C. Lin Inertia Tensor Compute I in body space I body and then transformed to world space as required –I vary in World Space, but I body is constant in body space for the entire simulation –Transformation only depends on R(t) -- I(t) is translation invariant I(t)= R(t) I body R -1 (t)= R(t) I body R T (t) I -1 (t)= R(t) I body -1 R -1 (t)= R(t) I body -1 R T (t)

UNC Chapel Hill M. C. Lin Computing I body -1 There exists an orientation in body space which causes I xy, I xz, I yz to all vanish –increased efficiency and trivial inverse Point sampling within the bounding box Projection and evaluation of Greene’s thm. –Code implementing this method exists –Refer to Mirtich’s paper at

UNC Chapel Hill M. C. Lin Approximation w/ Point Sampling Pros: Simple, fairly accurate, no B-rep needed. Cons: Expensive, requires volume test.

UNC Chapel Hill M. C. Lin Use of Green’s Theorem Pros: Simple, exact, no volumes needed. Cons: Requires boundary representation.

UNC Chapel Hill M. C. Lin Forces and Torques Environment and contacts tell us what forces are applied to a body: F(t) =  F i (t)  (t) =  ( r i (t) x F i (t) ) where r i (t) is the vector from the center of mass to the point on surface of the object that the force is applied at, r i (t) = p i - x(t)

UNC Chapel Hill M. C. Lin Momentums Linear momentum –P(t) = m v(t) –dP(t)/dt = m a(t) = F(t) Angular Momentum –L(t) = I(t)  (t) –  (t) = I(t) -1 L(t) –It can be shown that dL(t)/dt =  (t)

UNC Chapel Hill M. C. Lin Outline Rigid Body Preliminaries State and Evolution –Variables and derivatives Quaternions Collision Detection and Contact Determination Colliding Contact Response

UNC Chapel Hill M. C. Lin Rigid Body Dynamics

UNC Chapel Hill M. C. Lin State of a Body Y(t) = ( x(t), R(t), P(t), L(t) ) –We use P(t) and L(t) because of conservation From Y(t) certain quantities are computed –I -1 (t) = R(t) I body -1 R T (t) –v(t) = P(t) / M –ω(t) = I -1 (t) L(t) d Y(t) / dt = ( v(t), dR(t)/dt, F(t),  (t) ) d(x(t),R(t),P(t),L(t))/dt =(v(t), dR(t)/dt, F(t),  (t))

UNC Chapel Hill M. C. Lin New State of a Body We cannot compute the state of a body at all times but must be content with a finite number of discrete time points Assume that we are given the initial state of all the bodies at the starting time t 0, use ODE solving techniques to get the new state at t 1 and so on.

UNC Chapel Hill M. C. Lin Outline Rigid Body Preliminaries State and Evolution Quaternions –Merits, drift, and re-normalization Collision Detection and Contact Determination Colliding Contact Response

UNC Chapel Hill M. C. Lin Unit Quaternion Merits A rotation in 3-space involves 3 DOF Rotation matrices describe a rotation using 9 parameters Unit quaternions can do it with 4 Rotation matrices buildup error faster and more severely than unit quaternions Drift is easier to fix with quaternions –renormalize

UNC Chapel Hill M. C. Lin Unit Quaternion Definition [s,v] -- s is a scalar, v is vector A rotation of θ about a unit axis u can be represented by the unit quaternion: [cos(θ/2), sin(θ /2) * u] || [s,v] || = 1 -- the length is taken to be the Euclidean distance treating [s,v] as a 4-tuple or a vector in 4-space

UNC Chapel Hill M. C. Lin Unit Quaternion Operations Multiplication is given by: dq(t)/dt = [0, w(t)/2]q(t) R =

UNC Chapel Hill M. C. Lin Unit Quaternion Usage To use quaternions instead of rotation matrices, just substitute them into the state as the orientation (save 5 variables) d (x(t), q(t), P(t), L(t) ) / dt = ( v(t), [0,ω(t)/2]q(t), F(t),  (t) ) = ( P(t)/m, [0, I -1 (t)L(t)/2]q(t), F(t),  (t) ) where I -1 (t) = (q(t).R) I body -1 (q(t).R T )

UNC Chapel Hill M. C. Lin Outline Rigid Body Preliminaries State and Evolution Quaternions Collision Detection and Contact Determination –Intersection testing, bisection, and nearest features Colliding Contact Response

UNC Chapel Hill M. C. Lin Algorithm Overview 0 Initialize(); 1 for t = 0; t < tf; t += h do 2Read_State_From_Bodies(S); 3Compute_Time_Step(S,t,h); 4Compute_New_Body_States(S,t,h); 5Write_State_To_Bodies(S); 6Zero_Forces(); 7Apply_Env_Forces(); 8Apply_BB_Forces();

UNC Chapel Hill M. C. Lin Collision Detection and Contact Determination Discreteness of a simulation prohibits the computation of a state producing exact touching We wish to compute when two bodies are “close enough” and then apply contact forces This can be quite a sticky issue. –Are bodies allowed to be penetrating when the forces are applied? –What if contact region is larger than a single point? –Did we miss a collision?

UNC Chapel Hill M. C. Lin Collision Detection and Contact Determination Response parameters can be derived from the state and from the identity of the contacting features Define two primitives that we use to figure out body-body response parameters –Distance(A,B) (cheaper) –Contacts(A,B) (more expensive)

UNC Chapel Hill M. C. Lin Distance(A,B) Returns a value which is the minimum distance between two bodies Approximate may be ok Negative if the bodies intersect Convex polyhedra –Lin-Canny and GJK -- 2 classes of algorithms Non-convex polyhedra –much more useful but hard to get distance fast –PQP/RAPID/SWIFT++

UNC Chapel Hill M. C. Lin Contacts(A,B) Returns the set of features that are nearest for disjoint bodies or intersecting for penetrating bodies Convex polyhedra –LC & GJK give the nearest features as a bi- product of their computation – only a single pair. Others that are equally distant may not be returned. Non-convex polyhedra –much more useful but much harder problem especially contact determination for disjoint bodies –Convex decomposition

UNC Chapel Hill M. C. Lin Compute_Time_Step(S,t,h) Let’s recall a particle colliding with a plane

UNC Chapel Hill M. C. Lin Compute_Time_Step(S,t,h) We wish to compute t c to some tolerance

UNC Chapel Hill M. C. Lin Compute_Time_Step(S,t,h) A common method is to use bisection search until the distance is positive but less than the tolerance This can be improved by using the ratio (disjoint distance) : (disjoint distance + penetration depth) to figure out the new time to try -- faster convergence

UNC Chapel Hill M. C. Lin Compute_Time_Step(S,t,h) 0 for each pair of bodies (A,B) do 1Compute_New_Body_States(Scopy, t, H); 2hs(A,B) = H; // H is the target timestep 3if Distance(A,B) < 0 then 4 try_h = H/2; try_t = t + try_h; 5 while TRUE do 6Compute_New_Body_States(Scopy, t, try_t - t); 7if Distance(A,B) < 0 then 8try_h /= 2; try_t -= try_h; 9else if Distance(A,B) <  then 10break; 11else 12try_h /= 2; try_t += try_h; 13 hs(A,B) = try_t – t; 14 h = min( hs );

UNC Chapel Hill M. C. Lin Penalty Methods If Compute_Time_Step does not affect the time step (h) then we have a simulation based on penalty methods –The objects are allowed to intersect and their penetration depth is used to compute a spring constant which forces them apart

UNC Chapel Hill M. C. Lin Local Apply_BB_Forces() Local contact force computation 0 for each pair of bodies (A,B) do 1if Distance(A,B) <  then 2Cs = Contacts(A,B); 3Apply_Impulses(A,B,Cs);

UNC Chapel Hill M. C. Lin Global Apply_BB_Forces() Global contact force computation 0 for each pair of bodies (A,B) do 1if Distance(A,B) <  then 2Flag_Pair(A,B); 3 Solve For_Forces(flagged pairs); 4 Apply_Forces(flagged pairs);

UNC Chapel Hill M. C. Lin Outline Rigid Body Preliminaries State and Evolution Quaternions Collision Detection and Contact Determination Colliding Contact Response –Normal vector, restitution, and force application

UNC Chapel Hill M. C. Lin Colliding Contact Response Assumptions: –Convex bodies –Non-penetrating –Non-degenerate configuration edge-edge or vertex-face appropriate set of rules can handle the others Need a contact unit normal vector –Face-vertex case: use the normal of the face –Edge-edge case: use the cross-product of the direction vectors of the two edges

UNC Chapel Hill M. C. Lin Colliding Contact Response Point velocities at the nearest points: Relative contact normal velocity:

UNC Chapel Hill M. C. Lin Colliding Contact Response If v rel > 0 then –the bodies are separating and we don’t compute anything Else –the bodies are colliding and we must apply an impulse to keep them from penetrating –The impulse is in the normal direction:

UNC Chapel Hill M. C. Lin Colliding Contact Response We will use the empirical law of frictionless collisions: –Coefficient of restitution є [0,1] є = 0 -- bodies stick together є = 1 – loss-less rebound After some manipulation of equations...

UNC Chapel Hill M. C. Lin Apply_BB_Forces() For colliding contact, the computation can be local 0 for each pair of bodies (A,B) do 1 if Distance(A,B) <  then 2Cs = Contacts(A,B); 3Apply_Impulses(A,B,Cs);

UNC Chapel Hill M. C. Lin Apply_Impulses(A,B,Cs) The impulse is an instantaneous force – it changes the velocities of the bodies instantaneously: Δv = J / M 0 for each contact in Cs do 1 Compute n 2 Compute j 3 P(A) += J 4 L(A) += (p - x(t)) x J 5 P(B) -= J 6 L(B) -= (p - x(t)) x J