# CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.

date post

08-Jan-2018Category

## Documents

view

213download

0

Embed Size (px)

description

### Transcript of CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.

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 curves Properties: - Go through four control points - not good for local control Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 P 1 : start position P 4 : end position R 1 : start derivative R 4 : end derivative Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 P1P1 R1R1 P4P4 R4R4 Herminte basis matrix Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 Herminte basis matrix Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 P1P1 R1R1 P4P4 R4R4 P1P1 R1R1 P4P4 R4R4 P1P1 R1R1 P4P4 R4R4 P1P1 R1R1 P4P4 R4R4 Hermite basis functions Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 basis function 1basis function 2basis function 3 basis function 4 Review: Hermite Curves P1P1 R1R1 P4P4 R4R4 *P 1 *P 4 *R 1 *R = Review: Bezier Curves *v 0 *v 1 *v 2 *v = Cubic curves: Hermite curves: Bezier curves: Review: Different basis functions 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: well splice together a curve from individual segments that are cubic Bziers Complex curves Suppose we want to draw or interpolate a more complex curve Idea: well splice together a curve from individual segments that are cubic Bziers 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 wed like to have - Continuity - Local control - Interpolation Continuity C 0 : points coincide, velocities dont C 1 : points and velocities coincide Whats C 2 ? - 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 Wed like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point Local control Wed like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point Local control Wed like our spline to have local control - that is, have each control point affect some well-defined neighborhood around that point Interpolation Bzier 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 - the curve is always located within the convex hull based on control points. 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 C 2 continuity when two curves meet Derivatives at end points Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 continuity is met at the joint Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 continuity is met at the joint Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 continuity is met at the joint Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 continuity is met at the joint Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 continuity is met at the joint Continuity in B splines Suppose we want to join two Bezier curves (V 0, V 1, V 2,V 3 ) and (W 0, W 1, W 2, W 3 ) so that C 2 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? b is the middle point of a and c. w 2 =v 1 +4v 3 -4v 2 de 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 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 C 2 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 C 2 ) - 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 C 2 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 control points, we get a Catmull-Rom spline Catmull-Rom splines The segment is controlled by p 1,p 2,p 3,p 4 0.5 Catmull-Rom splines The segment is controlled by p 1,p 2,p 3,p 4 Catmull-Rom splines The effect of t: how sharply the curve bends at the control points Catmull-Rom splines The segment is controlled by p 1,p 2,p 3,p 4 Catmull-Rom splines From Hermite curves Catmull-Rom splines From Hermite curves Catmull-Rom splines From Hermite curves Catmull-Rom splines What do we miss? Catmull-Rom splines ? ? Catmull-Rom splines have C 1 continuity (not C 2 continuity) Do not lie within the convex hull of their control points. Catmull-Rom splines Catmull-Rom splines have C 1 continuity (not C 2 continuity) Do not lie within the convex hull of their control points. Catmull-Rom splines properties X Continuity (C 2 ) Local control Interpolation Keyframe Interpolation t=0 t=50ms 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) u u t Keyframing interpolation is a two-step algorithm: - Compute the spline parameter u corresponding to the time t: u t=x(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: u = y(u) Outline Process of keyframing Key frame interpolation Hermite and bezier curve Splines Speed control Spline parameterization The spline is parameterized by u (0

Recommended

*View more*