Animation Dr. Amy Zhang Lecture 8. Reading 2  Hill, Chapters 5 / 7 / 10  Red Book, Chapter 3, “Viewing”  Red Book, Chapter 12, “Evaluators and NURBS”

Slides:



Advertisements
Similar presentations
Animation Lecture 10 Slide Fall Conventional Animation Draw each frame of the animation great control Tedious Reduce burden with cel animation.
Advertisements

Lecture Notes #11 Curves and Surfaces II
Lecture 10 Curves and Surfaces I
Animation Following “Advanced Animation and Rendering Techniques” (chapter 15+16) By Agata Przybyszewska.
3D Graphics for Game Programming (J. Han) Chapter XI Character Animation.
CS 445/645 Fall 2001 Hermite and Bézier Splines. Specifying Curves Control Points –A set of points that influence the curve’s shape Knots –Control points.
Computer Animation Algorithms and Techniques
Dr. S.M. Malaek Assistant: M. Younesi
Computer graphics & visualization Key frame Interpolation.
Computer Graphics Recitation 2. 2 The plan today Learn about rotations in 2D and 3D. Representing rotations by quaternions.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
3D orientation.
Geometric Modeling Surfaces Mortenson Chapter 6 and Angel Chapter 9.
CSCE 689: Computer Animation Rotation Representation and Interpolation
CSCE 441: Computer Graphics Rotation Representation and Interpolation
CSCE 641: Computer Graphics Rotation Representation and Interpolation Jinxiang Chai.
Modelling: Curves Week 11, Wed Mar 23
University of British Columbia CPSC 414 Computer Graphics © Tamara Munzner 1 Curves Week 13, Mon 24 Nov 2003.
Rotation representation and Interpolation
Curve Surfaces June 4, Examples of Curve Surfaces Spheres The body of a car Almost everything in nature.
Introduction to ROBOTICS
Lecture Fall 2001 Computer Animation Fundamentals Animation Methods Keyframing Interpolation Kinematics Inverse Kinematics.
Lecture 10Slide Fall 2003 Animation. Lecture 10Slide Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.
Splines III – Bézier Curves
Computer Graphics Lecture 13 Curves and Surfaces I.
Advanced Graphics (and Animation) Spring 2002
Curve Modeling Bézier Curves
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
11/19/02 (c) 2002, University of Wisconsin, CS 559 Last Time Many, many modeling techniques –Polygon meshes –Parametric instancing –Hierarchical modeling.
A D V A N C E D C O M P U T E R G R A P H I C S CMSC 635 January 15, 2013 Spline curves 1/23 Curves and Surfaces.
CS 376 Introduction to Computer Graphics 04 / 23 / 2007 Instructor: Michael Eckmann.
Key Frame Animation and Inverse Kinematics
This Week Week Topic Week 1 Week 2 Week 3 Week 4 Week 5
V. Space Curves Types of curves Explicit Implicit Parametric.
CSC418 Computer Graphics n Animation Principles n Keyframe Animation.
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Interpolating Values.
Lecture 13Slide Fall 2002 Animation. Lecture Fall 2002 Computer Animation Animation Methods Keyframing Interpolation Kinematics Inverse.
110/27/ :47 Graphics II Animation Introduction and Motion Control Session 6.
University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell Parametric Curves.
CS 445/645 Fall 2001 Splines/Film/Animation. Final Exam Thursday, December 13 th from 7 – 10 p.m. –Room Olsson 011 You may use one sheet of notes (8.5.
CS 551/645 Fall 2000 Parameterized Rotations, Curves, and Surfaces.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
CS 376 Introduction to Computer Graphics 04 / 25 / 2007 Instructor: Michael Eckmann.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves Jinxiang Chai.
Curves: ch 4 of McConnell General problem with constructing curves: how to create curves that are “smooth” CAD problem Curves could be composed of segments.
Greg Humphreys CS445: Intro Graphics University of Virginia, Fall 2003 Parametric Curves & Surfaces Greg Humphreys University of Virginia CS 445, Spring.
CS 551/651 Advanced Graphics Technical Background.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CSCE 441: Keyframe Animation/Smooth Curves (Cont.) Jinxiang Chai.
CS 450: Computer Graphics PARAMETRIC SPLINES AND SURFACES
Splines Sang Il Park Sejong University. Particle Motion A curve in 3-dimensional space World coordinates.
CS 325 Computer Graphics 04 / 30 / 2010 Instructor: Michael Eckmann.
Lecture 11 Slide Fall 2003 Computer Animation II Orientation Interpolation Dynamics Some slides courtesy of Leonard McMillan and Jovan Popovic.
Rendering Bezier Curves (1) Evaluate the curve at a fixed set of parameter values and join the points with straight lines Advantage: Very simple Disadvantages:
Curves University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2013 Tamara Munzner.
Piecewise Polynomial Parametric Curves Sun-Jeong Kim.
Introduction to Parametric Curve and Surface Modeling.
CPSC 641: Computer Graphics Rotation Representation and Interpolation
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves
CS5500 Computer Graphics May 11, 2006
Curve & Surface.
CS 445 / 645 Introduction to Computer Graphics
Parametric Curves cgvr.korea.ac.kr.
CSCE 441 Computer Graphics: Keyframe Animation/Smooth Curves
© University of Wisconsin, CS559 Fall 2004
© University of Wisconsin, CS559 Spring 2004
Animation Lecture 10 Slide 1.
Chapter XVII Parametric Curves and Surfaces
CSCE 441: Keyframe Animation/Smooth Curves (Cont.)
Introduction to Parametric Curve and Surface Modeling
Presentation transcript:

Animation Dr. Amy Zhang Lecture 8

Reading 2  Hill, Chapters 5 / 7 / 10  Red Book, Chapter 3, “Viewing”  Red Book, Chapter 12, “Evaluators and NURBS”

Outline 3  Computer-aided animation  Keyframing and interpolation of position  Hierarchical modeling.  Interpolation of rotation

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”

Computer-Assisted Animation 5  Keyframing  automate the inbetweening  good control  less tedious  creating a good animation still requires considerable skill and talent

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

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

Computer-Assisted Animation 8  Motion Capture  Captures style, subtle nuances and realism  You must observe someone

Motion Capture 9

Motion Replay 10

Outline 11  Computer-aided animation  Keyframing and interpolation of position  Hierarchical modeling.  Interpolation of rotation

Keyframing 12  Describe motion of objects as a function of time from a set of key object positions. In short, compute the inbetween frames.

Interpolating Positions 13  Given positions:  find curve such that

Linear Interpolation 14  Simple problem: linear interpolation between first two points assuming :  The x-coordinate for the complete curve in the figure:

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

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

Spline Interpolation 17  Lagrange polynomials of small degree are fine but high degree polynomials are too wiggly  Technical term: overfitting

Spline Interpolation 18  Spline (piecewise cubic polynomial) interpolation produces nicer interpolation t tt x(t)

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

Splines 20

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?

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

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

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?

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)

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

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:

