GAMES101 Lecture 22 - Animation Cont.

GAMES101_Lecture_22.pdf

Outline

 

I. Single Particle Simulation

For similicity we may write vectors in the same way as scalars.

Vector Field and Ordinary Differential Equation (ODE)

image-20230725191306964

Assume the motion of a particle is determined by a velocity vector field that is a function of position and time:

v(x,t)

Computing the position of that particle over time requires solving a first-order ordinary differential equation (ODE):

dxdt=x˙=v(x,t)

Solve the ODE subject to a given initial particle position x0 by using forward numerical integration.

 

Euler's Method

Euler's Method, a.k.a. Forward Euler, Explicit Euler, is

xt+Δt=xt+Δtx˙t
x˙t+Δt=x˙t+Δtx¨t

The rightside of the equation consists of only values at present.

Errors

Errors accmulate as the integration goes, and euler integration is particularly bad.

image-20230725192011794

Instability

image-20230725192128778

 

Resolving Errors and Instability

Solving by numerical integration with finite differences leads to two problems:

 

 

Midpoint Method/Modified Euler

image-20230725193249806

  1. Compute Euler step (a)

  2. Compute derivative at the midpoint of Euler step (b)

  3. Update position using midpoint derivative (c)

xmid=xt+12v(xt,t)Δt
xt+Δt=x(t)+Δtv(xmid,t)
xt+Δt=xt+12Δt(x˙t+x˙t+Δt)
x˙t+Δt=x˙t+Δtx¨t
xt+Δt=xt+Δtx˙t+12(Δt)2x¨t

 

Adaptive Step Size

image-20230725194201691

Repeat until error is below threshold:

  1. Compute xT an Euler step, size T

  2. Compute xT/2 two Euler steps, size T/2

  3. Compute error ϵ=xTxT/2

  4. If ϵ>C, a predefined threshold, then reduce step size T and try again.

 

Implicit Euler Method

xt+Δt=xt+Δtx˙t+Δt
x˙t+Δt=x˙t+Δtx¨t+Δt

 

Runge-Kutta Families

A family of advanced methods for solving ODEs.

image-20230725195211429

 

Position-Based/Verlet Integration

Pros/Cons

 

II. Rigid Body Simulation

Simple case:

 

III. Fluid Simulation

A Simple Position-Based Method

image-20230725212307412

Key idea:

 

Eulerian vs. Lagrangian

image-20230725200415930

 

Material Point Method (MPM)

Hybrid, combining Eulerian and Lagrangian views: