Erin Catto Blizzard Entertainment Numerical Integration.

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

Numeric Integration Methods Jim Van Verth Red Storm Entertainment
Martyn Clark Short course on “Model building, inference and hypothesis testing in hydrology” May, 2012.
Numeriska beräkningar i Naturvetenskap och Teknik 1. Numerical differentiation and quadrature Discrete differentiation and integration Trapezoidal and.
Integration Techniques
Ordinary Differential Equations
Lecture 18 - Numerical Differentiation
1cs542g-term Notes. 2 Solving Nonlinear Systems  Most thoroughly explored in the context of optimization  For systems arising in implicit time.
1cs542g-term Notes  Notes for last part of Oct 11 and all of Oct 12 lecture online now  Another extra class this Friday 1-2pm.
1cs542g-term Notes  Final exam: December 10, 10am-1pm X736 (CS Boardroom)  Another extra class this Friday 1-2pm.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Total Recall Math, Part 2 Ordinary diff. equations First order ODE, one boundary/initial condition: Second order ODE.
PART 7 Ordinary Differential Equations ODEs
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Ordinary Differential Equations Equations which are.
CSCE Review—Fortran. CSCE Review—I/O Patterns: Read until a sentinel value is found Read n, then read n things Read until EOF encountered.
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.
Stable Cloth Animation By Matthew Fisher. Overview Choose Underlying Model Define Equations of State Integrate Equations of State –Deal With Explosions.
Initial-Value Problems
ENGG2013 Unit 22 Modeling by Differential Equations Apr, 2011.
Numerical Solutions of Ordinary Differential Equations
NUMERICAL SOLUTION OF ORDINARY DIFFERENTIAL EQUATIONS
Chapter 16 Integration of Ordinary Differential Equations.
1 Chapter 9 Differential Equations: Classical Methods A differential equation (DE) may be defined as an equation involving one or more derivatives of an.
1Chapter 2. 2 Example 3Chapter 2 4 EXAMPLE 5Chapter 2.
Differential Equations and Boundary Value Problems
Computer graphics & visualization Rigid Body Simulation.
MATH 685/ CSI 700/ OR 682 Lecture Notes Lecture 10. Ordinary differential equations. Initial value problems.
1 Chapter 6 Numerical Methods for Ordinary Differential Equations.
PART 7 Ordinary Differential Equations ODEs
Ordinary Differential Equations (ODEs) 1Daniel Baur / Numerical Methods for Chemical Engineers / Explicit ODE Solvers Daniel Baur ETH Zurich, Institut.
Numerical Solutions to ODEs Nancy Griffeth January 14, 2014 Funding for this workshop was provided by the program “Computational Modeling and Analysis.
Lecture 35 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Chapter 17 Boundary Value Problems. Standard Form of Two-Point Boundary Value Problem In total, there are n 1 +n 2 =N boundary conditions.
EE3561_Unit 8Al-Dhaifallah14351 EE 3561 : Computational Methods Unit 8 Solution of Ordinary Differential Equations Lesson 3: Midpoint and Heun’s Predictor.
ME451 Kinematics and Dynamics of Machine Systems
Modeling and simulation of systems Numerical methods for solving of differential equations Slovak University of Technology Faculty of Material Science.
ME451 Kinematics and Dynamics of Machine Systems Numerical Solution of DAE IVP Newmark Method November 1, 2013 Radu Serban University of Wisconsin-Madison.
Dr. Hatim Dirar Department of Physics, College of Science Imam Mohamad Ibn Saud Islamic University.
1 EEE 431 Computational Methods in Electrodynamics Lecture 4 By Dr. Rasime Uyguroglu
Modeling and Solving Constraints Erin Catto Blizzard Entertainment.
Numerical Integration and Rigid Body Dynamics for Potential Field Planners David Johnson.
Computer Animation Algorithms and Techniques
Modelling & Simulation of Chemical Engineering Systems Department of Chemical Engineering King Saud University 501 هعم : تمثيل الأنظمة الهندسية على الحاسب.
Large Steps in Cloth Simulation - SIGGRAPH 98 박 강 수박 강 수.
Integration of 3-body encounter. Figure taken from
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method.
Numerical Methods for Solving ODEs Euler Method. Ordinary Differential Equations  A differential equation is an equation in which includes derivatives.
Modeling motion subject to drag forces PHYS 361 Spring, 2011.
MAT 1228 Series and Differential Equations Section 3.7 Nonlinear Equations
Large Timestep Issues Lecture 12 Alessandra Nardi Thanks to Prof. Sangiovanni, Prof. Newton, Prof. White, Deepak Ramaswamy, Michal Rewienski, and Karen.
Circuits Theory Examples Newton-Raphson Method. Formula for one-dimensional case: Series of successive solutions: If the iteration process is converged,
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 7 - Chapter 25.
Numerical Analysis – Differential Equation
ME451 Kinematics and Dynamics of Machine Systems Numerical Integration. Stiffness: Implicit Methods. October 30, 2013 Radu Serban University of Wisconsin-Madison.
Ch. 1 First-Order ODEs Ordinary differential equations (ODEs) Deriving them from physical or other problems (modeling) Solving them by standard methods.
Lecture 40 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
ECE 576 – Power System Dynamics and Stability Prof. Tom Overbye Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Ordinary Differential Equations
Lecture 39 Numerical Analysis. Chapter 7 Ordinary Differential Equations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 6 - Chapters 22 and 23.
VEHICLE DYNAMICS SIMULATIONS USING NUMERICAL METHODS VIYAT JHAVERI.
Building a Better Jump J. Kyle Co-founder, Minor Key Games.
Building a Better Jump J
Integrators of higher order
Mechanical Engineering at Virginia Tech
Motion with constant acceleration
GPAT – Chapter 7 Physics.
Presentation transcript:

