CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai
Outline Keyframe interpolation Curve representation and interpolation - natural cubic curves - Hermite curves - Bezier curves Required readings: 12-6 & 14-1 14-214-3 14-4, & 14-7
Computer Animation Animation - making objects moving Compute animation - the production of consecutive images, which, when displayed, convey a feeling of motion.
Animation Topics Rigid body simulation - bouncing ball - millions of chairs falling down
Animation Topics Rigid body simulation - bouncing ball - millions of chairs falling down Natural phenomenon - water, fire, smoke, mud, etc.
Animation Topics - articulated motion, e.g. full-body animation Rigid body simulation - bouncing ball - millions of chairs falling down Natural phenomenon - water, fire, smoke, mud, etc. Character animation - articulated motion, e.g. full-body animation - deformation, e.g. face
Animation Topics - articulated motion, e.g. full-body animation Rigid body simulation - bouncing ball - millions of chairs falling down Natural phenomenon - water, fire, smoke, mud, etc. Character animation - articulated motion, e.g. full-body animation - deformation, e.g. face Cartoon animation
Animation Criterion - rigid body-simulation - character animation Physically correct - rigid body-simulation - natural phenomenon Natural looking - character animation Expressive - cartoon animation
Keyframe Animation
Keyframe Interpolation Key frame interpolation in after effects (Click here)
Spatial Key Framing Demo video (click here)
Keyframe Interpolation t=50ms t=0 IK can be used to create Key poses
Keyframe Interpolation t=50ms t=0 What’s the inbetween motion?
Outline Process of keyframing Key frame interpolation Hermite and bezier curve Splines Speed control
2D Animation Highly skilled animators draw the key frames Less skilled (lower paid) animators draw the in-between frames Time consuming process Difficult to create physically realistic animation
Animating a Bouncing Ball Key frames
Animating Three Walking Steps Key frames
Playing Basketball
3D Animation Animators specify important key frames in 3D Computers generates the in-between frames Some dynamic motion can be done by computers (hair, clothes, etc) Still time consuming; Pixar spent four years producing Toy Story
3D Bouncing Ball
3D Jumping
The Process of Keyframing Specify the keyframes Specify the type of interpolation - linear, cubic, parametric curves Specify the speed profile of the interpolation - constant velocity, ease-in-ease-out, etc Computer generates the in-between frames
A Keyframe In 2D animation, a keyframe is usually a single image In 3D animation, each keyframe is defined by a set of parameters
Keyframe Parameters What are the parameters? position and orientation body deformation facial features hair and clothing lights and cameras
Outline Process of keyframing Key frame interpolation Hermite and bezier curve Splines Speed control
Inbetween Frames Linear interpolation Cubic curve interpolation
Keyframe Interpolation t=50ms t=0
Linear Interpolation Linearly interpolate the parameters between keyframes x1 x x0 t0 t t1
Linear Interpolation: Limitations Requires a large number of key frames when the motion is highly nonlinear.
Cubic Curve Interpolation We can use a cubic function to represent a 1D curve
Smooth Curves Controlling the shape of the curve
Smooth Curves Controlling the shape of the curve
Smooth Curves Controlling the shape of the curve
Smooth Curves Controlling the shape of the curve
Smooth Curves Controlling the shape of the curve
Smooth Curves Controlling the shape of the curve
Constraints on the cubics How many points do we need to determine a cubic curve?
Constraints on the Cubic Functions How many points do we need to determine a cubic curve?
Constraints on the Cubic Functions How many points do we need to determine a cubic curve? 4
Constraints on the Cubic Functions How many points do we need to determine a cubic curve? 4
Natural Cubic Curves Q(t1) Q(t2) Q(t3) Q(t4)
Interpolation Find a polynomial that passes through specified values
Interpolation Find a polynomial that passes through specified values
Interpolation Find a polynomial that passes through specified values
Interpolation Find a polynomial that passes through specified values
2D Trajectory Interpolation Each point on the trajectory is associated with a time stamp t. Perform interpolation for each component separately Combine result to obtain parametric curve
2D Trajectory Interpolation Each point on the trajectory is associated with a time stamp t. Perform interpolation for each component separately Combine result to obtain parametric curve
2D Trajectory Interpolation Each point on the trajectory is associated with a time stamp t. Perform interpolation for each component separately Combine result to obtain parametric curve
Limitation? What’s the main limitation of interpolation using natural cubic curves?
Limitation? What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve
Constraints on the Cubic Curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve
Constraints on the Cubic Curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve Changes of any control point will change the shape of the whole curve!
Constraints on the Cubic Curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve Redefine C as a product of the basis matrix M and the control vector G: C= MG
Constraints on the cubic curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve Redefine C as a product of the basis matrix M and the control vector G: C= MG MG
Constraints on the Cubic Curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve Redefine C as a product of the basis matrix M and the control vector G: C= MG M G
Constraints on the Cubic Curves What’s the main limitation of interpolation using natural cubic curves? - does not provide local control of the curve Redefine C as a product of the basis matrix M and the control vector G: C= MG M? G?
Two Issues How to select a new set of control points for local control of the curve? How to determine M? M?
Outline Process of keyframing Key frame interpolation Hermite and bezier curve Splines Speed control
Hermite Curve - endpoints P1 and P4 A Hermite curve is determined by - tangent vectors R1 and R4 at the endpoints R1 P4 R4 P1
Hermite Curve - endpoints P1 and P4 A Hermite curve is determined by - tangent vectors R1 and R4 at the endpoints Use these elements to control the curve, i.e. construct control vector R1 P4 R4 P1 Mh Gh 0<=t<=1
Hermite Basis Matrix - endpoints meet P1 and P4 Given desired constraints: - endpoints meet P1 and P4 Q(0) = [0 0 0 1 ] · Mh · Gh = P1 Q(1) = [1 1 1 1 ] · Mh · Gh = P4 - tangent vectors meet R1 and R4
Tangent Vectors
Tangent Vectors
Hermite Basis Matrix - endpoints meet P1 and P4 Given desired constraints: - endpoints meet P1 and P4 Q(0) = [0 0 0 1 ] · Mh · Gh = P1 Q(1) = [1 1 1 1 ] · Mh · Gh = P4 - tangent vectors meet R1 and R4 Q’(0) =[0 0 1 0] · Mh · Gh =R1 Q’(1) =[3 2 1 0] · Mh · Gh =R4
Hermite Basis Matrix - endpoints meet P1 and P4 Given desired constraints: - endpoints meet P1 and P4 Q(0) = [0 0 0 1 ] · Mh · Gh = P1 Q(1) = [1 1 1 1 ] · Mh · Gh = P4 - tangent vectors meet R1 and R4 Q’(0) =[0 0 1 0] · Mh · Gh =R1 Q’(1) =[3 2 1 0] · Mh · Gh =R4 So how to compute the basis matrix Mh?
Hermite Basis Matrix Taking them together Q(0) = [0 0 0 1 ] · Mh · Gh = P1 Q(1) = [1 1 1 1 ] · Mh · Gh = P4 Q’(0) = [0 0 1 0] · Mh · Gh = R1 Q’(1) = [3 2 1 0] · Mh · Gh = R4
Hermite Basis Matrix We can solve for basis matrix Mh Mh
Hermite Basis Matrix We can solve for basis matrix Mh Mh
Hermite Basis Matrix P1 R1 P4 R4
Bezier Curve Indirectly specify tangent vectors by specifying two intermediate points P1 P3 P2 P4
Bezier Curve Indirectly specify tangent vectors by specifying two intermediate points P1 P3 P2 P4 The curve starts at P1 going towards P2 and Arrives at P4 coming from the direction P3 usually does not pass through P2 or P3; these points are only there to provide directional information.
Bezier Curve Indirectly specify tangent vectors by specifying two intermediate points P1 P3 P2 P4
Bezier Curve Indirectly specify tangent vectors by specifying two intermediate points P1 P3 P2 P4 How to compute the basis matrix Mb?
Bezier Basis Matrix Establish the relation between Hermite and Bezier control vectors
Bezier Basis Matrix Establish the relation between Hermite and Bezier control vectors
Bezier Basis Matrix Establish the relation between Hermite and Bezier control vectors Mhb Gb
Bezier Basis Matrix For Hermite curves, we have For Bezier curves, we have
Bezier Basis Matrix For Hermite curves, we have For Bezier curves, we have
Bezier Basis Matrix P2 P1 P4 P3
How to interpolate a 3D curve y o x z
How to interpolate a 3D curve y o x z Bezier curve
Bezier java applet Try this online at - Move the interpolation point, see how the others (and the point on curve) move - Control points (can even make loops) http://www.cse.unsw.edu.au/~lambert/splines/
Different basis functions Cubic curves: Hermite curves: Bezier curves:
Complex curves Suppose we want to draw a more complex curve
Complex curves Suppose we want to draw a more complex curve How can we represent this curve?
Complex curves Suppose we want to draw a more complex curve Why not use a high-order Bézier? - Wiggly curves - No local control
Complex curves Suppose we want to draw a more complex curve Why not use a high-order Bézier? - Wiggly curves - No local control Instead, we’ll splice together a curve from individual segments that are cubic Béziers
Complex curves Suppose we want to draw a more complex curve Why not use a high-order Bézier? - Wiggly curves - No local control Instead, we’ll splice together a curve from individual segments that are cubic Béziers
Complex curves Suppose we want to draw a more complex curve Why not use a high-order Bézier? - Wiggly curves - No local control Instead, we’ll splice together a curve from individual segments that are cubic Béziers
Complex curves Suppose we want to draw a more complex curve Why not use a high-order Bézier? - Wiggly curves - No local control Instead, we’ll splice together a curve from individual segments that are cubic Béziers Why cubic? - Lowest dimension with control for the second derivative - Lowest dimension for non-planar polynomial curves
Next lecture Spline curve and more key frame interpolation