CS-184: Computer Graphics

Similar documents
PSE Game Physics. Session (6) Angular momentum, microcollisions, damping. Oliver Meister, Roland Wittmann

Rigid Body Dynamics and Beyond

CS 480/680: GAME ENGINE PROGRAMMING

Thursday Simulation & Unity

Game Physics: Basic Concepts

GAME PHYSICS ENGINE DEVELOPMENT

Lesson Rigid Body Dynamics

particle p = m v F ext = d P = M d v cm dt

GAME PHYSICS (INFOMGP) FINAL EXAM

If the symmetry axes of a uniform symmetric body coincide with the coordinate axes, the products of inertia (Ixy etc.

3-D Kinetics of Rigid Bodies

Theory and Practice of Rotor Dynamics Prof. Dr. Rajiv Tiwari Department of Mechanical Engineering Indian Institute of Technology Guwahati

Lecture 2 - Force Analysis

Rigid body simulation. Once we consider an object with spatial extent, particle system simulation is no longer sufficient

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

The... of a particle is defined as its change in position in some time interval.

7.4 Rigid body simulation*

Lecture 41: Highlights

r CM = ir im i i m i m i v i (2) P = i

Physics Fall Mechanics, Thermodynamics, Waves, Fluids. Lecture 20: Rotational Motion. Slide 20-1

Elementary Mechanics Using Matlab

PHYSICS I RESOURCE SHEET

IMPACT Today s Objectives: In-Class Activities:

2007 Problem Topic Comment 1 Kinematics Position-time equation Kinematics 7 2 Kinematics Velocity-time graph Dynamics 6 3 Kinematics Average velocity

Lecture 35: The Inertia Tensor

Engineering Mechanics Prof. U. S. Dixit Department of Mechanical Engineering Indian Institute of Technology, Guwahati

PLANAR KINETIC EQUATIONS OF MOTION (Section 17.2)

Modeling and Solving Constraints. Erin Catto Blizzard Entertainment

1 Forces. 2 Energy & Work. GS 104, Exam II Review

5/6/2018. Rolling Without Slipping. Rolling Without Slipping. QuickCheck 12.10

PHYSICS 221, FALL 2011 EXAM #2 SOLUTIONS WEDNESDAY, NOVEMBER 2, 2011

Angular Momentum Conservation of Angular Momentum

Ch. 2 The Laws of Motion

The Torsion Pendulum (One or two weights)

Physics 351, Spring 2018, Homework #9. Due at start of class, Friday, March 30, 2018

Simulation in Computer Graphics Elastic Solids. Matthias Teschner

DEVIL PHYSICS THE BADDEST CLASS ON CAMPUS AP PHYSICS

Version A (01) Question. Points

Essential Physics I. Lecture 9:

Particle Systems. CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2017

z F 3 = = = m 1 F 1 m 2 F 2 m 3 - Linear Momentum dp dt F net = d P net = d p 1 dt d p n dt - Conservation of Linear Momentum Δ P = 0

Manipulator Dynamics 2. Instructor: Jacob Rosen Advanced Robotic - MAE 263D - Department of Mechanical & Aerospace Engineering - UCLA

Dynamics. Dynamics of mechanical particle and particle systems (many body systems)

l Every object in a state of uniform motion tends to remain in that state of motion unless an

Torque and Rotation Lecture 7

Final Exam. June 10, 2008, 1:00pm

Modesto Junior College Course Outline of Record PHYS 101

CS229 Programming Assignment 3: Dynamics

Chapter 8 Lecture. Pearson Physics. Rotational Motion and Equilibrium. Prepared by Chris Chiaverina Pearson Education, Inc.

Physics 106a, Caltech 4 December, Lecture 18: Examples on Rigid Body Dynamics. Rotating rectangle. Heavy symmetric top

Chapter 11. Angular Momentum

Conservation of mass. Continuum Mechanics. Conservation of Momentum. Cauchy s Fundamental Postulate. # f body

Problem Set 9: Momentum and Collision Theory. Nov 1 Hour One: Conservation Laws: Momentum and Collision Theory. Reading: YF

APPLICATIONS. CEE 271: Applied Mechanics II, Dynamics Lecture 17: Ch.15, Sec.4 7. IMPACT (Section 15.4) APPLICATIONS (continued) IMPACT READING QUIZ

Scalar product Work Kinetic energy Work energy theorem Potential energy Conservation of energy Power Collisions

Review: control, feedback, etc. Today s topic: state-space models of systems; linearization

Theory & Practice of Rotor Dynamics Prof. Rajiv Tiwari Department of Mechanical Engineering Indian Institute of Technology Guwahati

Chapter 6. Preview. Section 1 Gravity and Motion. Section 2 Newton s Laws of Motion. Section 3 Momentum. Forces and Motion.

GAME PHYSICS SECOND EDITION. дяййтаййг 1 *

Kinetics of Particles: Work and Energy

Chapter 8: Momentum, Impulse, & Collisions. Newton s second law in terms of momentum:

CEE 271: Applied Mechanics II, Dynamics Lecture 17: Ch.15, Sec.2 4

Page 2 (20) Page 3 (12) Page 4 (14) Page 5 (14) Total (60) PHYSICS 11 (Fall 2003) Exam 3. Elementary Physics November 21, 2003 SCORE BOX

Robotics. Dynamics. Marc Toussaint U Stuttgart

Center of Gravity. The location of the center of gravity is defined by: n mgx. APSC 111 Review Page 7

PSE Game Physics. Session (3) Springs, Ropes, Linear Momentum and Rotations. Atanas Atanasov, Philipp Neumann, Martin Schreiber

Visual Interactive Simulation, TDBD24, Spring 2006

Course Name: AP Physics. Team Names: Jon Collins. Velocity Acceleration Displacement

Conservation of Angular Momentum

Wiley Plus. Final Assignment (5) Is Due Today: Before 11 pm!

Lecture 7 - Momentum. A Puzzle... Momentum. Basics (1)

Q: What does angular momentum mean? What is its equation for calculation?

Notes. Multi-Dimensional Plasticity. Yielding. Multi-Dimensional Yield criteria. (so rest state includes plastic strain): #=#(!

Chapter 11. Angular Momentum

CHAPTER 1: PHYSICAL QUANTITIES AMD MEASUREMENT

Rotational & Rigid-Body Mechanics. Lectures 3+4

Projects. Assignments. Plan. Motivational Films. Motivational Film 1/6/09. Dynamics II. Forces, Collisions and Impulse

AP Pd 3 Rotational Dynamics.notebook. May 08, 2014

Kinematics 1D Kinematics 2D Dynamics Work and Energy

Rigid bodies - general theory

PHYSICS. Chapter 12 Lecture FOR SCIENTISTS AND ENGINEERS A STRATEGIC APPROACH 4/E RANDALL D. KNIGHT Pearson Education, Inc.

Physics 218 Lecture 23

Rotational Kinetic Energy

School of Engineering Faculty of Built Environment, Engineering, Technology & Design

Momentum and Collisions

Rotation. I. Kinematics - Angular analogs

Fundamentals Physics

Physics 8 Monday, October 28, 2013

The Calculus of Vec- tors

6. 3D Kinematics DE2-EA 2.1: M4DE. Dr Connor Myant

Chapter 8- Rotational Motion

Raymond A. Serway Chris Vuille. Chapter Thirteen. Vibrations and Waves

Mechanics. Time (s) Distance (m) Velocity (m/s) Acceleration (m/s 2 ) = + displacement/time.

Physics 131: Lecture 22. Today s Agenda

Chapters 5-6. Dynamics: Forces and Newton s Laws of Motion. Applications

Engineering Mechanics Prof. U. S. Dixit Department of Mechanical Engineering Indian Institute of Technology, Guwahati Introduction to vibration

Structural Dynamics Lecture 4. Outline of Lecture 4. Multi-Degree-of-Freedom Systems. Formulation of Equations of Motions. Undamped Eigenvibrations.

Game Physics. Game and Media Technology Master Program - Utrecht University. Dr. Nicolas Pronost

A short review of continuum mechanics

(Refer Slide Time: 00:01:30 min)

Transcription:

CS-184: Computer Graphics Lecture #25: Rigid Body Simulations Tobias Pfaff 537 Soda (Visual Computing Lab) tpfaff@berkeley.edu

Reminder Final project presentations next week!

Game Physics

Types of Materials Particles Weakly interacting particles for fluids Non-interacting particles for visuals Mass-spring Systems Can model elastic ropes, sheets and bodies Simple model, fast Stiffness / discretization difficult to fine tune Stability problems for stiff materials Finite Elements Volume discretization of physical elasticity model More stable and controllable, but complex

Rigidity All materials are elastic to some extent in reality Example: try to model metal bar with high stiffness Will enforce inter object distances Propagate deformation, real behavior in the limit Problem: high stiffness means large forces, time step will be tiny to keep things stable

Observation High stiffness means: vertices should not move w.r.t. each other Effectively removes degrees of freedom from the system Obvious: don t even simulate them in the first place New representation: center of mass and orientation Need equations of motion for both center of mass and orientation

Complex Dynamics Bullet Physics Engine / Blender. Video by Phymec

Overview Rigid bodies in 2D Orientation Integrating rotational motion Angular momentum Impulses Rigid bodies in 3D

Points vs. Rigid Bodies For particles: Position x Velocity v Dynamics: v(t) = dx(t) dt For a rigid body: Position x? Velocity v? a(t) = dv(t) dt

Representation v(t) Reference point on body: center of mass Continuous: x cm = R x (x)dv R (x)dv x(t) Discrete: x cm = P P i m ix i i m i

Representation Center of mass behaves like a mass point with total mass of the body M = X i m i x(t) v(t) x cm = v cm = a cm = P i m ix i M P i m iv i M P i m ia i M

Representation r(t) v(t) Orientation: rotation around center of mass Point coordinates relative to center of mass (body space) Absolute position (world space) x(t) x world = x cm + Rot r(t) (x 0 )

Representation Body space World space x world = x cm + Rot r(t) (x 0 ) x world x 0 x cm = 0 (For convenience, keep center of mass at zero.)

Representation w(t) Previously: linear velocity Now also: angular velocity r(t) v(t) 3 component vector encoding rate of angular change, and axis of rotation x(t) Total velocity of a point: v i = v cm + w cm p 0 w cm p 0 v cm

Orientation & Angular Velocity in 2D Only rotation around z, so w is a scalar E.g. given in radians Velocity of a point is given by: v i = Apply orientation to point with matrix: Rot = wxi,y wx i,x cos sin sin cos

Points vs. Rigid Bodies For particles: Position x Velocity v Dynamics: v(t) = dx(t) dt a(t) = dv(t) dt For a rigid body: Position x Orientation r Linear velocity v Angular velocity w Dynamics:?

Special Case for 2D Same as for point masses, e.g., Euler step: x cm = x cm + hv cm r cm = r cm + hw cm Works only because we have 1 axis of rotation Later on: conserve angular momentum (not angular velocity) How to compute accelerations?

Inertia Tensor in 2D Equivalent to mass: resistance to rotation Is pre-computed for reference state In 2D, using body coordinates: i = X n m n x n x n Example

Inertia Tensor in 2D What does i look like for these shapes? (Assume equal total mass, and same material density.) Or - which shape spins more easily when poked?

Example Figure skating Starts in normal pose Rotation in plane Moment of inertia is reduced by pulling in arms

Rotational Dynamics Mass points are restricted to move perpendicular to their body space position Use cross product for projection Newton s 2nd law: d dt (m iv i )=f i Newton s 2nd law, restricted: x i d dt (m iv i )=x i f i Both sides are vectors parallel to actual axis of rotation

Rotational Dynamics From before Move time derivative For whole body d dt x i d dt (m iv i )=x i f i d dt (x i m i v i )=x i f i X X (x i m i v i )= x i f i i i Rename angular momentum eq. momentum d dt L = q Both sides are still vectors parallel to axis of rotation torque eq. force

Newton s 2nd Law for Rotations Angular momentum: L = X i x i m i v i = Iw Torque q = X i x i f i Angular version of Newton s 2nd law: d dt L = q Compute the change of angular velocity over time, for 2D: w(t + h) =I 1 L(t + h) w(t + h) =w(t)+hq/i

Can has Angular Momentum Conservation? No external forces = no torque - angular momentum is constant d dt L = q Cats still turn around in mid-air just fine

Can has Angular Momentum Conservation?

Points vs. Rigid Bodies For particles: Position x Velocity v Dynamics: v(t) = dx(t) dt a(t) = dv(t) dt For a rigid body: Position x Orientation r Linear velocity v Angular velocity w Angular dynamics: X q(t) = x i f i i w(t + h) =w(h)+hq/i

Simulation Algorithm in 2D Pre-compute: X M x 0 cm i X m i x 0 im i /M t F X i X i x i f i f i External forces i x i x 0 i x 0 cm X i m i x i x i Initialize: i x cm v cm r w x cm + hv cm v cm + hf/m r + hw w + ht/i Euler step x cm, v cm r, L w L/i x world i x cm + Rot r x i World position vi world v cm + w x i

Collisions What happens during a collision? Body is deformed Elasticity: Deformation energy is released, body bounces back Plasticity: Deformation energy is dissipated, body stays deformed Different materials have different elasticity and plasticity Usually happens in a fraction of a second Hard to simulate explicitly

Collision Detection Simple case Simulate boxes Check corner points (or points on surface) For target body, undo translation & rotation Test points for intervals In practice: polgygon intersections, acceleration structures

Classifying Contacts Velocity of xi on rigid body: v i = v cm + w x i Retrieve collision normal Compute relative velocity: 3 Cases: v rel = n (v A v B ) colliding sliding Colliding contact v rel < 0 n separating Separating (easy!) v rel > 0 Resting contact v rel =0

Collision Response Compute instantaneous effect of material deformation Separate handling of linear motion angular motion Make sure the object stop flying into each other...

Impulses We could try to model instantaneous deformation with forces, e.g.: Measure penetration distance d Apply force proportional to d Hope that it keeps objects from moving into each other... Not a good idea: No guarantees Can cause large forces

Impulses collision interval t no force no force

Soft Collision Force Velocity t

Harder Collision Force Velocity t

Very Hard Collision Force Velocity t

Rigid Body Collision Impulsive force Velocity t=0, infinite force

Impulses Fully rigid body would exert infinite elastic force over zero time interval Immediate velocity change, units like momentum (not force!) To avoid singularity, apply impulses that change velocity directly Use: J = m v (no time step!) Instead of: v = hf/m

So much for 2D...

Rigid Bodies - Moving to 3D Positions are easy: 1 new axis Existing integration methods fully hold Orientations are quite different Rotation matrices Quaternions (most game engines use this) Exp. matrices

Angular Velocity in 3D So far, angular velocity was only the z component of the angular velocity vector In 3D, same principle for general vector w Along axis of rotation Speed of rotation is given by norm of w But now all three components are used...

Inertia Tensor in 3D Continuos case: I = Z V (x) x 2 xx T dv (Fun exercise: calculate for a few basic shapes) Discrete: mass-weighted co-variance matrix of body coordinate positions: X C = X n m n x n x T n I = Id trace(c) C has to be invertible! No zero eigenvalues...

Example - Axes of Rotation Inertia tensor for box has 3 eigenvalues Largest & smallest one are stable Intermediate one leads to unstable rotation Same: ellipse with axes A > B > C

Updating the Inertia Tensor In 3D, the inertia tensor depends on the current orientation of the body! Luckily, we can compute this from the initial one I current = Rot r I 0 Rot 1 r = Rot r I 0 Rot T r Why? Used as L = Iw > Transform angular velocity into initial orientation, multiply with inertia tensor, transform back Same holds for inverse (used in practice)

Angular Motion in 3D Small but important detail: it s not the angular velocity that is constant without forces, but the angular momentum Angular velocity can change without external forces and without temporal change of angular momentum Happens when: Body has rotational velocity axis that is not a symmetry axis for body (i.e. angular momentum and angular velocity point in different directions)

Newton s 2nd Law for Rotations Given forces we can now compute the change of angular velocity over time: d dt L = q Xw = I 1 L L(t + h) =L(t)+hq I 1 = Rot r I 1 0 Rot T r w(t + h) =I 1 L(t + h) Note: integrates angular momentum over time, not angular velocity!

Points vs. Rigid Bodies (3D) For particles: Position x Velocity v Dynamics: v(t) = dx(t) dt a(t) = dv(t) dt For a rigid body: Position x Orientation r Linear velocity v Angular velocity w Angular dynamics: q(t) = X x i f i i L(t + h) =L(t)+hq w(t + h) =I 1 L(t + h)

Simulation Algorithm 3D Pre-compute: X M x 0 cm i X i m i x 0 im i /M x i x 0 i x 0 cm X m i... I 1 Initialize: i x cm, v cm, r, L I 1 Rot r I 1 0 Rot T r w I 1 L F q x cm v cm X i X i f i x i f i x cm + hv cm v cm + hf/m External forces r r + hw Depends on L L + hq I 1 Rot r I 1 0 Rot T r w I 1 L Euler step representation! x world i x cm + Rot r x i World position vi world v cm + w x i

Integrating the Orientation Example: Quaternion General question - what is time derivative of orientation given as quaternion? It turns out: dr dt = 1 2 0 w r; r =(s, xi, yj, zk) Thus, integrate with: 0 w r 0 = r + h/2 r

How well does this work? Bullet Physics Engine / Blender. Video by Phymec

Rigidity Bullet Physics Engine / Blender. Video by Phymec

How well does this work? Collision handling is problematic! - Stacking / Resting contact is hard Tonge et al. 2012 Mass splitting for jitterfree RB simulations

How well does this work? Resting contact Impulse v > 0 v < 0 v > 0

References David Baraff s SIGGRAPH course http://www.cs.cmu.edu/~baraff/sigcourse David Eberly: Game Physics (book) www.geometrictools.com Chris Hecker: Rigid Body Dynamics chrishecker.com/rigid_body_dynamics