Title: CPSC 441 Computer Graphics: Keyframe AnimationSmooth Curves
1CPSC 441 Computer Graphics Keyframe
Animation/Smooth Curves
2Outline
- Keyframe interpolation
- Curve representation and interpolation
- - natural cubic curves
- - Hermite curves
- - Bezier curves
- Required readings HB 8-8,8-9, 8-10
3Computer animation
- Animation
- - making objects moving
- Compute animation
- - the production of consecutive images, which,
when displayed, convey a feeling of motion. -
4Animation topics
- Rigid body simulation
- - bouncing ball
- - millions of chairs falling down
5Animation topics
- Rigid body simulation
- - bouncing ball
- - millions of chairs falling down
- Natural phenomenon
- - water, fire, smoke, mud, etc.
6Animation topics
- 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
7Animation topics
- 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
8Animation criterion
- Physically correct
- - rigid body-simulation
- - natural phenomenon
- Natural
- - character animation
- Expressive
- - cartoon animation
9Animation criterion
- Physically correct
- - rigid body-simulation
- - natural phenomenon
- Natural
- - character animation
- Expressive
- - cartoon animation
10Keyframe animation
11Outline
- Process of keyframing
- Key frame interpolation
- Hermite and bezier curve
- Splines
- Speed control
12Oldest keyframe animation
- Two conditions to make moving images in 19th
century - at least 10 frames per second
- a period of blackness between images
132D 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
143D 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 to
produce Toy Story
15The 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
16A Keyframe
- In 2D animation, a keyframe is usually a single
image - In 3D animation, each keyframe is defined by a
set of parameters
17Keyframe parameters
- What are the parameters?
- position and orientation
- body deformation
- facial features
- hair and clothing
- lights and cameras
18Outline
- Process of keyframing
- Key frame interpolation
- Hermite and bezier curve
- Splines
- Speed control
19Inbetween frames
- Linear interpolation
- Cubic curve interpolation
20Linear interpolation
- Linearly interpolate the parameters between
keyframes
21Cubic curve interpolation
- We can use three cubic functions to represent a
3D curve - Each function is defined with the range 0 lt t
lt1
22Compact representation
23Compact representation
24Smooth Curves
- Controlling the shape of the curve
25Smooth Curves
- Controlling the shape of the curve
26Smooth Curves
- Controlling the shape of the curve
27Smooth Curves
- Controlling the shape of the curve
28Smooth Curves
- Controlling the shape of the curve
29Smooth Curves
- Controlling the shape of the curve
30Constraints on the cubics
- How many constraints do we need to determine a
cubic curve?
31Constraints on the cubics
- How many constraints do we need to determine a
cubic curve?
32Constraints on the cubic functions
- How many constraints do we need to determine a
cubic curve?
33Constrains on the cubic functions
- How many constraints do we need to determine a
cubic curve?
34Constrains on the cubic functions
- How many constraints do we need to determine a
cubic curve? 4
35Natural cubic curves
36Interpolation
- Find a polynomial that passes through specified
values
37Interpolation
- Find a polynomial that passes through specified
values
38Interpolation
- Find a polynomial that passes through specified
values
39Interpolation
- Find a polynomial that passes through specified
values
40Interpolation
- Find a polynomial that passes through specified
values
41Interpolation
- Perform interpolation for each component
separately - Combine result to obtain parametric curve
42Interpolation
- Perform interpolation for each component
separately - Combine result to obtain parametric curve
43Interpolation
- Perform interpolation for each component
separately - Combine result to obtain parametric curve
44Constraints on the cubic curves
- How many constraints do we need to determine a
cubic curve? 4 - - does not provide local control of the curve
45Constraints on the cubic curves
- How many constraints do we need to determine a
cubic curve? 4 - - 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
46Constraints on the cubic curves
- How many constraints do we need to determine a
cubic curve? 4 - - 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
47Constraints on the cubic curves
- How many constraints do we need to determine a
cubic curve? 4 - - 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
48Constraints on the cubic curves
- How many constraints do we need to determine a
cubic curve? 4 - - 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?
49Outline
- Process of keyframing
- Key frame interpolation
- Hermite and bezier curve
- Splines
- Speed control
50Hermite curve
- A Hermite curve is determined by
- - endpoints P1 and P4
- - tangent vectors R1 and R4 at the
endpoints
R1
P4
R4
P1
51Hermite curve
- A Hermite curve is determined by
- - endpoints P1 and P4
- - 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
52Hermite basis matrix
- 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
-
53Tangent vectors
54Tangent vectors
55Hermite basis matrix
- 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
56Hermite basis matrix
- 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?
57Hermite basis matrix
- We can solve for basis matrix Mh
Mh
58Hermite basis matrix
- We can solve for basis matrix Mh
Mh
59Hermite basis matrix
60Hermite basis function
- Lets define B as a product of T and M
- Bh(t) indicates the weight of each element in Gh
61Bezier curve
- Indirectly specify tangent vectors by specifying
two intermediate points
R1
P2
P3
P4
P1
R2
62Bezier curve
- Indirectly specify tangent vectors by specifying
two intermediate points
R1
P2
P3
P4
P1
R4
63Bezier curve
- Indirectly specify tangent vectors by specifying
two intermediate points
R1
P2
P3
P4
P1
R4
How to compute the basis matrix Mb?
64Bezier basis matrix
- Establish the relation between Hermite and Bezier
control vectors
65Bezier basis matrix
- Establish the relation between Hermite and Bezier
control vectors
66Bezier basis matrix
- Establish the relation between Hermite and Bezier
control vectors
Mhb
Gb
67Bezier basis matrix
- For Hermite curves, we have
- For Bezier curves, we have
68Bezier basis matrix
- For Hermite curves, we have
- For Bezier curves, we have
69Bezier basis matrix
P2
P1
P4
P3
70Hermite basis function
- Lets define B as a product of T and M
- Bh(t) indicates the weight of each element in Gh
71Hermite basis function
- Lets define B as a product of T and M
- Bh(t) indicates the weight of each element in Gh
Whats function of this red curve?
72Hermite basis function
- Lets define B as a product of T and M
- Bh(t) indicates the weight of each element in Gh
Whats function of this red curve? 2t3-3t21
73Bezier basis functions
- Bezier blending functions are also called
Bernstein polynomials
74Bezier basis functions
- Bezier blending functions are also called
Bernstein polynomials
Whats function of this red curve?
75Bezier basis functions
- Bezier blending functions are also called
Bernstein polynomials
Whats function of this red curve? -t33t2-3t1
76Bezier basis functions
- Bezier blending functions are also called
Bernstein polynomials
Whats function of this red curve? -t33t2-3t1
77How to interpolate a 3D curve
y
x
o
z
78How to interpolate a 3D curve
y
x
o
z
Bezier curve
79Bezier 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/
80Different basis functions
- Cubic curves
- Hermite curves
- Bezier curves
81Complex curves
- Suppose we want to draw a more complex curve
-
82Complex curves
- Suppose we want to draw a more complex curve
-
How can we represent this curve?
83Complex curves
- Suppose we want to draw a more complex curve
- Why not use a high-order Bézier?
- - Wiggly curves
- - No local control
-
84Complex curves
- Suppose we want to draw a more complex curve
- Why not use a high-order Bézier?
- - Wiggly curves
- - No local control
-
- Instead, well splice together a curve from
individual segments that are cubic Béziers
85Complex curves
- Suppose we want to draw a more complex curve
- Why not use a high-order Bézier?
- - Wiggly curves
- - No local control
-
- Instead, well splice together a curve from
individual segments that are cubic Béziers
86Complex curves
- Suppose we want to draw a more complex curve
- Why not use a high-order Bézier?
- - Wiggly curves
- - No local control
-
- Instead, well splice together a curve from
individual segments that are cubic Béziers
87Complex curves
- Suppose we want to draw a more complex curve
- Why not use a high-order Bézier?
- - Wiggly curves
- - No local control
-
- Instead, well 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
88Next lecture
- Spline curve and more key frame interpolation