Compuer Animation(Postgraduate Course): Lecture 4:Keyframe interpolation and velocity control
Lecture 4: Keyframe interpolation and velocity control
动画中的运动感控制:
-
运动的表示: 用数学方法来表示各类物体的运动
-
运动的控制和编辑: 给动画师提供能够表达他意图的方便、直观的控制工具
-
运动的生成: 计算每一帧所需的各种运动参数
Goal:再现物理世界的运动,超越物理世界的运行。
I.Interpolation between key frames
1.Parameters to be interpolated:
-
Position of an object
-
Scale of an object
-
Orientation of an object
-
Joint angle between two joints
-
Color attribute of an object
2.Interpolation between frames is not trivial:
-
Appropriate interpolation function
-
Parameterization of the function
-
Maintain the desired control of the interpolated values over time
3.Solution:
-
Generate a space curve
-
Distribute points evenly along curve
-
Speed control: vary points
4.Interpolation v.s. Approximation:
-
An interpolating spline in which the spline passes through the interior control points.
-
An approximating spline in which only the endpoints are interpolated; the interior control points are used only to design the curve.
5.Interpolation function:
-
Complexity -> computational efficiency:
-
Polynomials
-
Lower than cubic: No inflection point, may not fit smoothly to some data points
-
Higher than cubic: Doesn’t provide any significant advantages, costly to evaluate
-
Piecewise cubic: Provides sufficient smoothness; Allows enough flexibility to satisfy constraints such as end-point position and tangents.
-
Continuity within a curve:
-
Zero-order
-
First order(tangential): Suffices for animation applications
-
Second order: Important when dealing with time-distance curve
-
Continuity between curve segments: Hermite, Catmull-Rom, cubic Bezier provide first order continuity between segments.
Local control: moving one control point only change the curve over a finite bounded region
Global control: moving one control point changes the entire curve; distant sections may change only slightly.
6.Types of Curve Representation
-
Explicit:
-
Good for generating points
-
For each input, there is a unique output
-
Implicit
-
Good for testing if a point is on a curve
-
Bad for generating a sequence of points
-
Parametric
-
Good for generating a sequence of points
-
Can be used for multi-valued function of
Parametric form: :
II.Polynomial Interpolation
-
An -th degree polynomial fits a curve to points, called Lagrange Interpolation.
-
Result is a curve that is too wiggly, change to any control affects entire curve(nonlocal)—this method is poor.
-
We usually want the curve to be as smooth as possible:
-
minimize the wiggles
-
high-degree polynomials are bad
-
Composite Segment
-
Divide a curve into multiple segments
-
Represent each in a parametric form
-
Maintain continuity between segments
-
position
-
Tangent(C1-continuity v.s. G1-continuity)
-
curvature
-
Spline:Piecewise Polynomials
-
A spline is a piecewise polynomial - many low degree polynomials are used to interpolate(pass through) thr control points
-
Cubic polynomials are the most common
-
lowest order polynomials that interpolate two points and allow the gradient at each point to be defined -C1 continuity is possible
-
Higher or lower degree are possible, of course.
-
A Linear Piecewise Polynomial
III.Hermite Interpolation
-
Hermite Curves-cubic polynomial for two points
-
Hermite interpolation requires: Endpoint positions, derivatives at endpoints
-
To create a composite curve, use the end of one as the beginning of the other and share the tangent vector.
-
Solution:
-
Blending Functions of Hermite Splines
Each cubic Hermite spline is a linear combination of 4 blending functions
- Composite Hermite Curve: Continuity between connected segments is ensured by using ending tangent vector of one segment as the beginning tangent vector of the next.
IV.Bezier Curves
Instead of endpoints and tangents, four control points are given:
-
points and are on the curve
-
points and are used to control the shape
-
-
Another representation: Blend the control point position using Bernstein polynomials
where are Bernstein polynomials
How to control the continuity between adjacent Bezier segment? by using ending tangent vector of one segment as the beginning tangent vector of the next.
De Casteljau Construction
Variant of the Hermite spline: basis matrix derived from the Hermite basis (or from scratch)
Givens more uniform control knobs (series of points) than Hermite.
V. Catmull-Rom Splines
With Hermite splines, the designer must arrange for consecutive tangents to be collinear, to get continuity. Similar for Bezier. This gets tedious.
Catmull-Rom: an interpolating cubic spline with built-in continuity.
Compared to Hermite/Bezier: fewer control points required, but less freedom.
Given n control points in 3-D: ,
-
Tangent at given by for , for some
-
Curve between and is determined by
-
What about endpoint tangents? (several good answers: extrapolate, or use extra control points ,)
-
Now we have positions and tangents at each knot - a Hermite specification
Drawback:
An interval tangent is not dependent on the position of the internal point relative to its neighbors.
VI. Speed Control
-
The speed of tracing a curve needs to be under the direct control of the animator.
-
Varying at a constant rate will not necessarily generate at a constant speed.
Generally, equally spaced samples in parameter space are not equally spaced along the curve
Arc Length Reparameterization
-
To ensure a constant speed for the interpolated value, the curve has to parameterized by arc length (for most applications)
-
Computing arc length
-
Analytic methods (many curves do not have, e.g., B-splines)
-
Numeric methods:
-
Table and differencing
-
Gaussian quadrature
-
Space curve vs. time-distance function: Relates time to the distance traveled along the curve, i.e., relates time to the arc length along the curve.
Given an arc-length parameterized space curve, how to control the speed at which the curve is traced ? By a speed-control function that relates an equally spaced time interval to arc length:
-
Input time , output are length:
-
Linear function: constant speed control
-
Most common: ease-in/ease-out: Smooth motion from position, accelerate, reach a max velocity, and then decelerate to a stop position.