Linear Interpolation
How it *really* Works

Keyframes

The extent to which an image changes from one frame to the next and methods for controlling such changes are obviously important in sustaining the illusion of motion. A common basic means for envisioning and executing a series of changing images is to use keyframes describing the extremes of a character's motion. Deducing the other ``in-between'' frames then requires little artistic decision making. In traditional animation houses, an animator draws the keyframes and assistants and ``inbetweeners'' draw the inbetween frames. However, even with acetate cels to layer images and reuse stationary components, this is an extremely time-consuming task that requires skill and patience. Even a five minute animation movie short, for instance, has 5 minutes x 60 seconds/minute x 24 frames/second = 7,200 frames, and a feature length film has over a hundred thousand. Although keyframes and pencil tests (sequences drawn with outlines and not yet filled in with colors) provide some feedback before each frame is created in full detail, the traditional process requires very careful advance planning and last minute experimentation can be prohibitively expensive.

Inbetweening

The computer can expedite the animation process by producing inbetween frames automatically. In the simple scenario in Figure 1, the goal is to animate a ball thrown in the air--starting at ground level, rising into the air while moving sideways, and returning to the ground. The three keyframes needed are the ball's beginning and end positions and highest point. Now, instead of drawing the intermediate frames by hand, the artist can choose to inbetween these frames automatically.

Linear Interpolation

The simplest kind of automatic inbetweening is linear inbetweening which is done with a mathematical process of guessing intermediate locations called linear interpolation. To interpolate simple means to calculate a new value inbetween two known values. Linear interpolation creates new values at equal distances along a line between two known values. In animating an object moving between two points in space, linear inbetweening creates new frames at equal intervals along a straight line between two of the keyframes, as in Figure 2. The number of intervals (and thus number of frames) is determined by the user. If two of the keyframes are one second apart, for example, and the artist has specified that the animation should run at ten frames/second, then the time between the frames is represented by 10 frames shown at ten equal intervals.


Key Frame Animation

Key frames mark important visual transitions (extremes of action).

Inbetweening is creation of intermediate frames between the key frames. Can be calculated by computer.

Temporal Sampling

A digitized image is composed of discrete samples of a continuous image, arranged to create the illusion of a continuous picture

Similarly, film recording takes samples of an image at fixed time intervals--i.e., temporal samples. When these are arranged and played at a certain rate (24 frames/sec. for film, 30 frames/sec. for video, 60 to 70 for some fast-moving computer graphics applications) an illusion of continuous motion is created.

Inbetweening is letting the computer produce additional temporal samples (frames) between predefined key frames in an animation.

Problem: hard to create truly life-like animation unless keyframes are designed for almost every other frame. True in both computer and traditional animation.

Computer inbetweening often used as aid for storyboarding, testing sequences (as in Jurassic Park).

Geometric Transformation
and Animation

An important distinction

Geometric transformations do not create motion--they cause instantaneous changes.

Intermediate frames necessary to create illusion of motion (animation) are created by calculating additional transformations (inbetweening).

The Math Behind Inbetweening

New way of thinking about linear paths that will enable us to calculate the inbetween frames. Let's begin with lines:

Given a line segment from v1 to v2, how to express midpoint? Use equal combinations of both point positions:

x = 1/2 (x1 + x2) = (1/2) x1 + (1/2) x2

y = 1/2 (y1 + y2) = (1/2) y1 + (1/2) y2

Three-fourths of the way? Use a combination of three quarters of the final destination and one quarter of the starting point:

x = (1/4) x1 + (3/4) x2

y = (1/4) y1 + (3/4) y2

Can think of this as weighted averages of point positions

Math of Inbetweening (cont.)

So how is this related to inbetweening? By letting our position on this very practically defined line depend on another variable such as elapsed time (represented by the letter t--but note that t does not have to be time)

Conveniently, we have defined our trip to begin at t = 0 and end at t = 1.

So, for a parameter t

x = (1 - t) x1 + tx2

y = (1 - t) y1 + ty2

Because the line definition now depends on a third parameter (not x or y, but t) it is called a parametric equation.

Advantage of Parametric vs. Explicit Line Definition

Explicit (y in terms of x) line definition:

y = mx + b, m = dx/dy; how best to deal with

vertical slope?

finite lines (line segments)?

Parametric (y and x in terms of t):

x = (1 - t) x1 + tx2,

y = (1 - t) y1 + ty2, 0 # t #1

for vertical slope (x1 = x2)

for t = 0, x = x1, y = y1

for t = 1, x = x2, y = y2

restricted range of t defines a segment, not a whole line:

t < 0, (x, y) lies ``before'' it

t > 1, (x, y) lies ``after'' it

Linear Interpolation

Used to calculate inbetween frames.

Used to move a point along a vector, with parametric line definition.

Given corresponding vertices v1 and v2 of an object at keyframes 1 and 2 respectively, the position of v during the intermediate frames calculated for a time t by

vt = (1 - t)v1 + tv2

value of t ranges from 0 to 1 (0 # t # 1)

at t = 0, vt = (1 - 0)v1 + (0)v2 = v1

at t = 1, vt = (1 - 1)v1 + (1)v2 = v2

at t = 1/2, vt = (1/2)v1 + (1/2)v2, etc.

Example: Linear Interpolation--Translation and Size

The points of the interpolated house are halfway between the two initial houses, resulting in a house that is half the size.

No scaling transformation has been applied!

The scaling of the house is a result only of interpolating between the different sized houses in the key frames.

Other Parameters to Linearly Interpolate

Rotation

Color

Surface properties

Transparency

Lighting

Shape

Camera focal length

Example: Interpolated Shapes--1

Here first and last shapes have equal number of vertices.

Half-way shape may look nothing like beginning or end shapes.

Example: Interpolated Shapes--2

Here first and last shapes have unequal number of vertices.

Correspondence has been achieved by adding additional vertices at midpoints of line segments in first shape (only one of many possible methods).

Interpolation Along Polylines

Approach: treat each segment vi to vi+1 separately:

first vt = (1 - t) v1 + tv2

then vt = (1 - t) v2 + tv3

then vt = (1 - t) v3 + tv4

etc.