Title: CPSC 441: Keyframe AnimationSmooth Curves Cont'
1CPSC 441 Keyframe Animation/Smooth Curves
(Cont.)
2Key-frame Interpolation
- Given parameter values at key frames, how to
interpolate parameter values for inbetween frames.
?
t
3Key-frame Interpolation
- Given parameter values at key frames, how to
interpolate parameter values for inbetween frames.
?
t
4Key-frame Interpolation
- Given parameter values at key frames, how to
interpolate parameter values for inbetween frames.
?
t
Nonlinear interpolation
5Review Natural cubic cruves
6Review Natural cubic cruves
7Review Natural cubic cruves
8Review Natural cubic curves
9Review Hermite Curves
P1 start position P4 end position R1 start
derivative R4 end derivative
10Review Hermite Curves
11Review Hermite Curves
Herminte basis matrix
12Review Hermite Curves
Herminte basis matrix
13Review Hermite Curves
14Review Hermite Curves
15Review Hermite Curves
16Review Hermite Curves
17Review Hermite Curves
Hermite basis functions
18Review Hermite Curves
basis function 1
basis function 1
basis function 1
basis function 1
19Review Hermite Curves
R1
R4
P1
P4
20Review Bezier Curves
21Review Bezier Curves
22Review Bezier Curves
23Review Bezier Curves
24Review Bezier Curves
v2
v3
v1
v0
25Computer animation
- Animation
- - making objects moving
- Compute animation
- - the production of consecutive images, which,
when displayed, convey a feeling of motion. -
26Review Different basis functions
- Cubic curves
- Hermite curves
- Bezier curves
27Complex curves
- Suppose we want to draw a more complex curve
-
28Complex curves
- Suppose we want to draw a more complex curve
-
How can we represent this curve?
29Complex curves
- Suppose we want to draw a more complex curve
-
-
- Idea well splice together a curve from
individual segments that are cubic Béziers
30Complex curves
- Suppose we want to draw a more complex curve
-
- Idea well splice together a curve from
individual segments that are cubic Béziers
31Splines
- A piecewise polynomial that has a locally very
simple form, yet be globally flexible and smooth
32Splines
- There are three nice properties of splines wed
like to have - - Continuity
- - Local control
- - Interpolation
33Continuity
- C0 points coincide, velocities dont
- C1 points and velocities coincide
- Whats C2?
- - points, velocities and accelerations coincide
34Continuity
- Cubic curves are continuous and differentiable
- We only need to worry about the derivatives at
the endpoints when two curves meet
35Local control
- Wed like our spline to have local control
- - that is, have each control point affect some
well-defined neighborhood around that point
36Local control
- Wed like our spline to have local control
- - that is, have each control point affect some
well-defined neighborhood around that point
37Local control
- Wed like our spline to have local control
- - that is, have each control point affect some
well-defined neighborhood around that point
38Interpolation
- Bézier curves are approximating
- - The curve does not (necessarily) pass
through all the control points - - Each point pulls the curve toward it, but
other points are pulling as well - Instead, we may prefer a spline that is
interpolating - - That is, that always passes through every
control point
39B-splines
- We can join multiple Bezier curves to create
B-splines - Ensure C2 continuity when two curves meet
40Derivatives at end points
41Derivatives at end points
42Derivatives at end points
43Derivatives at end points
44Derivatives at end points
45Derivatives at end points
46Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
47Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
48Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
49Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
50Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
51Continuity in B splines
- Suppose we want to join two Bezier curves (V0,
V1, V2,V3) and (W0, W1, W2, W3) so that C2
continuity is met at the joint
52Continuity in B splines
- What does this derived equation mean
geometrically? - - What is the relationship between a, b and c,
if a 2b - c?
w2v14v3-4v2
53de Boor points
- Instead of specifying the Bezier control points,
lets specify the corners of the frames that
forms a B-spline - These points are called de Boor points and the
frames are called A-frames
54de Boor points
- What is the relationship between Bezier control
points and de Boor points?
Verify this by yourself!
55B spline basis matrix
56Building complex splines
- Constraining a Bezier curve made of many segments
to be C2 continuous is a lot of work - - for each new segment we have to add 3 new
control point - - only one of the control points is really
free - B-splines are easier (and C2)
- - First specify 4 vertices (de Boor points),
then one per segment
57B splines properties
- v Continuity
- v Local control
- x Interpolation
58Catmull-Rom splines
- If we are willing to sacrifice C2 continuity, we
can get interpolation and local control. - If we set each derivative to be a constant
multiple of the vector between the previous and
the next controls, we get a Catmull-Rom spline
59Catmull-Rom splines
60Catmull-Rom splines
The segment is controlled by p1,p2,p3,p4
0.5
61Catmull-Rom splines
The segment is controlled by p1,p2,p3,p4
62Catmull-Rom splines
- The effect of t how sharply the curve bends at
the control points
63Catmull-Rom splines
The segment is controlled by p1,p2,p3,p4
64Catmull-Rom splines
From Hermite curves
65Catmull-Rom splines
From Hermite curves
66Catmull-Rom splines
From Hermite curves
67Catmull-Rom splines
68Catmull-Rom splines
69Catmull-Rom splines
What do we miss?
70Catmull-Rom splines
?
?
71Catmull-Rom splines
72Catmull-Rom splines
- Catmull-Rom splines have C1 continuity (not C2
continuity) - Do not lie within the convex hull of their
control points.
73Catmull-Rom splines
- Catmull-Rom splines have C1 continuity (not C2
continuity) - Do not lie within the convex hull of their
control points.
74Catmull-Rom splines properties
- X Continuity (C2)
- v Local control
- v Interpolation
75Curves in the animation
- Interpolate each parameter separately
- Each animation parameter is described by a 2D
curve - Q(u) (x(u), y(u))
- Treat this curve as
- ?(u) y(u)
- t(u) x(u)
- where ? is a variable you want to animate. We can
- think of the results as a function ?(t)
?(u)
t(u)
u
u
76Keyframing interpolation
- is a two-step algorithm
- - Compute the spline parameter u corresponding
to the time t
x(u)
u
77Keyframing interpolation
- is a two-step algorithm
- - Compute the spline parameter u corresponding
to the time t - how to evaluate the inverse function?
78Keyframing interpolation
- is a two-step algorithm
- Compute the spline parameter u corresponding to
the time t - how to evaluate the inverse function?
- - linear function easy (tu)
- - complex function finite difference or
numerically root finding -
79Keyframing interpolation
- is a two-step algorithm
- Compute the spline parameter u corresponding to
the time t - how to evaluate the inverse function?
- - linear function easy
- - complex function finite difference or
numerically root finding - Compute the ? corresponding to the spline
parameter u - ? y(u)
y(u)
u
80Outline
- Process of keyframing
- Key frame interpolation
- Hermite and bezier curve
- Splines
- Speed control
81Spline parameterization
- The spline is parameterized by u (0ltult1) and
not by time t.
82Spline parameterization
- The spline is parameterized by u (0ltult1) and
not by time t. - Hard to deal with the questions like
- What is the location of point p at time t
- What is the velocity of point p at time t
- What is the acceleration a of a point p at time t
83Spline parameterization
- Solution reparameterize the curve in terms of t
- - express spline as a function of the arc
length s ug(s) - - express the arc length s as a function of t
sf(t)
84Speed control
- Simplest form is to have constant velocity along
the path
sf(t)
85Arc-length reparameterization
- Now we want a way to find u given a particular
arclength s ug(f(t) - Not possible analytically for most curves (e.g.
B-splines)
86Finite difference
- Sample the curve at small intervals of the
parameter and determine the distance between
samples - Use theses distances to build a table of
arclength for this particular curve (ui,si)
Whats parametric value for the arc length .08?
87Finite difference
- Sample the curve at small intervals of the
parameter and determine the distance between
samples - Use theses distances to build a table of
arclength for this particular curve (ui,si)
88Finite difference
- Sample the curve at small intervals of the
parameter and determine the distance between
samples - Use theses distances to build a table of
arclength for this particular curve (ui,si)
Whats parametric value for the arc length .08?
89Finite difference
- Sample the curve at small intervals of the
parameter and determine the distance between
samples - Use theses distances to build a table of
arclength for this particular curve (ui,si)
Whats parametric value for the arc length .08?
90Finite difference
- Sample the curve at small intervals of the
parameter and determine the distance between
samples - Use theses distances to build a table of
arclength for this particular curve (ui,si)
Whats parametric value for the arc length .05? A
linear interpolation of 0.00 and 0.05
91Speed control recipe
- Given a time t, lookup the corresponding
arclength S in the speed curve - For S, look up the corresponding value of u in
the reparameterization table - Evaluate the curve at u to obtain the correct
interpolated position for the animated object for
the given time t