Emerging Technologies for Games Animation: Interpolation - PowerPoint PPT Presentation

1 / 13
About This Presentation
Title:

Emerging Technologies for Games Animation: Interpolation

Description:

Rotation: Euler angles, a matrix or a quaternion. Scaling: vector / scalars or a matrix ... Normalising quaternions is trivial ... – PowerPoint PPT presentation

Number of Views:63
Avg rating:3.0/5.0
Slides: 14
Provided by: lauren80
Category:

less

Transcript and Presenter's Notes

Title: Emerging Technologies for Games Animation: Interpolation


1
Emerging Technologies for GamesAnimation
Interpolation
  • CO3303
  • Week 3

2
Interpolation for Animation
  • Given two transforms for a model, we can
    calculate the transforms in between the two
  • This is called interpolation
  • Animation is stored as a sequence of key frames
    (transforms)
  • To get frames between the key frames, we use
    interpolation
  • For example a rotating arm has 2 key frames
  • One at the start of rotation, one at the end
  • Generate frames in between with interpolation

3
Previous Interpolation
  • We have interpolated between elements before
  • Alpha blending source and destination colours
  • Skinning the effects of multiple bones
  • We used Linear Interpolation each time
  • Alpha blending
  • Dest.R Source.A Source.R (1-Source.A)
    Dest.R
  • Skinning (with two bones)
  • N.B. Refer to Van Verth 10.6 for this section

4
Linear Interpolation or Lerp
  • General linear interpolation between two
    mathematical elements P0 and P1 takes the form
  • Typically t is in the range 0,1 - note that
  • The parameter t selects a element P(t) in between
    the start and end elements P0 and P1
  • If P0 P1 are points, then P(t) defines the line
    between them
  • Hence linear interpolation

5
Linear Interpolation of Transforms
  • A transformation is typically made up of a
    position, a rotation and a scaling component
  • Can be stored in several ways, e.g.
  • Position vector / scalars (x,y,z) or a matrix
  • Rotation Euler angles, a matrix or a quaternion
  • Scaling vector / scalars or a matrix
  • Can have a single combined matrix for everything
  • We will consider the effect of linear
    interpolation on each of the components
    separately
  • Then consider how this affects our storage choice

6
Linear Interpolation of Position
  • Linear interpolation applied to key-frame
    positions will give sensible in-between positions
  • With several key-frames we get piecewise linear
    interpolation
  • Motion between points has sharp changes in
    direction
  • May prefer smoother motion and can use higher
    order interpolations to do this
  • But linear interpolation works and will suffice
    for now

Piecewise Interpolation
7
Linear Interpolation of Scaling
  • Scaling can also be interpolated linearly
  • Again, piecewise linear interpolation will cause
    sharp changes
  • This time in the speed of shrinking/expanding
  • Less noticeable effect
  • Again, possible to calculate smoother result with
    higher order interpolation

8
Linear Interpolation of Rotation
  • Can apply linear interpolation to rotations if
    they are in matrix or quaternion form
  • Ineffective with Euler angles
  • Unlike position and scale, the result is
    incorrect
  • Even with just one pair of key-frames
  • The tips of the rotated vectors are interpolated
  • Resulting in an unwanted scaling
  • Inconsistent angles quarter steps here, but a ?
    ß

9
Improved Linear Interpolation
  • Can normalise the rotations to remove the scaling
    effect
  • But still left with inaccurate angles
  • Normalising quaternions is trivial
  • Gram-Schmidt orthogonalisation used to normalise
    matrices (see Van Verth 1.2.7)
  • Allows us to use linear interpolation of
    rotations, if the overall rotation is small
    enough
  • Otherwise need linear interpolation of the angles

10
Slerp
  • Linear interpolation of angles is same as linear
    interpolation of an arc on a sphere
  • So this technique is called spherical linear
    interpolation or slerp
  • The formula is different from linear
    interpolation
  • As before take a start and end rotation (P, Q),
    and a value t from 0,1
  • Returns the interpolated rotation

11
Slerp for Matrices
  • Can apply the slerp formula if P, Q are matrices
  • Matrix multiplication / inverse are understood
  • But how to calculate a matrix raised to a power?
  • i.e. Mt
  • Need to convert the matrix to axis-angle format,
    then calculate ? t, then convert back
  • Very expensive
  • More than 100 operations

12
Slerp for Quaternions
  • Can show (10.6.2) that slerp for quaternions is
  • Expensive, mainly because of the sin functions
  • But sin ? can be precalculated
  • Constant for any pair of key frames
  • Has potential accuracy problems for small ?
  • However, more usable than the matrix version

13
Interpolation Summary
  • We want to interpolate between two key frames
  • Can use simple linear interpolation (lerp) for
    the position and scaling
  • Consider angle of rotation between the frames
  • Can often use lerp on rotations, normalise the
    result
  • For large angles, use slerp
  • In any case store rotations as quaternions if you
    intend to interpolate them
  • Matrices slow, angles ineffective
  • Note newer methods avoid slerp see 10.6.3
Write a Comment
User Comments (0)
About PowerShow.com