630 likes | 641 Views
Learn about Euler's, Verlet, Symplectic, Runge-Kutta, and Implicit methods for numerical integration in game development, their strengths, and limitations. Explore different test cases and their outcomes.
E N D
Numerical Integration Jim Van Verth Insomniac Games jim@essentialmath.com
Talk Summary • Going to talk about: • Euler’s method subject to errors • Implicit methods help, but complicated • Verlet methods help, but velocity out of step • Symplectic methods can be good for both
Our Test Case x0 xt =?
Constant velocity v x0 xt =?
Constant velocity v x0 xt = x0+vt
Constant acceleration a v0 x0 xt = ?
Constant acceleration a v0 x0 xt = ?
Constant acceleration a v0 x0 xt = x0 + v0t + 1/2at2
Variable acceleration x0 xt = ?
Euler’s method v0 x0
Euler’s method v0 x1 x0
Euler’s method v0 a v0 x1 x0
Euler’s method v0 a v0 v1 x1 x0
Euler’s method v0 v1 x1 x0
Euler’s method v0 v1 x1 x2 x0
Euler’s method v0 v1 v1 x1 a x2 x0
Euler’s method v0 v1 v1 x1 a x2 x0 v2
Euler’s method v0 v1 x1 x2 x0 v2
Euler’s method v0 v1 x1 x2 x0 v2
Euler’s method v0 x0 a0
Euler’s method v0 x0 x1 a0
Euler’s method v0 v0 a0 x1 x0
Euler’s method v0 v0 v1 a0 x1 x0
Euler’s method v0 v1 x1 x0
Euler’s method v0 v1 x1 x0 x2 v2
Euler’s method v0 x0 x1 v1
Euler • Okay for non-oscillating systems • Explodes with oscillating systems • Adds energy! Very bad!
Runge-Kutta methods v0 x0
Runge-Kutta methods v0 x0 v0.5
Runge-Kutta methods x0 v0.5
Runge-Kutta methods x0 v0.5 x1
Runge-Kutta methods v0 x0
Runge-Kutta 4 • Very stable and accurate • Conserves energy well • But expensive: four evaluations of derivative
Implicit methods v0 x0
Implicit methods v0 x0 x1
Implicit methods v0 x0 x1 v1
Implicit methods v0 x0 v1
Implicit methods v0 x0 v1 x1
Implicit methods v0 x0 v1 x1
Implicit methods v0 x0 x1 v1
Implicit methods v0 x0 v1 x1
Backward Euler • Not easy to get implicit values • More expensive than Euler • But tends to converge: better but not ideal
Verlet x0 x-1
Verlet x0 x-1
Verlet x0 at2 x-1
Verlet x0 at2 x-1 x1
Verlet x0 at2 x-1 x1