Erin Catto Blizzard Entertainment Numerical Integration

Basic Idea Games use differential equations for physics. These equations are hard to solve exactly. We can use numerical integration to solve them approximately.

Overview Differential Equations Numerical Integrators Demos

Typical Game Loop Start t = 0 Player Input Simulate  t Render t = t +  t Choose  t

Simulation Animation AI Physics Differential Equations

What is a differential equation? An equation involving derivatives. rate of change of a variable = a function

Anatomy of Differential Equations State Dependent variables Independent variables Initial Conditions Model The differential equation itself

Projectile Motion State Independent variable: time (t) Dependent variables: position (y) and velocity (v) Initial Conditions t0, y0, v0

Projectile Motion Model: vertical motion x y

First Order Form Numerical integrators need differential equations to be put into a special format.

First Order Form Arrays of equations work too.

Projectile Motion First Order Form x y

x y

Mass-Spring Motion Consider the vertical motion of a character.

Mass-Spring Motion State time: t position: x velocity: v Initial Conditions t0, x0, v0 x

Mass-Spring Motion Idealized model m ground k x

Mass-Spring Motion First Order Form

Solving Differential Equations Sometimes we can solve our DE exactly. Many times our DE is too complicated to be solved exactly.

Hard Problems Nonlinear equations Multiple variables

Hard Problems Projectile with air resistance

Hard Problems Mass-spring in 3D

Hard Problems Numerical integration can help! Handles nonlinearities Handles multiple variables

Numerical Integration Start with our first order form

A Simple Idea Approximate the slope. t x tt+h

A Simple Idea Forward difference:

A Simple Idea Shuffle terms:

A Simple Idea Using this formula, we can make a time step h to find the new state. We can continue making time steps as long as we want. The time step is usually small

Explicit Euler This is called the Explicit Euler method. All terms on the right-hand side are known. Substitute in the known values and compute the new state.

What If … This is called the Implicit Euler method. The function depends on the new state. But we don’t know the new state!

Implicit Euler We have to solve for the new state. We may have to solve a nonlinear equation. Can be solved using Newton-Raphson. Usually impractical for games.

Implicit vs Explicit Explicit is fast. Implicit is slow. Implicit is more stable than explicit. More on this later.

Opening the Black Box Explicit and Implicit Euler don’t know about position or velocity. Some numerical integrators work with position and velocity to gain some advantages.

The Position ODE This equation is trivially linear in velocity. We can exploit this to our advantage.

Symplectic Euler First compute the new velocity. Then compute the new position using the new velocity.

Symplectic Euler We get improved stability over Explicit Euler, without added cost. But not as stable as Implicit Euler

Verlet Assume forces only depend on position. We can eliminate velocity from Symplectic Euler.

Verlet Write two position formulas and one velocity formula.

Verlet Eliminate velocity to get:

Newton Assume constant force: Exact for projectiles (parabolic motion).

Demos Projectile Motion Mass-Spring Motion

Integrator Quality 1. Stability 2. Performance 3. Accuracy

Stability Extrapolation Interpolation Mixed Energy

Performance Derivative evaluations Matrix Inversion Nonlinear equations Step-size limitation

Accuracy Accuracy is measured using the Taylor Series.

Accuracy First-order accuracy is usually sufficient for games. You can safely ignore RK4, BDF, Midpoint, Predictor-Corrector, etc. Accuracy != Stability

Further Reading & Sample Code Hairer, Geometric Numerical Integration