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

1 4 41 4 4 4 42 2 4 43 4 4 4 44 3 world object transforma
SMART_READER_LITE
LIVE PREVIEW

{ { 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


slide-1
SLIDE 1

1

Transformations, Rotations, Orientations

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

Question

  • Given an object to be placed / oriented in a

scene

– How does one specify this placement /

  • rientation for each frame

– How many “parameters” are required?

  • Each controllable parameter is a degree of

freedom

Coordinate Transformations

  • How to specify placement of individual
  • bjects into a scene
  • Two coordinate systems

– Object coordinate system – World coordinate system

  • A Third coordinate system

– Camera 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

  • Transform operations

– Scaling – Translation – Rotation

slide-2
SLIDE 2

2

Coordinate Transformation

⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = 1 ) , , (

z y x z y x

s s s s s s S

⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = 1 1 1 1 ) , , (

z y x z y x

d d d d d d T Scaling Transformation

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

Coordinate Transformations

  • Individual operations can be composed into

a single matrix.

x y

R S T R M ⋅ ⋅ ⋅ =

Tacking on the camera

  • The role of cameras can be described as

projecting a 3D scene onto a 2D plane

Tacking on the camera

{ {

  • bject

camera to world 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 projection 44 43 42 41 34 33 32 31 24 23 22 21 14 13 12 11 plane view

1 1 ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ ⋅ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ ⋅ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡

w w w v v v

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

Problem in animation

  • Transformation is a function of time
  • May need to interpolate
  • How to represent a given orientation
slide-3
SLIDE 3

3

  • 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 Camera projection

Transformation matrix

  • Can we use as a standard for interpolation?

– Can we interpolate transformation matrices, element by element, to get orientation between keys? – BTW, how many degrees of freedom if we can?

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

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

slide-4
SLIDE 4

4

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!

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

slide-5
SLIDE 5

5

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.

Quaternions

  • Similar idea to axis/angle
  • Define an orientation by a 4-tuple

– [s, x, y, z] – Or by a pair – [s, v] where s is a scalar and v is a 3d vector.

Quaternion Math

[ ] [ ] [ ] [ ][ ] [ ] [ ] [ ] [ ]

1 1

1 2 1 2 2 2 2 2 1 1 2 2 1 2 1 2 1 2 2 1 1 2 1 2 1 2 2 1 1

= − = = + + + = × + + ⋅ − = + + = +

− −

qq q v s q q q z y x s q v v v s v s v v s s v s v s v v s s v s v s

slide-6
SLIDE 6

6

Quaternions

  • Quaternions essentially encodes the info of

an axis/angle rotation

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

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 – Let’s see this in action

Quaternions

  • Conversions: Quaternion -> Rotation Matrix

– q = [s, x, y, z] , q normalized ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎣ ⎡ − − + − − − − + + − − −

2 2 2 2 2 2

2 2 1 2 2 2 2 2 2 2 2 1 2 2 2 2 2 2 2 2 1 y x sx yz sy xz sx yz z x sz xy sy xz sz xy z y

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

2 1

33 22 11

+ + + = m m m s

2 2 1

2 11

s m x − + = 2 2 1

2 22

s m y − + = 2 2 1

2 33

s m z − + =

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 [s, 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 of 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 #1

  • Class Web Site:

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

  • Any questions?