University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.

Slides:



Advertisements
Similar presentations
AP Physics C Mechanics Review.
Advertisements

Real-Time Game Physics
Kinetics of Particles Impulse and Momentum.
Net Force.
Beams and Frames.
Physics Montwood High School R. Casao
Dynamics of Rotational Motion
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  Demetri Terzopoulos talk: Thursday, 4pm Dempster 310.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
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 S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
Center of Mass and Linear Momentum
Particle Systems Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
UNC Chapel Hill M. C. Lin Review Particle Dynamics (see transparencies in class)
Computer graphics & visualization Rigid Body Simulation.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology 3D Engines and Scene Graphs Spring 2012.
CS 4730 Physical Simulation CS 4730 – Computer Game Design.
Spring Topic Outline for Physics 1 Spring 2011.
Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
CS559: Computer Graphics Lecture 38: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington.
Molecular Dynamics Simulation Solid-Liquid Phase Diagram of Argon ZCE 111 Computational Physics Semester Project by Gan Sik Hong (105513) Hwang Hsien Shiung.
Newton’s 1 st Law of Mechanics A particle will continue is a straight line at constant speed unless acted upon by a net push or pull (i.e. force). The.
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
Physically Based Modeling Let physics take over!.
3D Graphics for Game Programming Chapter XII Physics-based Simulation.
Modeling and Solving Constraints Erin Catto Blizzard Entertainment.
Numerical Integration and Rigid Body Dynamics for Potential Field Planners David Johnson.
4 - 1 Kinematics of Particles Kinematics is the study of motion without reference to the force which produced the motion. First, we will study the kinematics.
Chapter 10 Rotation.
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method.
Lecture Fall 2001 Physically Based Animation Ordinary Differential Equations Particle Dynamics Rigid-Body Dynamics Collisions.
Developing An Educational Rigid Body Dynamics Physics Engine By Neal Milstein.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Particle Systems.
CS559: Computer Graphics Lecture 36: Animation Li Zhang Spring 2008 Many slides from James Kuffner’s graphics class at CMU.
Modeling and Solving Constraints
Introduction to Particle Simulations Daniel Playne.
Spring Rigid Body Simulation. Spring Contents Unconstrained Collision Contact Resting Contact.
Computer Game Design and Development
1 Two of Newton’s Law of Motions 1) In the absence of any forces applied, an object at rest will stay at rest, and a body moving at a constant velocity.
CS274 Spring 01 Lecture 7 Copyright © Mark Meyer Lecture VII Rigid Body Dynamics CS274: Computer Animation and Simulation.
Rigid Body Dynamics CSE169: Computer Animation
More on Particles Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, March 24, 2004.
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.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Work and Energy January 30, 2009 Michael F. McGraw, Ph.D.
Particle Kinematics Direction of velocity vector is parallel to path Magnitude of velocity vector is distance traveled / time Inertial frame – non accelerating,
CS559: Computer Graphics Lecture 26: Animation Li Zhang Spring 2010 Slides from Brian Curless at U of Washington.
Great Innovations are possible through General Understanding …. P M V Subbarao Professor Mechanical Engineering Department I I T Delhi Thermodynamic View.
Advanced Computer Graphics Rigid Body Simulation
Manipulator Dynamics 1 Instructor: Jacob Rosen
Lecture 4: Modeling Mechanical Systems
Section 3.5 – Curvilinear Motion
Review Particle Dynamics (see transparencies in class) UNC Chapel Hill
Review ODE Basics Particle Dynamics (see transparencies in class)
Review ODE Basics Particle Dynamics (see transparencies in class)
Same format as first quiz. Total of 50 points
Motion in Real and Virtual Worlds
Computer Animation Algorithms and Techniques
Advanced Games Development Game Physics
Net Force.
Review ODE Basics Particle Dynamics (see transparencies in class)
GPAT – Chapter 7 Physics.
Presentation transcript:

University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012

Game Physics – Basic Areas Point Masses Particle simulation Collision response Rigid-Bodies Extensions to non-points Soft Body Dynamic Systems Articulated Systems and Constraints Collision Detection

