Computer Animation Keyframe and Interpolation - PowerPoint PPT Presentation

1 / 53
About This Presentation
Title:

Computer Animation Keyframe and Interpolation

Description:

2D/Hand-Drawn/Cel Animation. Highly skilled animator draws the important, ... a joint angle of an appendage of a robot, the transparency attribute of an object, ... – PowerPoint PPT presentation

Number of Views:2119
Avg rating:3.0/5.0
Slides: 54
Provided by: abdennour8
Category:

less

Transcript and Presenter's Notes

Title: Computer Animation Keyframe and Interpolation


1
Computer Animation Keyframe and Interpolation
CMPSEM026
Abdennour El Rhalibi
2
Animation Techniques
  • Key Frame Animation
  • Position
  • Interpolation Linear, quadratic, cubic
  • Hermite Interpolation.
  • Catmull-Rom Interpolation
  • Bezier Interpolation.
  • TCB Interpolation.
  • Rotation
  • Interpolation of Euler angles.
  • Interpolation of Quaternions.
  • Spherical Linear Interpolation.
  • Spherical TCB Interpolation.
  • Path Animation
  • Uniform speed parameterization.
  • Tangent guided rotation.

3
Keyframing
  • 2D/Hand-Drawn/Cel Animation
  • Highly skilled animator draws the important, or
    key frames
  • Less skilled (lower paid) animator draws the
    inbetween frames
  • 3D/Computer Generated Animation
  • Animator specifies the important key frames
  • Computer generates the in-betweens automatically
    using interpolation

4
Interpolation and Basic Techniques
  • Abstract out the important features of the
    animation ?
  • A very subjective thing to do ? the appropriate
    feature for one kind of animation will not be the
    appropriate feature for another kind of
    animation.
  • Our focus ? various techniques in which the
    animator is responsible for specifying most of
    the information (low level of abstraction).

5
Level of abstraction
High
Weak relationship (Model-based techniques)
Information provided by the animator
Low
the resulting motion
Strong relationship
We are here!
6
Interpolation and Basic Techniques
  • Interpolation
  • Motion along a curve (arc length)
  • Interpolation of rotations (quaternions)
  • Path following

7
Interpolation
  • Generating in between values (connecting the
    dots)
  • Examples are linear and cubic polynomial
    interpolation
  • We can interpolate any changeable value!!!
  • position
  • orientation
  • Color (sunrise)
  • Intensity (dimmed lights)
  • camera focal length (zoom)

8
Interpolation
  • At the foundation of almost all animation is the
    interpolation of values.
  • The simplest case is interpolating the position
    of a point in space.
  • Even this is non-trivial to do correctly and
    requires some discussion of several issues
  • the appropriate parameterization of position,
  • the appropriate interpolating function,
  • and maintaining the desired control of the
    interpolation over time.

9
Interpolation
  • Often, an animator has a list of values
    associated with a given parameter at specific
    frames (called key frames or keys) of the
    animation.
  • The question to be answered is how best to
    generate the values of the parameter for the
    frames between the key frames.
  • The parameter to be interpolated may be
  • a coordinate of the position of an object,
  • a joint angle of an appendage of a robot,
  • the transparency attribute of an object,
  • any other parameter

10
Interpolation
  • Our focus ?How to choose the most appropriate
    interpolation technique and apply it in the
    production of an animated sequence.
  • One of the first decisions to make is whether the
    given values represent actual values that the
    parameter should have at the key frames
    (interpolation), or whether they are meant merely
    to control the interpolating function and do not
    represent actual values the parameter will assume
    (approximation).

interpolation
approximation
11
Interpolation
  • Other issues that influence which interpolation
    technique to use include how smooth the resulting
    function needs to be (i.e. continuity),

