Coordinate Transformations Coordinate Transformation How to specify - - PDF document

coordinate transformations coordinate transformation
SMART_READER_LITE
LIVE PREVIEW

Coordinate Transformations Coordinate Transformation How to specify - - PDF document

Rendering Pipeline real camera photo Photographic Photography: Another look at rotation scene (captures processing print light) processing Quaternions camera Computer 3D tone synthetic model Graphics: models image reproduction


slide-1
SLIDE 1

1

Another look at rotation

Quaternions

Rendering Pipeline

camera (captures light) synthetic image camera model (focuses simulated lighting)

processing

photo processing tone reproduction real scene 3D models Photography: Computer Graphics: Photographic print

Coordinate Transformations

 How to specify placement of individual

  • bjects into a scene

 Two coordinate systems

 Object coordinate system  World coordinate system

Coordinate Transformation

 Transformation Matrix

{ {

  • bject

tion transforma 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 world

1 1

  • =
  • w

w w

z y x m m m m m m m m m m m m m m m m z y x 4 4 4 4 3 4 4 4 4 2 1

Coordinate Transformation

 Rotation

  • =

1 1 cos sin sin cos ) (

  • z

R

  • =

1 cos sin sin cos 1 ) (

  • x

R

  • =

1 cos sin 1 sin cos ) (

  • y

R

Problem in animation

 Transformation is a function of time  May need to interpolate  How to represent a given orientation

slide-2
SLIDE 2

2

  • 6. Straight ahead action and Pose-to-pose

action

 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

The idea behind keyframing

 Animator provides position/orientation

at key points in time

 System calculates position/orientation

for frames between keys using interpolation.

Transformation matrix

{ {

  • bject

tion transforma 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 world

1 1

  • =
  • w

w w

z y x m m m m m m m m m m m m m m m m z y x 4 4 4 4 3 4 4 4 4 2 1

translation rotation

Transformation matrix

 Can we use as a standard for

interpolation?

 Can we interpolate transformation

matrices, element by element, to get

  • rientation between keys?

Transformation matrix

 Can we use as a standard for

interpolation?

 Survey says: NO  Interpolated values may not be valid

transformation matrix

 Note: problem is with rotation, not

translation

Rotation matrix

 Rotation matrix factoids:

 Rotation matrices are orthogonal

 M-1 = MT  MMT = I

 det (M) = 1

 When interpolating, resulting matrices

may not have these properties

slide-3
SLIDE 3

3

Transformation matrix

 Consider the following

  • 1

1 1

Start with 90 degree y-axis rotation

  • 1

1 1

End with -90 degree y-axis rotation

  • 1

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. (10, 45, 90)  How many degrees of freedom now?

Coordinate Transformation

 Beware: Transformation is not communitive  Order of Fixed Angles is important

T R S R R S T R

x y x y

  • 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

interpolation?

 Let’s go to the video tape.

Fixed Angle / Euler angles

 Can we use as a standard for

interpolation?

 Survey says: NO  Interpolated values are indeed valid,

however…

 Interpolated values may seem unnatural

 Plus….the dreaded gimbal lock!

slide-4
SLIDE 4

4

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

90 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 11. (link)

Angle / Axis

 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)

Angle / Axis

 Interpolating

 From (A1, θ1) to (A2, θ2)  Intermediate axis can be determined by

rotating from one axis to the next.

 Intermediate angle can be simply

interpolated.

Angle / Axis

Α1 θ2 X Y Z θ1 A1 x A2 Α θ

  • 1. Interpolate axis

from A1 to A2 Rotate axis about A1 x A2 to get A

  • 2. Interpolate angle from

θ1 to θ2 to get θ

  • 3. Rotate object

by θ around A

Angle / Axis

 Problem with angle/axis

 Interpolates fine but…  Can’t concatenate rotations.  To fix this…enter the Quaternion.

slide-5
SLIDE 5

5

Quaternions

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

Quaternions

 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 (-1)

 There is an algebra built around this

definition.

Quaternion math

 Given 2 quaternions

 q1=[w1, x1, y1, z1] = [w1, v1]  q2=[w2, x2, y2, z2] = [w2, v2]

 Quaternion addition:

 q1 + q2 = [w1+w2, v1+v2]  q1 + q2 = [w1+w2, x1 + x2, y1 + y2, z1 + z2]

Quaternion math

 Quaternion multiplication

 (q1 * q2) = [w1w2 - v1⋅v2, w1v2 + w2w1 + v1×v2]  (q1 * q2).w = (w1w2 - x1x2 - y1y2 - z1z2)  (q1 * q2).x = (w1x2 + x1w2 + y1z2 - z1y2)  (q1 * q2).y = (w1y2 - x1z2 + y1w2 + z1x2)  (q1 * q2).z = (w1z2 + x1y2 - y1x2 + z1w2)

 Note: quaternion multiplication is not

commutative.

Quaternion math

 Magnitide of a quaternion

 ||q1|| = sqrt (w1

2 + x1 2 + y1 2 + z1 2)

 Yes, you can (and should) normalize

quaternions.

 Identity properties

[ ] [ ] [ ]

1 1

1 2 1

= − = =

− −

qq q v s q q q

Quaternions and rotation.

 Quaternions essentially encodes the info

  • f an axis/angle rotation

 R θ, (x,y,z) = [ cos(θ/2), sin (θ/2) • (x, y, z) ]

slide-6
SLIDE 6

6

Quaternions

 A series of rotations can be

accomplished by using quaternion multiplication

 Rotation by p then by q is the same as

rotation by qp

Quaternions

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

Quaternions

 Conversions: Quaternion -> Rotation Matrix

 q = [w, x, y, z] , q normalized

1 2y 2 2z2 2xy 2wz 2xz + 2wy 2xy + 2wz 1 2x 2 2z2 2yz 2wx 2xz 2wy 2yz + 2wx 1 2x 2 2y 2

  • Quaternions

 Conversions: Rotation Matrix -> Quaternion

4 4 4 4 3 4 4 4 4 2 1

tion transforma 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11

  • m

m m m m m m m m m m m m m m m

w = m11 + m22 + m33 +1 2

x = m11 +1 2w2 2 y = m22 +1 2w2 2 z = m33 +1 2w2 2

Quaternions

 Other conversions

 To/from Euler angles  See Shoemake paper on READING LIST

 Questions?

slide-7
SLIDE 7

7

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  1 minute animation  30 frames / second  30 frames x 60 seconds = 1800 frames  Must define position and orientation of each

(7 degrees of freedom/object) = 21 degrees

  • f freedom

 1800 frames x 21 dof = 37800 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, 1937

Next time

 Next time

 Interpolation schemes  Assignment #2

 Class Web Site:

 http://www.cs.rit.edu/~jmg/animation

 Any questions?