Logistics Projects Interpolation of Quaternions Reminder that proposal is due before break. Assignments Reminder that Assignment 1 is due before break. Readings Keep those summaries coming Logistics Plan for today Grad Report Interpolation leftovers Will need topics first week after we return Interpolation of Quaternions from break. Assignment #2. Plan for today Motivation Films Small change in plans Computer Animated Feature Films (Theatrical Release) Today: Keyframing and Interpolation 44 since (and including) Toy Story Wednesday: More on interpolation 17 currently in Production http://www.boxofficemojo.com/genres/chart/?id=computeranimation.htm Leave dynamics until we get back. Major players Pixar New schedule on Web site PDI/Dreamworks Blue Sky / FOX Sony Imageworks Disney But first… 1
Motivational Films Motivation Films Anyone know what is the most Pacific Data Images (PDI) Makers of Shrek and ANTZ successful computer animated feature Founded in 1980 (doing flying logos) film? 1990 – Morphing for Michael Jackson’s “Black and White” Video 1996 – Signed on with Dreamworks SKG to produce ANTZ Shrek 2 (PDI / Dreamworks) 2000 – Aquired by Dreamworks (PDI/Dreamworks) Shrek the 3rd is 3rd 2001 – Shrek wins Oscar for best animated feature 2004 -- Shrek 2 becomes highest grossing animated feature. Shrek is 4th Motivational Films Motivational Films Animated features by PDI/Dreamworks Films in the works by PDI/Dreamworks ANTZ (1999) In the works Shrek (2001) Kung Fu Panda (June 2008) Shrek 2 (2004) Madagascar II (Nov 2008) Shark Tale (2004) Monsters and Aliens (May 2009) Madagascar (2005) How to Train Your Dragon (Nov 2009) Over the Hedge (2006) Shrek IV (May 2010) Flushed Away (2006) Shrek the Third (2007) Bee Movie (2007) Motivational Film Motivational Film Locomotion (1988) Homer3 (1995) One of PDIs first animated shorts Aired as part of "Treehouse of Horror VI" Simpsons Halloween special 2
Let’s get started Coordinate Transformations an · i · ma · tion (n) How to specify placement of individual objects into a scene a motion picture made from a series of Two coordinate systems drawings simulating motion by means of Object coordinate system slight progressive changes in the drawings World coordinate system Transformation matrix Motion Control Algorithms translation Goal: x m m m m x � � � � � � 11 12 13 14 w o Reduce the degrees of freedom to a � � � � � � y m m m m y number that is manageable to an animator. w 21 22 23 24 o � � � � � � = � Algorithms must provide a set of z m m m m z � � � � � � 31 32 33 34 w o “meaningful” parameters. � � � � � � 1 m m m m 1 � � � � � � { 41 42 43 44 { 1 4 4 4 4 2 4 4 4 4 3 world object transforma tion rotation 6. Straight ahead action and Pose-to-pose Key framing action The two main approaches to hand drawn The simplest form of animating an object. animation. Object has: Straight ahead action A beginning state “the animator works straight ahead from his first drawing An end state in the scene.” Pose-to-pose (keyframing) A number of intermediate “key” states the animator plans his actions, figures out just what It is up to the keyframe system to determine drawings will be needed to animate the business, makes the drawings concentrating on the poses, ... and then the states for inbetween frames draws the inbetweens.” Link 3
Quaternions Quaternion math Similar idea to axis/angle Given 2 quaternions q 1 =[w 1 , x 1 , y 1 , z 1 ] = [w 1 , v 1 ] Define an orientation by a 4-tuple q 2 =[w 2 , x 2 , y 2 , z 2 ] = [w 2 , v 2 ] [w, x, y, z] Quaternion addition: Or by a pair [w, v] where w is a scalar and v is a 3d q 1 + q 2 = [w 1 +w 2 , v 1 +v 2 ] vector. q 1 + q 2 = [w 1 +w 2 , x 1 + x 2 , y 1 + y 2 , z 1 + z 2 ] Quaternion math Quaternion math Quaternion multiplication Magnitide of a quaternion (q 1 * q 2 ) = [w 1 w 2 - v 1 ⋅ v 2 , w 1 v 2 + w 2 v 1 + v 1 × v 2 ] ||q 1 || = sqrt (w 1 2 + x 1 2 + y 1 2 + z 1 2 ) (q 1 * q 2 ).w = (w 1 w 2 - x 1 x 2 - y 1 y 2 - z 1 z 2 ) Yes, you can (and should) normalize (q 1 * q 2 ).x = (w 1 x 2 + x 1 w 2 + y 1 z 2 - z 1 y 2 ) quaternions. (q 1 * q 2 ).y = (w 1 y 2 - x 1 z 2 + y 1 w 2 + z 1 x 2 ) q [ 1 0 0 0 ] q (q 1 * q 2 ).z = (w 1 z 2 + x 1 y 2 - y 1 x 2 + z 1 w 2 ) Identity properties = s v [ ] − 1 Note: quaternion multiplication is not commutative. q − = 2 q 1 qq − [ 1 0 0 0 ] = Quaternions and rotation. Quaternion math Quaternions essentially encodes the info Quaternion dot product of an axis/angle rotation cos � = q 1 • q 2 = w 1 w 2 + ( v 1 • v 2 ) R α , (x,y,z) = [ cos( α /2), sin ( α /2) • (x, y, z) ] θ Is angle between quaternions in quaternion space Nomenclature note: α rather than θ 4
Quaternions Quaternions To interpolate quaternions A series of rotations can be Interpolate each element one at a time accomplished by using quaternion multiplication Sort of…. Rotation by p then by q is the same as By the way, rotation by qp Gentle mathematic treatment of quaternions and rotation (including interpolation) on READING LIST Interpolating Quaternions Interpolating Quaternions In animation, only unit quaternions Direct interpolation of quaternion should be used components can give “misleading” results. Normalize those quaternions! Figure 6-3 in quat paper. Quaternions live in 4-D space Normalized quaternions will lie on the unit 4D sphere. Spherical linear interpolation Interpolating Quaternions (Slerp) Direct interpolation of quaternion components can give “misleading” results. Linear interpolate angle along hypersphere 5
Interpolating Quaternions Interpolating Quaternions Spherical Linear Interpolation (Slerp) Spherical Linear Interpolation (Slerp) sin(( 1 u ) ) sin( u ) � � � slerp ( q , q u ) q q = + slerp (q 1 ,q 2 , 1/2) can be efficiently 1 2 , 1 2 sin sin � � computed (within a scale factor) as q 1 + q 2 recall Scale factor okay since you’ll need to cos � = q 1 • q 2 = w 1 w 2 + ( v 1 • v 2 ) normalize anyway. Note that result of slerp is not necessarily unit length (even if keyframes are)…Normalization required! Interpolating Quaternions Interpolating Quaternions Comparison of Lerp and Slerp Note: Spherical Linear Interpolation has the same problem as linear interpolation (no tangential continuity) For smooth interpolation, Shomake recommends the use Bezier curves Issues: But what about those control points? How does one do “cubic interpolation” in quaternion space Section 3.3.1 (page 110) in Parent text Cubic Interpolation Cubic Interpolation Bezier Curves Bezier Curves specified by endpoints and intermediate 1 3 3 1 � � P points, not on the curve, that approximate � � � � 0 � � � � the tangent vectors 3 6 3 0 P � � M � � � 1 � = G H = B 3 3 0 0 � � P � � � 2 � � � � 1 0 0 0 P � � � � 3 Let’s go to the video tape 6
Bezier control points Bezier control points Defining control points Defining control points: Algorithm: Assume you need the path between p n and For a point p n : p n+1 For control point after (a n ): For each p n , you’ll need 2 control points, Take vector from p n-1 to p n and add to p n (Point one before it and one after it. 1) Take average of Point 1 with p n+1 to define control point a n For control point before (b n ) Take vector from a n to p n Add it to p n to get b n Bezier control points Bezier control points Control points for end conditions: First control point (a 0 ) Take the vector from p 2 to p 1 and add to p 1 Similar for last control point. Quaternions and Bezier So far Applying this to quaternions We have: Adding vectors == concatenating rotations Rotation keyframes defined as quaternions Quaternion multiplication in reverse We have Bezier control points Averaging == slerp to midpoint (u = 1/2) The same as quaternion addition. What we need: The interpolated rotations between keyframes. Questions? Break 7
Interpolating rotations De Casteliau construction Applying spline definition DeCasteljau Construction Geometric means of finding values of Bezier Becomes messy fast Curves using repeated use of linear interpolation. Instead, use De Casteljau construction. de Casteljau Construction de Casteljau Construction p 1 p 1 q 1 q 0 ( ) q 0 ( t ) = Lerp t , p 0 , p 1 p 0 p 0 p 2 p 2 ( ) q 1 ( t ) = Lerp t , p 1 , p 2 Start with the control points And given a value of t ( ) q 2 q 2 ( t ) = Lerp t , p 2 , p 3 In the drawings, t ≈ 0.25 p 3 p 3 de Casteljau Constuction de Casteljau Construction q 1 r 0 r 0 • q 0 r 1 x r 1 ( ) ( ) x ( t ) = Lerp t , r 0 ( t ), r 1 ( t ) r 0 ( t ) = Lerp t , q 0 ( t ), q 1 ( t ) ( ) r 1 ( t ) = Lerp t , q 1 ( t ), q 2 ( t ) q 2 Applet 8
Recommend
More recommend