Physics Engines API for collision detection API for kinematics (motion but no forces) API for dynamics Examples Box2d Bullet ODE (Open Dynamics Engine) PhysX Havok Etc. University of Texas at Austin CS 378 – Game Technology Don Fussell 3

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 4 Particle dynamics and particle systems A particle system is a collection of point masses that obeys some physical laws (e.g, gravity, heat convection, spring behaviors, …). Particle systems can be used to simulate all sorts of physical phenomena:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 5 Particle in a flow field We begin with a single particle with: Position, Velocity, Suppose the velocity is actually dictated by some driving function g: g(x,t) x y

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 6 Vector fields At any moment in time, the function g defines a vector field over x: How does our particle move through the vector field?

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 7 Diff eqs and integral curves The equation is actually a first order differential equation. We can solve for x through time by starting at an initial point and stepping along the vector field: This is called an initial value problem and the solution is called an integral curve. Start Here

Eulers method One simple approach is to choose a time step,  t, and take linear steps along the flow: Writing as a time iteration: This approach is called Euler ’ s method and looks like: Properties: Simplest numerical method Bigger steps, bigger errors. Error ~ O(  t 2 ). Need to take pretty small steps, so not very efficient. Better (more complicated) methods exist, e.g., “ Runge-Kutta ” and “ implicit integration. ”

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 9 Particle in a force field Now consider a particle in a force field f. In this case, the particle has: Mass, m Acceleration, The particle obeys Newton ’ s law: The force field f can in general depend on the position and velocity of the particle as well as time. Thus, with some rearrangement, we end up with:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 10 This equation: is a second order differential equation. Our solution method, though, worked on first order differential equations. We can rewrite this as: where we have added a new variable v to get a pair of coupled first order equations. Second order equations

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 11 Phase space Concatenate x and v to make a 6- vector: position in phase space. Taking the time derivative: another 6-vector. A vanilla 1 st -order differential equation.

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 12 Differential equation solver Applying Euler’s method: Again, performs poorly for large  t. And making substitutions: Writing this as an iteration, we have: Starting with:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 13 Particle structure position velocity force accumulator mass Position in phase space How do we represent a particle?

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 14 Single particle solver interface getDim derivEva l getState setState

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 15 Particle systems particles ntime In general, we have a particle system consisting of n particles to be managed over time:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 16 Particle system solver interface derivEval get/setState getDim For n particles, the solver interface now looks like: particles ntime

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 17 Particle system diff. eq. solver We can solve the evolution of a particle system again using the Euler method:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 18 Forces Each particle can experience a force which sends it on its merry way. Where do these forces come from? Some examples: Constant (gravity) Position/time dependent (force fields) Velocity-dependent (drag) Combinations (Damped springs) How do we compute the net force on a particle?

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 19 Particle systems with forces particles ntime forces F2F2 F nf nf Force objects are black boxes that point to the particles they influence and add in their contributions. We can now visualize the particle system with force objects: F1F1

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 20 Gravity and viscous drag p->f += p->m * F->G p->f -= F->k * p->v The force due to gravity is simply: Often, we want to slow things down with viscous drag:

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 21 Recall the equation for the force due to a spring: We can augment this with damping: The resulting force equations for a spring between two particles become: Damped spring r = rest length

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 22 derivEval Clear forces Loop over particles, zero force accumulators Calculate forces Sum all forces into accumulators Return derivatives Loop over particles, return v and f/m Apply forces to particles Clear force accumulators Return derivatives to solver F2F2 F3F3 F nf F1F1

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 23 Bouncing off the walls Add-on for a particle simulator For now, just simple point-plane collisions N P A plane is fully specified by any point P on the plane and its normal N.

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 24 Collision Detection N v P x How do you decide when you’ve crossed a plane?

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 25 Normal and tangential velocity N v P v To compute the collision response, we need to consider the normal and tangential components of a particle’s velocity.

University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell 26 Collision Response before after Without backtracking, the response may not be enough to bring a particle to the other side of a wall. In that case, detection should include a velocity check: