1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 world object transforma
play

{ { 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 world object - PDF document

Rendering Pipeline real camera photo Photographic Photography: scene (captures processing print Transformations, Rotations, Orientations light) processing camera Computer 3D synthetic tone model Graphics: models image


  1. Rendering Pipeline real camera photo Photographic Photography: scene (captures processing print Transformations, Rotations, Orientations light) processing camera Computer 3D synthetic tone model Graphics: models image reproduction (focuses simulated lighting) Question Coordinate Transformations • How to specify placement of individual • Given an object to be placed / oriented in a objects into a scene scene • Two coordinate systems – How does one specify this placement / orientation for each frame – Object coordinate system – World coordinate system – How many “parameters” are required? • Each controllable parameter is a degree of • A Third coordinate system freedom – Camera coordinate system Coordinate Transformation Coordinate Transformation • Transformation Matrix • Transform operations ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ x m m m m x – Scaling 11 12 13 14 w o ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ – Translation y m m m m y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = ⋅ 21 22 23 24 w o – Rotation ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ z m m m m z ⎢ w ⎥ ⎢ 31 32 33 34 ⎥ ⎢ o ⎥ ⎣ ⎦ ⎣ ⎦ 1 ⎣ m m m m ⎦ 1 { { 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 world object transforma tion 1

  2. Coordinate Transformation Coordinate Transformation • Rotation ⎡ ⎤ ⎡ ⎤ s 0 0 0 1 0 0 d x x ⎢ ⎥ θ − θ ⎢ ⎥ ⎡ ⎤ ⎡ ⎤ cos sin 0 0 1 0 0 0 0 1 0 d 0 s 0 0 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = = y θ θ θ − θ y T ( d , d , d ) 0 cos sin 0 S ( s , s , s ) sin cos 0 0 ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ x y z θ = θ = ⎢ ⎥ x y z 0 0 1 d R ( ) R ( ) 0 0 s 0 ⎢ ⎥ x ⎢ θ θ ⎥ ⎢ z ⎥ z 0 0 1 0 0 sin cos 0 z ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ 0 0 0 1 ⎣ ⎦ 0 0 0 1 ⎣ ⎦ ⎣ 0 0 0 1 ⎦ 0 0 0 1 ⎡ θ θ ⎤ Transformation cos 0 sin 0 Scaling ⎢ ⎥ 0 1 0 0 ⎢ ⎥ θ = R ( ) ⎢ − θ θ ⎥ y sin 0 cos 0 ⎢ ⎥ ⎣ 0 0 0 1 ⎦ Coordinate Transformations Tacking on the camera • Individual operations can be composed into • The role of cameras can be described as a single matrix. projecting a 3D scene onto a 2D plane = ⋅ ⋅ ⋅ M R T S R y x Tacking on the camera Problem in animation • Transformation is a function of time ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ • May need to interpolate x p p p p m m m m x v 11 12 13 14 11 12 13 14 w ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ y p p p p m m m m y • How to represent a given orientation ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ = ⋅ ⋅ v 21 22 23 24 21 22 23 24 w ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ z p p p p m m m m z v 31 32 33 34 31 32 33 34 w ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ 1 ⎦ ⎣ p p p p ⎦ ⎣ m m m m ⎦ ⎣ 1 ⎦ { { 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 view plane object projection world to camera 2

  3. The idea behind keyframing 6. Straight ahead action and Pose-to-pose action • The two main approaches to hand drawn • Animator provides position/orientation at animation. key points in time – Straight ahead action • System calculates position/orientation for • “the animator works straight ahead from his first drawing in frames between keys using interpolation. 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 Transformation matrix Transformation matrix translation • Can we use as a standard for interpolation? ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ m m m m x x w 11 12 13 14 o ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ – Can we interpolate transformation matrices, y m m m m y ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ element by element, to get orientation between = ⋅ w 21 22 23 24 o ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ keys? z m m m m z w 31 32 33 34 o ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ – BTW, how many degrees of freedom if we can? ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ 1 m m m m 1 { { 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 world object transforma tion Camera projection rotation Transformation matrix Transformation matrix • Consider the following • Can we use as a standard for interpolation? – Survey says: NO − ⎡ ⎤ ⎡ ⎤ ⎡ ⎤ 0 0 1 0 0 1 0 0 0 – Interpolated values may not be valid ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ 0 1 0 0 1 0 0 1 0 transformation matrix ⎢ ⎥ ⎢ ⎥ ⎢ ⎥ ⎢ − ⎥ ⎢ ⎥ ⎢ ⎥ ⎣ ⎦ ⎣ ⎦ ⎣ ⎦ 1 0 0 1 0 0 0 0 0 – Note: problem is with rotation, not translation Start with 90 End with -90 Interpolated degree y-axis degree y-axis matrix halfway rotation rotation 3

  4. Fixed Angle / Euler angles Coordinate Transformation • Angles used to rotate around fixed axes • Beware: Transformation is not communitive • Fixed order of rotation is implied • Order of Fixed Angles is important – E.g. x-y-z (First x, then y, then z) ⋅ ⋅ ⋅ ≠ ⋅ ⋅ ⋅ – Any ordering will do as long as you’re consistent. R T S R R S R T y x y x • Given by a triplet – E.g. (10, 45, 90) – How many degrees of freedom now? Euler Angles Fixed Angle / Euler angles • Fixed angle situation where angles of • Can we use as a standard for interpolation? rotation are the x, y, z axis with respect to the object coordinate system. • Let’s go to the video tape. Fixed Angle / Euler angles Fixed Angle / Euler angles • Can we use as a standard for interpolation? • Gimbal lock – Survey says: NO – Gimbal lock is the phenomenon of two rotational axis of an object pointing in the – Interpolated values are indeed valid, however… same direction. • Interpolated values may seem unnatural • Easily achieved by rotating about an axis 90 degrees – Plus….the dreaded gimbal lock! – Loss of one degree of freedom – Link 4

  5. Angle / Axis Angle / Axis • Euler’s Rotation Theorem • Interpolating – From (A 1 , θ 1 ) to (A 2 , θ 2 ) – One orientation can be derived from another by a single rotation about an axis. – Intermediate axis can be determined by rotating from one axis to the next. • Define an orientation by a 4-tuple – (x, y, z, θ ) - rotate θ around the axis (x,y,z) – Intermediate angle can be simply interpolated. Angle / Axis Angle / Axis 1. Interpolate axis Α1 • Problem with angle/axis from A1 to A2 Rotate θ1 Α axis about A1 x A2 to – Interpolates fine but… get A Y θ – Can’t concatenate rotations. A1 x A2 2. Interpolate angle from θ2 θ 1 to θ2 to get θ – To fix this…enter the Quaternion. Z X 3. Rotate object by θ around A Quaternions Quaternion Math [ ] [ ] [ ] + = + + • Similar idea to axis/angle s v s v s s v v 1 1 2 2 1 2 1 2 [ ][ ] [ ] = − ⋅ + + × s v s v s s v v s v s v v v • Define an orientation by a 4-tuple 1 1 2 2 1 2 1 2 1 2 2 1 1 2 = + + + – [s, x, y, z] 2 2 2 2 q s x y z [ ] – Or by a pair = q 1 0 0 0 q [ ] – [s, v] where s is a scalar and v is a 3d vector. − s v − = 1 q 2 q [ ] − = 1 qq 1 0 0 0 5

  6. Quaternions Quaternions • Quaternions essentially encodes the info of • A series of rotations can be accomplished an axis/angle rotation by using quaternion multiplication – R θ , (x,y,z) = [ cos( θ /2), sin ( θ /2) • (x, y, z) ] • Rotation by p then by q is the same as rotation by qp Quaternions Quaternions • Conversions: Quaternion -> Rotation Matrix • To interpolate quaternions – q = [s, x, y, z] , q normalized – Interpolate each element one at a time ⎡ ⎤ − − − + 2 2 1 2 y 2 z 2 xy 2 sz 2 xz 2 sy – Sort of…. ⎢ ⎥ + − − − 2 2 – More on this when we talk about interpolation 2 xy 2 sz 1 2 x 2 z 2 yz 2 sx ⎢ ⎥ ⎢ ⎥ next time − + − − 2 2 2 xz 2 sy 2 yz 2 sx 1 2 x 2 y ⎣ ⎦ – Let’s see this in action Quaternions Quaternions • Conversions: Rotation Matrix -> Quaternion • Other conversions ⎡ ⎤ – To/from Euler angles m m m m + + + m m m 1 = 11 12 13 14 11 22 33 ⎢ ⎥ s 2 m m m m ⎢ ⎥ – See Shoemake paper on READING LIST 21 22 23 24 ⎢ ⎥ + − 2 m m m m m 1 2 s = 31 32 33 34 x 11 ⎢ ⎥ 2 ⎣ ⎦ m m m m 1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 transforma tion + − 2 m 1 2 s = • Questions? y 22 2 + − 2 m 1 2 s = 33 z 2 6

Recommend


More recommend