Download presentation
Presentation is loading. Please wait.
Published byMyrtle Robbins Modified over 8 years ago
1
Animation Dr. Amy Zhang Lecture 8
2
Reading 2 Hill, Chapters 5 / 7 / 10 Red Book, Chapter 3, “Viewing” Red Book, Chapter 12, “Evaluators and NURBS”
3
Outline 3 Computer-aided animation Keyframing and interpolation of position Hierarchical modeling. Interpolation of rotation
4
Conventional Animation 4 Draw each frame of the animation great control tedious Reduce burden with cel animation Layer, keyframe, inbetween cel panoramas (Disney’s Pinocchio) ... ACM © 1997 “Multiperspective panoramas for cel animation”
5
Computer-Assisted Animation 5 Keyframing automate the inbetweening good control less tedious creating a good animation still requires considerable skill and talent
6
Computer-Assisted Animation 6 Procedural animation describes the motion algorithmically express animation as a function of small number of parameters Example: a clock with second, minute and hour hands hands should rotate together express the clock motions in terms of a “seconds” variable the clock is animated by varying the seconds parameter Example 2: A bouncing ball Abs(sin( ω t+ Θ ))*e -kt
7
Computer-Assisted Animation 7 Physically Based Animation Assign physical properties to objects (masses, forces, inertial properties) Simulate physics by solving equations Realistic but difficult to control
8
Computer-Assisted Animation 8 Motion Capture Captures style, subtle nuances and realism You must observe someone
9
Motion Capture 9
10
Motion Replay 10 http://www.youtube.com/watch?v=IJ4tndpwL-o
11
Outline 11 Computer-aided animation Keyframing and interpolation of position Hierarchical modeling. Interpolation of rotation
12
Keyframing 12 Describe motion of objects as a function of time from a set of key object positions. In short, compute the inbetween frames.
13
Interpolating Positions 13 Given positions: find curve such that
14
Linear Interpolation 14 Simple problem: linear interpolation between first two points assuming : The x-coordinate for the complete curve in the figure:
15
Polynomial Interpolation 15 A polynomial is a function of the form: n is the degree of the polynomial The order of the polynomial is the number of coefficients it has Always: order = degree + 1
16
Polynomial Interpolation 16 What degree polynomial can interpolate n+1 points? An n-degree polynomial can interpolate any n+1 points wikipedia: Lagrange interpolation The resulting interpolating polynomials are called Lagrange polynomials We already saw the Lagrange formula for n = 1
17
Spline Interpolation 17 Lagrange polynomials of small degree are fine but high degree polynomials are too wiggly Technical term: overfitting
18
Spline Interpolation 18 Spline (piecewise cubic polynomial) interpolation produces nicer interpolation t tt x(t)
19
Spline Curves 19 The word spline comes from ship building with wood A wooden plank is forced between fixed posts, called “ducks” Real-world splines are still being used for designing ship hulls, automobiles, and aircraft fuselage and wings
20
Splines 20 www.abm.org
21
Spline Curves 21 Spline curve - any composite curve formed with piecewise parametric polynomials subject to certain continuity conditions at the boundary of the pieces. Huh?
22
Parametric Polynomial Curves 22 A parametric polynomial curve is a parametric curve where each function x(t), y(t) is described by a polynomial: Polynomial curves have certain advantages: Easy to compute Indefinitely differentiable
23
Why Parametric Curves? 23 Parametric curves are very flexible They are not required to be functions Curves can be multi-valued with respect to any coordinate system
24
Piecewise Curves 24 To avoid overfitting we will want to represent a curve as a series of curves pieced together A piecewise parametric polynomial curve uses different polynomial functions for different parts of the curve Advantages: Provides flexibility Problem: How do we fit the pieces together?
25
Parametric Continuity 25 C0: Curves are joined “watertight” curve / mesh C1: First derivative is continuous, d/dt Q(t) = velocity is the same. “looks smooth, no facets” C2: Second derivative is continuous, d2/dt2 Q(t) = acceleration is the same (important for animation and shading)
26
Specifying Splines 26 Control Points - a set of points that influence the curve's shape Hull - the lines that connect the control points Interpolating – curve passes through the control points Approximating – control points merely influence shape
27
Parametric Cubic Curves 27 In order to assure C2 continuity our functions must be of at least degree three. Here's what a 2D parametric cubic function looks like: In matrix form:
28
Parametric Cubic Curves 28 This is a cubic function in 3D: To avoid the dependency on the dimension we will use the following notation:
29
Parametric Cubic Curves 29 What does the derivative of a cubic curve look like?
30
Hermite Splines 30 We want to support general constraints: not just smooth velocity and acceleration. For example, a bouncing ball does not always have continuous velocity: Solution: specify position AND velocity at each point
31
Hermite Splines 31 Given: Two control points (P 1, P 2 ). Tangents (derivatives) at the knot points (P’ 1, P’ 2 ): “Control knob” vector: [P 1, P 2, P’ 1, P’ 2 ]
32
Hermite Spline 32 4 segments, (P 1, P 2 ) and (P’ 1, P’ 2 ) for each segment
33
Building it up… 33 Cubic curve equations: Boundary constraints: or:
34
Solve for the c’s 34
35
Cubic Hermite Curves 35 Curve equation in matrix form: T = Power basis B = Spline basis, characteristic matrix G = Geometry (control points)
36
Bézier Curves 36 Developed simultaneously by Bézier (at Renault) and de Casteljau (at Citroen), circa 1960. Without specify consecutive tangents A cubic Bézier curve has four control points, two of which are knots (P 1, P 4 ).
37
Bézier Specification 37 Four control points (P 1, P 2, P 3, P 4 ). Gradients (tangents) at the knot points (P’ 1, P’ 4 ) are the line segments between adjacent control points: Tangents: P’ 1 = 3 ( P 2 - P 1 ); P’ 2 = 3 ( P 4 - P 3 ) Scale factor (3) is chosen to make “velocity” approximately constant Endpoint interpolation: P(0) = P 1 and P(1) = P 4 P 2 & P 3 control the magnitude and orientation of the tangent vectors at the end points Geometry vector G: [P 1, P 2, P 3, P 4 ]
38
Cubic Bézier Curves 38 Repeating the same derivation gives:
39
Bézier Curves 39 Consider the cubic curve: The basis functions Bi,3(u)are given by:
40
Bézier Curves 40 De Casteljau representation: where r= 1,…,k; i= 0,…,k–r; p i 0 (u)=p i A point on the curve with parameter value u is given by,i.e.,
41
Bézier Curves 41 Using the de Casteljau algorithm, a Bézier curve can be subdivided anywhere along its length into 2 smaller curves Note that the convex hull of the smaller section lies closer to the curve than the original convex hull, and therefore repeated subdivision will produce a closer approximation to the curve
42
Bézier Curves 42 Subdivision formulae about midpoint (i.e.,u=0.5): Let original control points be pi Let the control points of the small sections be q i & r i The 2 small curve segments join at
43
Properties of Bézier Curves 43 Convex hull: Curve is contained in the hull [P 1, P 2, P 3, P 4 ] Affine Invariance: Transforming the control points is computationally more efficient than transforming each point on the curve Useful in ensuring smoothness while scaling a curve segment Symmetry: P(t); [P 1, P 2, P 3, P 4 ] ≡ P(1-t); [P 4, P 3, P 2, P 1 ]
44
Catmull-Rom Splines 44 With built-in C 1 continuity. Compared to Hermite/Bezier: fewer control points required, but less freedom. Given n control points in 3-D: p 1, p 2, …, p n, Tangent at p i given by s(p i+1 –p i-1 ) for i=2..n-1, for some s Curve between p i and p i+1 is determined by p i-1, p i, p i+1, p i+2
45
Hungry for more? 45 You got your Hermite and Bézier splines, Catmull- Rom splines Once you know it's a piecewise cubic, you know what game you're playing — putting conditions on the segments and how they fit together You should know the basic properties of Hermite and Bézier splines
46
Interpolating Key Frames 46 Interpolation is not fool proof. The splines may undershoot and cause interpenetration. The animator must also keep an eye out for these types of side- effects.
47
Outline 47 Computer-aided animation Keyframing and interpolation of position Hierarchical modeling Interpolation of rotation
48
Articulated Models 48 Articulated models: rigid parts connected by joints They can be animated by specifying the joint angles as functions of time.
49
Forward Kinematics 49 Describes the positions of the body parts as a function of the joint angles 1 DOF: knee 2 DOF: wrist 3 DOF: arm
50
Skeleton Hierarchy 50 Each bone transformation described relative to the parent in the hierarchy: Tree traversal
51
Forward Kinematics 51 Transformation matrix for an effecter v s is a matrix composition of all joint transformation between the effecter and the root of the hierarchy
52
Inverse Kinematics 52 Forward Kinematics Given the skeleton parameters p and the position of the effecter in local coordinates v s, what is the position of the sensor in the world coordinates v w ? Inverse Kinematics Given the position of the effecter in local coordinates v s and the desired position v w in world coordinates, what are the skeleton parameters p? Much harder; requires solving the inverse Underdetermined problem with many solutions
53
Outline 53 Computer-aided animation Keyframing and interpolation of position Hierarchical modeling Interpolation of rotation
54
3D rotations 54 How many degrees of freedom for 3D orientations? 3 degrees of freedom: e.g. direction of rotation and angle
55
3D Rotation Representations 55 Rotation Matrix orthornormal columns/rows bad for interpolation Fixed Angle rotate about global axes bad for interpolation, gimbal lock Euler Angle rotate about local axes bad for interpolation, gimbal lock
56
Fixed Angle 56 (0,90,0) in x-y-z order (90,45,90) in x-y-z order (0,90,0) (90,45,90)
57
Interpolation Problem 57 The rotation from (0,90,0) to (90,45,90) is a 45-degree x- axis rotation Directly interpolating between (0,90,0) and (90,45,90) produces a halfway orientation (45, 67.5, 45) Desired halfway orientation is (90, 22.5, 90)
58
Euler Angles 58 An Euler angle is a rotation about a single axis. Any orientation can be described composing three rotation around each coordinate axis. Roll, pitch and yaw
59
Euler Angles 59 Gimbal lock: two or more axis align resulting in a loss of rotation dof. http://www.fho-emden.de/~hoffmann/gimbal09082002.pdf
60
Demo 60 See http://www.gamedev.net/reference/programming/featu res/qpowers/page7.asp http://www.gamedev.net/reference/programming/featu res/qpowers/page7.asp See also http://www.cgl.uwaterloo.ca/GALLERY/image_html/gi mbal.jpg.html http://www.cgl.uwaterloo.ca/GALLERY/image_html/gi mbal.jpg.html
61
3D Rotation Representations 61 Axis angle rotate about A by , (Ax,Ay,Az, ) good interpolation, no gimbal lock cannot compose rotations efficiently
62
Solution: Quaternion Interpolation 62 4-tuple of real numbers q=(s,x,y,z) or [s,v] s is a scalar; v is a vector Same information as axis/angle but in a different form Right-hand rotation of Θ radians about v is: q = {cos( Θ /2); v sin( Θ /2)} Often noted (s, v) or {a; b, c, d}
63
Quaternions 63 q = {cos( /2); v sin( /2)} What if we use -v? Rotation of – around –v The quaternion of the identity rotation: q i = {1; 0; 0; 0} q{1; 0; 0; 0}= q Is there exactly one quaternion per rotation? No. q={cos( /2); v sin( /2)} is the same rotation as -q={cos(( +2 )/2); v sin(( +2 )/2)} The inverse q -1 of quaternion q {a, b, c, d}: {a, -b, -c, -d} qq -1 = {1; 0; 0; 0}
64
Quaternion Algebra 64 Multiplication: http://www.genesis3d.com/~kdtop/Quaternions- UsingToRepresentRotation.htm http://www.genesis3d.com/~kdtop/Quaternions- UsingToRepresentRotation.htm Quaternions are associative: But not commutative:
65
Rotation Example 65 To rotate 3D point/vector p by a rotation q, compute:
66
Compose Rotations 66
67
Quaternion Interpolation 67 A quaternion is a point on a 4D unit sphere Unit quaternion: q=(s,x,y,z), ||q|| = 1 Interpolating rotations means moving on 4D sphere
68
Quaternion Interpolation 68 Linear interpolation generates unequal spacing of points after projecting to circle
69
Quaternion Interpolation 69 Spherical linear interpolation (slerp) interpolats along the arc lines instead of the secant lines. produce equal increment along arc connecting two quaternions on the spherical surface
70
Useful Analogies 70 Euclidean Space Position Linear interpolation 4D Spherical Space Orientation Spherical linear interpolation (slerp)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.