Presentation is loading. Please wait.

Presentation is loading. Please wait.

UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics Animation.

Similar presentations


Presentation on theme: "UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics Animation."— Presentation transcript:

1 UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics
Animation

2 Goals Learn what is at the core of animation math
See some implementation strategies

3 Animatable values We say we animate one value
In practice, we could be animating several values at once A color has three components (R, G, B) A 3D position has three coordinates A transformation matrix has up to 12 degrees of freedom (DoF) Addition and multiplication by scalar gives us lerp Note that a rotation matrix or quaternion has three DoF Conceptually, rotations have “addition” (composition) and slerp We will assume that we animate a single float

4 Interpolation vs. extrapolation
Interpolation is figuring out values for instants in between already-known values lerp, with a weight between 0 and 1 Extrapolation is figuring it out for instants outside of the range of the known values Lerp with a weight that’s negative or >1 When animating, we normally want to do interpolation Interpolation Extrapolation X1 X0 t0 t1 t

5 Piece-wise linear interpolation
Start with a few known samples Figure out the two closest ones Lerp between them Simple and effective Continuity of movement No continuity of velocities! X2 X1 X4 X0 X3 t0 t1 t2 t3 t4 t

6 Piece-wise cubic spline interpolation
Start with a few known samples Figure out the four closest ones They describe a cubic A*t3 + B*t2 + C*t + D Fairly simple, very effective Continuity of movement Also continuity of velocities! X2 X1 X4 X0 X3 t0 t1 t2 t3 t4 t

7 Cubic spline interpolation
Interpolate between X1 and X2 with a cubic polynomial D3DX provides functions “Hermite” if tangents are provided “Catmull-Rom” if adjacent points are provided X1 X3 X2 X0 t0 t1 t2 t3 t

8 Cubic spline interpolation
Can be done as a series of lerps: A = lerp(X0,X1,a+1) B = lerp(X1,X2,a) C = lerp(X2,X3,a–1) D = lerp(A,B,(a+1)/2) E = lerp(B,C,a/2) lerp(D,E,a) Can use slerp for rotations! Not very common (use linear) X1 X3 X2 X0 t0 t1 t2 t3 t

9 Keyframed animation Same concept as piecewise
But eliminate unnecessary samples They will be interpolated! Animation code will need to figure out which two keyframes are the closest Need to perform a search Cannot use Catmull-Rom Samples are not equidistant anymore t t0 X0 t1 X1 t2 X2 t3 X3 t t0 t1 X0 X1 t2 X2 t3 X3 t4 X4


Download ppt "UW Extension Certificate Program in Game Development 2nd quarter: Advanced Graphics Animation."

Similar presentations


Ads by Google