12
Interpolation
  • how much computation you can afford to do (order
    of interpolating polynomial, and whether local or
    global control of the interpolating function is
    required.

13
  • Spline curves control points
  • Spline
  • Created by mathematical technique that fits a
    curve to a set of given points called Control
    Points Curve fitting
  • Artist places the points, and program creates a
    curve based on the points
  • Polyline
  • series of straight lines through the points
  • B-splines
  • blend position of control points without
  • passing through any of them
  • Non-uniform rational B-splines (NURB)

Ex
Ex
14
  • Bezier curve
  • Named after French engineer Pierre Bezier
  • Direct control over the location of the
  • curve with anchor points
  • Over the curvature between the points
  • with two off-the curve control points
  • Difficult off-path control points
  • Catmull-Rom Spline
  • Interpolating spline
  • Restricts the curvature choice but
  • places all points on the curve
  • Make drawing and editing more
  • straightforward

Often used in animation path movement
15
Curves
Hermite
Bezier
Catmull-Rom
Blended parabolas
B-splines, NURBS
16
Hermite
17
Bezier
18
B-Spline / NURBS
19
Often used in animation path movement
Catmull-Rom
20
Often used in animation path movement
Blended Parabolas
21
Interpolation
  • Lets assume an interpolating technique has been
    chosen and that a function P(t) has been selected
    which, for a given value of t, will produce a
    value, i.e., p P(t).
  • If position is being interpolated then three
    functions are used in the following manner. The
    x, y and z coordinates for the positions at the
    key frames are specified.

22
Interpolation
  • Key frames are associated with specific values of
    the time (t) parameter.
  • The x, y and z coordinates are considered
    independently.
  • For example, the points (x,t) are used as control
    points for the interpolating curve so that
    XPx(t)
  • Similarly, YPy(t) and ZPz(t) are formed so that
    at any time, t, a position (x,y,z) can be
    produced.

23
Interpolation
  • Varying the parameter of interpolation, in this
    case t, by a constant amount, does not mean that
    the resulting values, in this case Euclidean
    position, will vary by a constant amount.
  • This means that just because t changes at a
    constant rate, the interpolated value will not
    necessarily, in fact seldom, have a constant
    speed.

24
Interpolation ?Parametric Motion
  • This animation shows a ball moving along a
    parametrically defined cubic curveP(t) at3
    bt2 ct d by uniformly varying the parameter
    (i.e. t 0.0, 0.1, 0.2, etc.).
  • Note that it travels further between frames at
    the start of the curve than at the end of the
    curve Equi-distant values in parametric space do
    not result in equi-distant points in Euclidean
    space.

25
Interpolation
  • In order to ensure a constant speed for the
    interpolated value, the interpolating function
    has to be parameterized by arc length, i.e.,
    distance along the curve of interpolation.
  • Some type of reparameterization by arc length
    should be performed for most applications.
  • Usually this reparameterization can be
    approximated without adding undue overhead or
    complexity to the interpolating function.

26
Linear InterpolationThe Problem
  • In Animation we often need to determine the value
    of some quantity in between two places where its
    value is known. For example,
  • We are rendering a line. One endpoint is white
    the other is blue. What color should the rest of
    the line be?
  • We are animating a spinning wheel. We know its
    angular position at two key frames what is the
    angle between the two frames?
  • We are rendering a partially transparent polygon.
    We know the transparency at two of its vertices
    what is the transparency between these vertices?
  • We are drawing a smooth curve. We know its slope
    at two different points what is the slope
    between the two points?
  • We are texturing a polygon (painting an image on
    it). What color is the polygon between two pixels
    in the image (texels)?
  • We are doing lighting calculations for a surface.
    We know the effect of lighting at two points
    what is the effect between the two points?

27
Linear InterpolationLirping
  • Approximating a quantity between places where the
    quantity is known, is called interpolation.
  • Approximating the quantity in other places is
    called extrapolation.
  • The simplest interpolation method is linear
    interpolation.
  • Linear interpolation assumes that the graph of
    the quantity between the two known values is a
    straight line.
  • Of course, this assumption is often false, but
    remember that we are only trying to approximate.
  • We abbreviate linearly interpolate as lirp
    some people spell it lerp.

28
Linear InterpolationSimple Case
  • When we lirp, we are given two values of a
    quantity we determine its value somewhere
    between these.
  • To do this, we assume that the graph of the
    quantity is a line segment (between the two given
    values).
  • Here is a simple case
  • When t 0, the quantity is equal to a.
  • When t 1, the quantity is equal to b.
  • Given a value of t between 0 and 1, the
    interpolated value of the quantity is
  • Check that this satisfies all the requirements.
  • Note We only do this for t between 0 and 1,
    inclusive.

29
Linear InterpolationExample 1
  • An object lies at position y 2 at time t 0
    and position y 3.1 at time t 1. Using linear
    interpolation, approximate the position of the
    object at time t 0.6.

30
Linear InterpolationGeneral Case
  • What if we are not given values of the quantity
    at 0 and 1?
  • Say the value at s1 is a and the value at s2 is
    b, and we want to find the interpolated value at
    s.
  • We setand proceed as before

31
Linear InterpolationExample 2
  • The brightness of a moving light source is 1.0
    when it lies at position x 1.1 and 0.5 when it
    lies at position x 1.5. Using linear
    interpolation, approximate the brightness when it
    lies at position x 1.4.

32
Linear InterpolationLirping Colors Points
  • Much of the interpolation done in CG involves
    several numbers at once. An important example is
    colors, which are typically specified as three
    numbers R, G, and B.
  • To lirp between two colors, we actually lirp
    three times between the two R values, between
    the two G values, and between the two B values.
  • The three lirping calculations are carried out
    independently of each other.
  • This method actually ignores some important
    characteristics of human vision however, when
    the two colors are very similar, it is a fine
    method to use.
  • Lirping between 2-D and 3-D points is done
    similarly.

33
Linear InterpolationExample 3
  • The position of an object is (0, 1) at time t 0
    and (2, 10) at time t 1. Using linear
    interpolation, approximate the position of the
    object at time t 0.1.

34
Position Interpolation Problem generate a path
through points at designated times with smooth
motion
35
Answers
  • Example 1
  • a 2, b 3.1, and the relevant value of t is
    0.6.
  • Approximation (1 0.6) ? 2 0.6 ? 3.1 2.66.
  • Example 2
  • We start at 1.1 and end at 1.5. We want to
    approximate at 1.4.
  • So t (1.4 1.1)/(1.5 1.1) 0.75.
  • Now, a 1.0, b 0.5, and t 0.75.
  • Approximation (1 0.75) ? 1.0 0.75 ? 0.5
    0.625.
  • Example 3
  • We lirp the two coordinates separately.
  • 1st coord. a 0, b 2, t 0.1. (1 0.1) ? 0
    0.1 ? 2 0.2.
  • 2nd coord. a 1, b 10, t 0.1. (1 0.1) ? 1
    0.1 ? 10 1.9.
  • We finish by putting the two coordinates
    together (0.2, 1.9).

36
Interpolation vs. Approximation
  • Have a set of data points (key frames)
  • Usually in 3D
  • Want to fill in whats in between
  • Create continuous curve P(u)
  • Interpolation
  • Curve goes through data
  • Approximation
  • Curve goes near the points (data) used as weights
    or control points

37
Interpolation Qualities
  • Want smooth curves
  • Local control
  • Local data changes have local effect
  • Continuous with respect to the data
  • No wiggling if data changes slightly
  • Low computational effort

38
Continuity
  • Describe curves in terms of their continuity in a
    segment and between segments
  • Parametric continuity Cx
  • Only P is continuous C0
  • Positional continuity
  • P and first derivative are continuous C1
  • Tangential continuity
  • P first second C2
  • Curvature continuity

39
Curves
Explicit form y f(x)
Implicit form 0 f(x,y)
x f(u)
Parametric form
y g(u)
40
Parametric Curves
  • You are probably familiar with curves like y x²
    or f(x)x².
  • A parametric curve is similar to those, but the
    x- and y-values are calculated in separate
    functions.
  • To do this we need another variable, say a.
  • So instead of f(x), we say X(a) and Y(a), where
    X(a) gives you an x-value for each value of a,
    and Y(a) gives you an corresponding y-value for
    the same value of a.
  • Here is an example
  • X(a) a/2 Y(a) a5
  • If we substitute a with a number we can get a
    point that lies on the curve/line a 6
  • X(6) 6/2 3 x
  • Y(6) 65 11 y
  • We now know that (3,11) is a point on the curve.
  • We can easily make a curve in 3D just by defining
    Z(a).

41
Simple line
  • The simplest form of interpolation is a straight
    line from a control point A, to a control point
    B.
  • I will use Ax to denote the x-coordinate of
    control point A, and Ay to denote the
    y-coordinate.
  • The same goes for B.
  • I am introducing another variable, b, just to
    make it a bit more simple to read the functions.
  • However, the variable b is only a in disguise, b
    is always equal to 1-a.
  • So if a 0.2, then b 1-0.2 0.8. So when you
    see the variable b, think (1-a).
  • This parametric curve describes a line that goes
    from point A, to point B when the variable a goes
    from 1.0 to 0.0
  • X(a) Axa Bxb
  • Y(a) Aya Byb P(a) Axa Bx(1-a)
  • Z(a) Aza Bzb


42
Simple line
  • This parametric curve describes a line that goes
    from point A, to point B when the variable a goes
    from 1.0 to 0.0
  • X(a) Axa Bxb
  • Y(a) Aya Byb
  • Z(a) Aza Bzb
  • If you set a 0.5
  • (and thus also b 0.5, since b 1.0-a 1.0-0.5
    0.5)
  • then X(a), Y(a) and Z(a) will give you the 3D
    coordinate of the point on the middle of the line
    from point A to point B.
  • Note that the reason this works is because a b
    is always equal to one, and when you multiply
    something with one, it will stay unchanged.
  • This makes the curve behave predictably and lets
    you place the control points anywhere in the
    coordinate system, since when a 1.0 then b
    0.0
  • thus making the point equal to one of the
    control points, and completely ignoring the other
    one.

43
Linear interpolation
  • Curve continuity ?
  • Locality ?
  • Computational effort ?

44
Linear interpolation
  • Curve continuity ?
  • -- Low (C0)
  • Locality ?
  • Computational effort ?
  • P(a) Axa Bx(1-a), a ?0..1

Important Criteria Continuity is missing for
Linear Interpolation
45
Quadratic
  • Ok, now we have done lines, but what about
    curves?
  • (ab), where b (1.0-a) is the key.
  • We know that a polynomial function is a curve, so
    why not try to make (ab) a polynomial function?
  • Let's try
  • (ab)² a² 2ab b²
  • Knowing that b1-a we see that a² 2ab b² is
    still equal to one,
  • since (ab) 1, and 1² 1.
  • We now need three control points, A, B and C,
    where A and C are the end points of the curve,
    and B decides how much and in which direction it
    curves.
  • Except for that, it is the same as with the
    parametric line.
  • X(a) Axa² Bx2ab Cxb²
  • Y(a) Aya² By2ab Cyb²
  • Z(a) Aza² Bz2ab Czb²
  • P(a) Axa² Bx2a(1-a) Cx(1-a)²


46
Quadratic
  • This parametric curve describes a curve that goes
    from point A, to point C in the direction of C
    when the variable a goes from 1.0 to 0.0
  • X(a) Axa² Bx2ab Cxb²
  • Y(a) Aya² By2ab Cyb²
  • Z(a) Aza² Bz2ab Czb²
  • If you set a 0.5, then a² 0.25, 2ab 0.5
    and
  • b² 0.25 giving the middle point, B, the biggest
    impact and making point A and C pull equally to
    their sides.
  • If you set a 1.0, then a² 1.0, ab 0.0 and
    b² 0.0 meaning that result is the control point
    A itself,
  • Just the same as setting a 0.0 will return the
    coordinates of control point C.

47
Polynomial interpolation
  • Curve continuity ?
  • Locality ?
  • Computational effort ?

48
Example Polynomial interpolation
  • Curve continuity ?
  • Locality ?
  • --
  • Computational effort ?
  • P(a) Axa² Bx2a(1-a) Cx(1-a)²

Important Criteria of Locality is missing for
Polynomial Interpolation
49
Cubic
  • We can also increase the number of control points
    using (ab)³ instead of (ab)², giving you more
    control over how to bend the curve.
  • (ab)³ a³ 3a²b 3ab² b³
  • Now we need four control points A, B, C and D,
    where A and D are the end points.
  • X(a) Axa³ Bx3a²b Cx3ab² Dxb³
  • Y(a) Aya³ By3a²b Cy3ab² Dyb³
  • Z(a) Aza³ Bz3a²b Cz3ab² Dzb³
  • It still works the same way as the previous ones,
    as a goes from 1.0 to 0.0 (and thus b from 0.0 to
    1.0) the functions will return coordinates on a
    smooth line from control point A to control point
    D, curving towards B and C on the way.

50
Cubic
  • X(a) Axa³ Bx3a²b Cx3ab² Dxb³
  • Y(a) Aya³ By3a²b Cy3ab² Dyb³
  • Z(a) Aza³ Bz3a²b Cz3ab² Dzb³
  • You can easily use (ab) to the power of n and
    get n1 control points (where n is any integer
    equal to, or greater than one).
  • But the more control points you have, the more
    computational effort is needed.
  • Personally I like the cubic ones best. You can
    easily make circles with them, and you can
    control the direction of the curve independently
    at each control point.

51
A general solution
  • Use SEVERAL polynomials
  • Complete curve consists of several pieces
  • All pieces are of low order
  • Third order is the most common (cubic)
  • Pieces join smoothly
  • This is the idea of spline curves (splines)

52
Spline curves
  • Many different types
  • Some are better for interpolation
  • Others for geometric modeling
  • Main Types
  • Hermite interpolation
  • Catmull-Rom Splines
  • Bezier curves
  • Other types
  • Splines with tension (Tension Continuity Bias
    TCB)
  • B-splines
  • NURBS

53
Comparison of Basic Cubic Splines
Write a Comment
User Comments (0)
About PowerShow.com