ppt

advertisement

Rick Parent

Computer Animation

Algorithms and Techniques

Technical Background

Computer Animation

Spaces and Transformations

Left-handed v. right handed

Homogeneous coordinates:

4x4 transformation matrix (TM)

Concatenating TMs

Basic transformations (TMs)

Display pipeline

 x y z 1

Rick Parent Computer Animation

Object Space Data

World space to eye space (TM)

Display

Pipeline

Object space to world space (TM)

World Space Data

Eye Space Data

Perspective (TM)

Clipping

Perspective Divide

Image Space Data

Image space to display space (TM)

Display Space Data

Rick Parent Computer Animation

Representing an orientation

Example: fixed angles - rotate around global axes

Y

Orientation :

    

P '

R z

(

) R y

(

) R x

(

) P

X

Z

Rick Parent Computer Animation

Working with fixed angles and

Rotation Matrices (RMs)

Z

Z

Y

Y

Orthonormalizing a RM

Extracing fixed angles from an orientation

Extracing fixed angles from a RM

X

Making a RM from fixed angles

X

Making a RM from transformed unit coordinate system (TUCS)

Rick Parent Computer Animation

Transformations in pipeline object -> world: often rigid transforms world -> eye: rigid transforms perspective matrix: uses 4 th component of homo. coords perspective divide image -> screen: 2D map to screen coordinates

Clipping: procedure that considers view frustum

Rick Parent Computer Animation

Error considerations

Accumulated round-off error - transform data: transform world data by delta RM update RM by delta RM; apply to object data update angle; form RM; apply to object data orthonormalization rotation matrix: orthogonal, unit-length columns iterate update by taking cross product of 2 vectors scale to unit length considerations of scale miles-to-inches can exeed single precision arithmetic

Rick Parent Computer Animation

Orientation Representation

Rotation matrix

Fixed angles: rotate about global coordinate system

Euler angles: rotate about local coordinate system

Axis-angle: arbitrary axis and angle

Quaternions: mathematically handy axis-angle 4-tuple

Exponential map: 3-tuple version of quaternions

Rick Parent Computer Animation

Transformation Matrix

 i a e m f b n j c g k o l d h p

Rick Parent Computer Animation

Transformation Matrix

 e i a

0 b f

0 j c g k

0 t t t

1 x y z

Rick Parent Computer Animation

Rotation

Matrices

1

 0

0

0 cos sin

0

 

 

 sin cos

0

 

 

0 0

0

0

0

1

 cos

 

0 sin

0

0

0

0

1 sin cos

0

 

0

0

0

0

1 

 cos

 sin

0

0

 

 

 sin cos

 

 

0

0

1

0

0

0

0

1

0

0

Computer Animation Rick Parent

Y

Fixed Angles

X

 

Z

  

P '

R z

(

) R y

(

) R x

(

) P

Fixed order: e.g., x, y, z; also could be x, y, x

Global axes

Rick Parent Computer Animation

Gimbal Lock

0 0

Y

0

Fixed angle: e.g., x, y, z

0 90

Y

0

X

X

Z

Rick Parent

Z

Computer Animation

Gimbal Lock

0 90

Y

0

X

Fixed order of rotations: x, y, z

What do these epsilon rotations do?

0

 

90 0

0 90

 

0

0 90 0

  

Z

Rick Parent Computer Animation

0 90

Y

Gimbal Lock

0

 

90 0

Y

90

X X

Z Z

Interpolating FA representations does not produce intuitive rotation because of gimbal lock

Rick Parent Computer Animation

Euler Angles

Y

    

Prescribed order: e.g., x, y, z or x, y, x

Rotate around (rotated) local axes

Z

 

Note: fixed angles are same as Euler angles in reverse order and vice versa

  

P '

R x

(

) R y

(

) R z

(

) P

X

Rick Parent Computer Animation

Axis-Angle

 

A x

 y z

 

Y

A

X

Z

Rotate about given axis

Euler’s Rotation Theorem

OpenGL

Fairly easy to interpolate between orientations

Difficult to concatenate rotations

Q

Rick Parent Computer Animation

Axis-angle to rotation matrix

Z

Y

A

X

Q Concantenate the following:

Rotate A around z to x-z plane

Rotate A’ around y to x-axis

Rotate theta around x

Undo rotation around y-axis

Undo rotation around z-axis

Rick Parent Computer Animation

Axis-angle to rotation matrix

A

*

 a a a x y z a a a x x x

 a

0 a z y

Rot

(

  x y a x z

)

 a x a y a y a y a z a y

 a z

0 a x a y a z a a az z z

Y

A

 a y a x

0

Z

 cos(

)( I

 ˆ

)

 sin(

) A

*

X

Q

P

P’

Rick Parent Computer Animation

Quaternion

Y

Rot  

A

 cos

2 sin(

2

) * A

Same as axis-angle, but different form

Still rotate about given axis

Mathematically convenient form

 s v

 q

Z

A

X

Note: in this form v is a scaled version of the given axis of rotation, A

Q

Rick Parent Computer Animation

Quaternion Arithmetic

Addition

 s

1

 s

2 v

1

 v

2

  s

1 v

1

  s

2 v

2

Multiplication q

1 q

2

 s

1 s

2

 v

1

 v

2 s

2 v

1

 s

1 v

2

 v

1

 v

2

Inner Product

Length q

1

 q

2

 s

1 s

2

 v

1

 v

2 q

 q

 q

Rick Parent Computer Animation

Quaternion Arithmetic

Inverse q

1 

1 q

2 qq

1  q

1 q

1

 s

 v

0 0 0

 

  

1  q

1 p

1

Unit quaternion q

ˆ  q q

Rick Parent Computer Animation

Quaternion Represention

Vector

Transform

0 v

 v '

Rot q

( v )

 qvq

1

Rick Parent Computer Animation

Quaternion Geometric Operations

Rot q

( v )

Rot

 q

( v )

Rot q

( v )

Rot kq

( v ) v

 

Rot q

( Rot p

( v ))

Rot qp

( v ) v

 

Rot q

1

( Rot q

( v ))

 q

1

( qvq

1

) q

 v

Rick Parent Computer Animation

Unit Quaternion Conversions

Rot  s x y z

1

2

2 xy

2 xz y

2

2

2

2 sz sy z

2

2 xy

2 sz

1

2 x

2 

2 z

2

2 yz

2 sx 1

2

2 xz yz

2 x

2

2

2 sy sx

2 y

2

Axis-Angle

 

2 cos

1

( s )

( x , y , z )

 v / v

Rick Parent Computer Animation

Quaternions

Avoid gimbal lock

Easy to rotate a point

Easy to convert to a rotation matrix

Easy to concatenate – quaternion multiply

Easy to interpolate – interpolate 4-tuples

How about smoothly (in both space and time) interpolate?

Rick Parent Computer Animation

Download