Rendering Pipeline Another look at rotation Photography: real scene camera (captures light) photo processing Photographic print processing Computer Graphics: 3D models camera tone model reproduction (focuses simulated lighting) synthetic image Coordinate Transformations How to specify placement of individual objects into a scene Two coordinate systems Object coordinate system World coordinate system Coordinate Transformation Transformation Matrix & xw # & m m m3 m4 # & xo # yw m m m3 m4 ' yo = z 3 3 33 34 w m m m m zo % 4 4 43 { % m m m m 44 44 4444 3 %{ world transformation object Coordinate Transformation Problem in animation Rotation & ' sin( = sin( ( ) % R z # R x & ( ) = % sin( ' sin( # Transformation is a function of time May need to interpolate How to represent a given orientation R y & ( ) = ' sin( % sin( #
6. Straight ahead action and Pose-to-pose action The idea behind keyframing The two main approaches to hand drawn animation. Straight ahead action the animator works straight ahead from his first drawing in the scene. Pose-to-pose (keyframing) the animator plans his actions, figures out just what drawings will be needed to animate the business, makes the drawings concentrating on the poses,... and then draws the inbetweens. Link Animator provides position/orientation at key points in time System calculates position/orientation for frames between keys using interpolation. Transformation matrix & xw # & m m m3 m4 # & xo # yw m m m3 m4 ' yo = z 3 3 33 34 w m m m m zo % 4 4 43 { % m m m m 44 44 4444 3 %{ world transformation translation object Transformation matrix Can we use as a standard for Can we interpolate transformation matrices, element by element, to get orientation between keys? rotation Transformation matrix Can we use as a standard for Survey says: NO Interpolated values may not be valid transformation matrix Rotation matrix Rotation matrix factoids: Rotation matrices are orthogonal M - = M T MM T = I det (M) = Note: problem is with rotation, not translation When interpolating, resulting matrices may not have these properties
Transformation matrix Consider the following & # %' Start with 9 degree y-axis rotation & % ' # End with -9 degree y-axis rotation & % # Interpolated matrix halfway Fixed Angle / Euler angles Angles used to rotate around fixed axes Fixed order of rotation is implied E.g. x-y-z (First x, then y, then z) Any ordering will do as long as you re consistent. Given by a triplet E.g. (, 45, 9) How many degrees of freedom now? Coordinate Transformation Beware: Transformation is not communitive Order of Fixed Angles is important Ry T S Rx Ry S Rx T Euler Angles Fixed angle situation where angles of rotation are the x, y, z axis with respect to the object coordinate system. Fixed Angle / Euler angles Can we use as a standard for Let s go to the video tape. Fixed Angle / Euler angles Can we use as a standard for Survey says: NO Interpolated values are indeed valid, however Interpolated values may seem unnatural Plus.the dreaded gimbal lock 3
Fixed Angle / Euler angles Gimbal lock Gimbal lock is the phenomenon of two rotational axis of an object pointing in the same direction. Easily achieved by rotating about an axis 9 degrees Loss of one degree of freedom Link Fixed Angle / Euler Angle This is a gimble Used for aircraft navigation Gimble lock was almost a deadly problem in Apollo. (link) Euler s Rotation Theorem One orientation can be derived from another by a single rotation about an axis. Define an orientation by a 4-tuple (x, y, z, θ) - rotate θ around the axis (x,y,z) Interpolating From (A, θ ) to (A, θ ) Intermediate axis can be determined by rotating from one axis to the next. Intermediate angle can be simply interpolated. Α θ Α Y θ A x A θ Z X. Interpolate axis from A to A Rotate axis about A x A to get A. Interpolate angle from θ to θ to get θ 3. Rotate object by θ around A Problem with angle/axis Interpolates fine but Can t concatenate rotations. To fix this enter the Quaternion. 4
Similar idea to axis/angle Define an orientation by a 4-tuple [w, x, y, z] Or by a pair [w, v] where w is a scalar and v is a 3d vector. Technically, a quaternion is a 3D extension of complex numbers. q = w + xi + yj + zk Where w, x, y, and z are all real numbers. And i = j = k = sqrt (-) There is an algebra built around this definition. Quaternion math Given quaternions q =[w, x, y, z ] = [w, v ] q =[w, x, y, z ] = [w, v ] Quaternion addition: q + q = [w +w, v +v ] q + q = [w +w, x + x, y + y, z + z ] Quaternion math Quaternion multiplication (q * q ) = [w w - v v, w v + w w + v v ] (q * q ).w = (w w - x x - y y - z z ) (q * q ).x = (w x + x w + y z - z y ) (q * q ).y = (w y - x z + y w + z x ) (q * q ).z = (w z + x y - y x + z w ) Note: quaternion multiplication is not commutative. Quaternion math Magnitide of a quaternion q = sqrt (w + x + y + z ) Yes, you can (and should) normalize quaternions. Identity properties q[ ] = q [ s v q ] = q qq = [ ] and rotation. essentially encodes the info of an axis/angle rotation R θ, (x,y,z) = [ θ/), sin (θ/) (x, y, z) ] 5
A series of rotations can be accomplished by using quaternion multiplication Rotation by p then by q is the same as rotation by qp To interpolate quaternions Interpolate each element one at a time Sort of. More on this when we talk about interpolation next time Questions. Rotation During rendering of a scene, API or render will need the 3x3 rotation portion of the transformation matrix. Thankfully, there are conversions to and from quaternions to rotation matrix. Conversions: Quaternion -> Rotation Matrix q = [w, x, y, z], q normalized # y z xy wz xz + wy & % ( % xy + wz x z yz wx ( % xz wy yz + wx x y ' ( Conversions: Rotation Matrix -> Quaternion & m m m3 m4 # m m m3 m4 m 3 m3 m33 m34 4 4 43 4 % m m m m 4 44 4444 3 transformation w = m + m + m 33 + x = m + w y = m + w Other conversions To/from Euler angles See Shoemake paper on READING LIST Questions? z = m 33 + w 6
Question Given an object to be placed / oriented in a scene How does one specify this placement / orientation for each frame Use translation (x,y,z) and quaternion [w, x, y, z] How many parameters are required? 7 Each controllable parameter is a degree of freedom Degree of Freedom problem 3 objects minute animation 3 frames / second 3 frames x 6 seconds = 8 frames Must define position and orientation of each (7 degrees of freedom/object) = degrees of freedom 8 frames x dof = 378 values Animation There is no particular mystery in animation it s really very simple, and like anything that is simple, It is about the hardest thing in the world to do -- Bill Tytla, Disney Animator, 937 Next time Next time Interpolation schemes Assignment # Class Web Site: http://www.cs.rit.edu/~jmg/animation Any questions? 7