Parametric Cubic Curves 28  This is a cubic function in 3D:  To avoid the dependency on the dimension we will use the following notation:

Parametric Cubic Curves 29  What does the derivative of a cubic curve look like?

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

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 ]

Hermite Spline 32  4 segments, (P 1, P 2 ) and (P’ 1, P’ 2 ) for each segment

Building it up… 33  Cubic curve equations:  Boundary constraints: or:

Solve for the c’s 34

Cubic Hermite Curves 35  Curve equation in matrix form:  T = Power basis  B = Spline basis, characteristic matrix  G = Geometry (control points)

Bézier Curves 36  Developed simultaneously by Bézier (at Renault) and de Casteljau (at Citroen), circa  Without specify consecutive tangents  A cubic Bézier curve has four control points, two of which are knots (P 1, P 4 ).

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 ]

Cubic Bézier Curves 38  Repeating the same derivation gives:

Bézier Curves 39  Consider the cubic curve:  The basis functions  Bi,3(u)are given by:

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.,

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

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

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 ]

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

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

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.

Outline 47  Computer-aided animation  Keyframing and interpolation of position  Hierarchical modeling  Interpolation of rotation

Articulated Models 48  Articulated models:  rigid parts  connected by joints  They can be animated by specifying the joint angles as functions of time.

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

Skeleton Hierarchy 50  Each bone transformation described relative to the parent in the hierarchy:  Tree traversal

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

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

Outline 53  Computer-aided animation  Keyframing and interpolation of position  Hierarchical modeling  Interpolation of rotation

3D rotations 54  How many degrees of freedom for 3D orientations?  3 degrees of freedom:  e.g. direction of rotation and angle

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

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)

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)

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

Euler Angles 59  Gimbal lock: two or more axis align resulting in a loss of rotation dof.

Demo 60  See res/qpowers/page7.asp res/qpowers/page7.asp  See also mbal.jpg.html mbal.jpg.html

3D Rotation Representations 61  Axis angle  rotate about A by , (Ax,Ay,Az,  )  good interpolation, no gimbal lock  cannot compose rotations efficiently

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}

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}

Quaternion Algebra 64  Multiplication:  UsingToRepresentRotation.htm UsingToRepresentRotation.htm  Quaternions are associative:  But not commutative:

Rotation Example 65  To rotate 3D point/vector p by a rotation q, compute:

Compose Rotations 66

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

Quaternion Interpolation 68  Linear interpolation generates unequal spacing of points after projecting to circle

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

Useful Analogies 70  Euclidean Space  Position  Linear interpolation 4D Spherical Space Orientation Spherical linear interpolation (slerp)