CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai
Key-frame Interpolation Given parameter values at key frames, how to interpolate parameter values for inbetween frames. θ t
Key-frame Interpolation Given parameter values at key frames, how to interpolate parameter values for inbetween frames. θ t
Key-frame Interpolation Given parameter values at key frames, how to interpolate parameter values for inbetween frames. θ t Nonlinear interpolation
Review: Natural cubic cruves
Review: Natural cubic cruves
Review: Natural cubic cruves
Review: Natural cubic curves
Review: Hermite Curves P1 R1 P4 R4 P1: start position P4: end position R1: start derivative R4: end derivative
Review: Hermite Curves P1 R1 P4 R4
Review: Hermite Curves P1 R1 P4 R4 Herminte basis matrix
Review: Hermite Curves P1 R1 P4 R4 Herminte basis matrix
Review: Hermite Curves P1 R1 P4 R4
Review: Hermite Curves P1 R1 P4 R4
Review: Hermite Curves P1 R1 P4 R4
Review: Hermite Curves P1 R1 P4 R4
Review: Hermite Curves P1 R1 P4 R4 Hermite basis functions
Review: Hermite Curves P1 R1 P4 R4 basis function 1 basis function 1 basis function 1 basis function 1
Review: Hermite Curves P1 R1 P4 R4 *R1 *R4 *P1 + *P4 + + =
Review: Bezier Curves
Review: Bezier Curves
Review: Bezier Curves
Review: Bezier Curves
Review: Bezier Curves *v1 *v2 *v3 *v0 + + + =
Review: Different basis functions Cubic curves: Hermite curves: Bezier curves:
Complex curves Suppose we want to draw or interpolate a more complex curve
Complex curves Suppose we want to draw or interpolate a more complex curve How can we represent this curve?
Complex curves Suppose we want to draw a more complex curve Idea: we’ll splice together a curve from individual segments that are cubic Béziers
Complex curves Suppose we want to draw or interpolate a more complex curve Idea: we’ll splice together a curve from individual segments that are cubic Béziers
Splines A piecewise polynomial that has a locally very simple form, yet be globally flexible and smooth
Splines There are three nice properties of splines we’d like to have - Continuity - Local control - Interpolation
Continuity C0: points coincide, velocities don’t C1: points and velocities coincide What’s C2? - points, velocities and accelerations coincide
Continuity Cubic curves are continuous and differentiable We only need to worry about the derivatives at the endpoints when two curves meet
Local control We’d like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point
Local control We’d like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point
Local control We’d like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point
Interpolation 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
B-splines We can join multiple Bezier curves to create B-splines Ensure C2 continuity when two curves meet
Derivatives at end points
Derivatives at end points
Derivatives at end points
Derivatives at end points
Derivatives at end points
Derivatives at end points
Continuity 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
Continuity 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
Continuity 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
Continuity 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
Continuity 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
Continuity 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
Continuity in B splines What does this derived equation mean geometrically? - What is the relationship between a, b and c, if a = 2b - c? w2=v1+4v3-4v2
de Boor points Instead of specifying the Bezier control points, let’s 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
de Boor points What is the relationship between Bezier control points and de Boor points? Verify this by yourself!
B spline basis matrix
Building 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
B splines properties √ Continuity √ Local control x Interpolation
Catmull-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
Catmull-Rom splines
Catmull-Rom splines The segment is controlled by p1,p2,p3,p4 0.5
Catmull-Rom splines The segment is controlled by p1,p2,p3,p4
Catmull-Rom splines The effect of t: how sharply the curve bends at the control points
Catmull-Rom splines The segment is controlled by p1,p2,p3,p4
Catmull-Rom splines From Hermite curves
Catmull-Rom splines From Hermite curves
Catmull-Rom splines From Hermite curves
Catmull-Rom splines
Catmull-Rom splines
Catmull-Rom splines What do we miss?
Catmull-Rom splines ? ?
Catmull-Rom splines
Catmull-Rom splines Catmull-Rom splines have C1 continuity (not C2 continuity) Do not lie within the convex hull of their control points.
Catmull-Rom splines Catmull-Rom splines have C1 continuity (not C2 continuity) Do not lie within the convex hull of their control points.
Catmull-Rom splines properties X Continuity (C2) √ Local control √ Interpolation
Keyframe Interpolation t=50ms t=0
Curves 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 θ = y(u) t = x(u) where θ is a variable you want to animate and t is a time index. We can think of the results as a function: θ(t) θ t u u
Keyframing interpolation is a two-step algorithm: - Compute the spline parameter u corresponding to the time t: t=x(u) u
Keyframing interpolation is a two-step algorithm: - Compute the spline parameter u corresponding to the time t: how to evaluate the inverse function?
Keyframing 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 (t=u) - complex function: finite difference or numerically root finding
Keyframing 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) u
Outline Process of keyframing Key frame interpolation Hermite and bezier curve Splines Speed control
Spline parameterization The spline is parameterized by u (0<=u<=1) and not by time t.
Spline parameterization The spline is parameterized by u (0<=u<=1) 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
Spline parameterization Solution: reparameterize the curve in terms of t - express spline as a function of the arc length s: u=g(s) - express the arc length s as a function of t: s=f(t)
Speed control Simplest form is to have constant velocity along the path s=f(t)
Arc-length reparameterization Now we want a way to find u given a particular arclength s: u=g(f(t)) Not possible analytically for most curves (e.g. B-splines)
What’s parametric value for the arc length .08? Finite 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) What’s parametric value for the arc length .08?
Finite 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)
What’s parametric value for the arc length .08? Finite 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) What’s parametric value for the arc length .08?
What’s parametric value for the arc length .08? Finite 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) What’s parametric value for the arc length .08?
Finite 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) What’s parametric value for the arc length .05? A linear interpolation of 0.00 and 0.05
Speed 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