computer animation algorithms and techniques

26
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Technical Background

Upload: kimn

Post on 06-Jan-2016

32 views

Category:

Documents


0 download

DESCRIPTION

Computer Animation Algorithms and Techniques. Technical Background. Spaces and Transformations. Left-handed v. right handed Homogeneous coordinates: 4x4 transformation matrix (TM) Concatenating TMs Basic transformations (TMs) Display pipeline. Display Pipeline. Object Space Data. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Computer AnimationAlgorithms and Techniques

Technical Background

Page 2: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Spaces and Transformations

Left-handed v. right handedHomogeneous coordinates: 4x4 transformation matrix (TM) Concatenating TMsBasic transformations (TMs)Display pipeline

1zyx

Page 3: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Display Pipeline

Object Space Data

World Space Data

Eye Space Data

Image Space Data

Display Space Data

Object space to world space (TM)

World space to eye space (TM)

Perspective (TM)ClippingPerspective Divide

Image space to display space (TM)

Page 4: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Representing an orientation

Example: fixed angles - rotate around global axes

X

Y

Z

Orientation:

PRRRP xyz )()()('

Page 5: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Working with fixed angles and Rotation Matrices (RMs)

Extracing fixed angles from an orientation

Extracing fixed angles from a RM

Making a RM from fixed angles

Orthonormalizing a RM

Making a RM from transformed unit coordinate system (TUCS)

X

Y

Z

X

YZ

Page 6: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Transformations in pipeline

object -> world: often rigid transformsworld -> eye: rigid transformsperspective matrix: uses 4th component of homo. coordsperspective divideimage -> screen: 2D map to screen coordinatesClipping: procedure that considers view frustum

Page 7: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Error considerations

Accumulated round-off error - transform data:transform world data by delta RMupdate RM by delta RM; apply to object dataupdate angle; form RM; apply to object data

orthonormalizationrotation matrix: orthogonal, unit-length columnsiterate update by taking cross product of 2 vectorsscale to unit length

considerations of scalemiles-to-inches can exeed single precision arithmetic

Page 8: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Orientation Representation

Rotation matrixFixed angles: rotate about global coordinate systemEuler angles: rotate about local coordinate systemAxis-angle: arbitrary axis and angleQuaternions: mathematically handy axis-angle 4-tupleExponential map: 3-tuple version of quaternions

Page 9: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Transformation Matrix

ponm

lkji

hgfe

dcba

Page 10: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Transformation Matrix

1000z

y

x

tkji

tgfe

tcba

Page 11: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Rotation Matrices

1000

0100

00cossin

00sincos

1000

0cos0sin

0010

0sin0cos

1000

0cossin0

0sincos0

0001

Page 12: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Fixed Angles

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

X

Y

Z

PRRRP xyz )()()('

Page 13: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Gimbal Lock

0900

X

Y

Z

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

000

X

Y

Z

Page 14: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Gimbal Lock

0900Fixed order of rotations: x, y, z

X

Y

Z

0900

What do these epsilon rotations do?

0900

0900

Page 15: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Gimbal Lock

0900

X

Y

Z

90090

X

Y

Z

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

Page 16: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Euler Angles

Prescribed order: e.g., x, y, z or x, y, xRotate around (rotated) local axes

X

Y

Z

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

PRRRP zyx )()()('

Page 17: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Axis-Angle

zyx

A

Rotate about given axisEuler’s Rotation TheoremOpenGLFairly easy to interpolate between orientationsDifficult to concatenate rotations

X

Y

Z

A Q

Page 18: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Axis-angle to rotation matrix

X

Y

Z

A Q Concantenate the following:Rotate A around z to x-z planeRotate A’ around y to x-axisRotate theta around xUndo rotation around y-axisUndo rotation around z-axis

Page 19: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Axis-angle to rotation matrix

*

)(

*

)sin()ˆ)(cos(ˆ

0

0

0

ˆ

AAIARot

aa

aa

aa

A

azaaaaa

aaaaaa

aaaaaa

A

zyx

xy

xz

yz

zyzxz

zyyyxy

zxyxxx

X

Y

Z

AQ

P

P’

Page 20: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Quaternion

ARot A *)

2sin(

2cos

Same as axis-angle, but different formStill rotate about given axisMathematically convenient form

X

Y

Z

vs

q

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

A Q

Page 21: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Quaternion Arithmetic

Addition

Multiplication

Length

Inner Product

22112121 vsvsvvss

212112212121 vvvsvsvvssqq

212121 vvssqq

qqq

Page 22: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Quaternion Arithmetic

Inverse vsqq

2

11

000111 qqqq

111 pqpq

Unit quaternionq

qq ˆ

Page 23: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Quaternion Represention

Vector

Transform

v0

1)(' qvqvRotv q

Page 24: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Quaternion Geometric Operations

)())(( vRotvRotRotv qppq

)()( vRotvRot qq

vqqvqqvRotRotv qq

)())(( 111

)()( vRotvRot kqq

Page 25: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

Unit Quaternion Conversions

22

22

22

2212222

2222122

2222221

yxsxyzsyxz

sxyzzxszxy

syxzszxyzy

Rot zyxs

vvzyx

s

/),,(

)(cos2 1

Axis-Angle

Page 26: Computer Animation Algorithms and Techniques

Computer AnimationRick Parent

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?