Animation Process

55
Multimedia System and Networking Lab @ UTD Slide- 1 University of Texas at Dallas Animation Process while (not finished) { MoveEverything(); DrawEverything(); } Interactive vs. Non-Interactive Real Time vs. Non-Real Time

description

Animation Process. while (not finished) { MoveEverything(); DrawEverything(); } Interactive vs. Non-Interactive Real Time vs. Non-Real Time. Character Rigging. Skeleton Skin Facial Expressions Muscles Secondary motion: fat, hair, clothing…. Character Animation. Keyframe Animation - PowerPoint PPT Presentation

Transcript of Animation Process

Page 1: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 1

University of Texas at Dallas B. Prabhakaran

Animation Process

while (not finished) {MoveEverything();

DrawEverything();

}

• Interactive vs. Non-Interactive

• Real Time vs. Non-Real Time

Page 2: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 2

University of Texas at Dallas B. Prabhakaran

Character Rigging

• Skeleton• Skin• Facial Expressions• Muscles• Secondary motion: fat, hair, clothing…

Page 3: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 3

University of Texas at Dallas B. Prabhakaran

Character Animation

• Keyframe Animation• Motion Capture• Inverse Kinematics• Locomotion• Procedural Animation• Artificial Intelligence

Page 4: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 4

University of Texas at Dallas B. Prabhakaran

Character Animation

Page 5: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 5

University of Texas at Dallas B. Prabhakaran

Physics Simulation

• Particles• Rigid bodies

– Collisions, contact, stacking, rolling, sliding

• Articulated bodies– Hinges, constraints

• Deformable bodies (solid mechanics)– Elasticity, plasticity, viscosity– Fracture– Cloth

• Fluid dynamics– Fluid flow (liquids & gasses)– Combustion (fire, smoke,

explosions…)– Phase changes (melting, freezing,

boiling…)

• Vehicle dynamics– Cars, boats, airplanes, helicopters,

motorcycles…

• Character dynamics– Body motion, skin & muscle, hair,

clothing

Page 6: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 6

University of Texas at Dallas B. Prabhakaran

Physics Simulation

Page 7: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 7

University of Texas at Dallas B. Prabhakaran

Animation Tools

• Maya• 3D Studio• Lightwave• Filmbox• Blender

• Many more…

Page 8: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 8

University of Texas at Dallas B. Prabhakaran

Animation Production

• Conceptual Design• Production Design• Modeling• Materials & Shaders• Rigging• Blocking• Animation• Lighting• Effects• Rendering• Post-Production

Page 9: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 9

University of Texas at Dallas B. Prabhakaran

Resolution & Frame Rates

• Video:– NTSC: 720 x 480 @ 30 Hz (interlaced)– PAL: 720 x 576 @ 25 Hz (interlaced)

• HDTV:– 720p: 1280 x 720 @ 60 Hz– 1080i: 1920 x 1080 @ 30 Hz (interlaced)– 1080p: 1920 x 1080 @ 60 Hz

• Film:– 35mm: ~2000 x ~1500 @ 24 Hz– 70mm: ~4000 x ~2000 @ 24 Hz– IMAX: ~5000 x ~4000 @ 24-48 Hz

• Note: Hz (Hertz) = frames per second (fps)• Note: Video standards with an i (such as 1080i) are interlaced, while

standards with a p (1080p) are progressive scan

Page 10: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 10

University of Texas at Dallas B. Prabhakaran

Interlacing

• Older video formats (NTSC, PAL) and some HD formats (1080i) use a technique called interlacing

• With this technique, the image is actually displayed twice, once showing the odd scanlines, and once showing the even scanlines (slightly offset)

• This is a trick for achieving higher vertical resolution at the expense of frame rate (cuts effective frame rate in half)

• The two different displayed images are called fields• NTSC video, for example, is 720 x 480 at 30 frames per second, but is

really 720 x 240 at 60 fields per second• Interlacing is an important issue to consider when working with video,

especially in animation as in TV effects and video games• Computer monitors are generally not interlaced

Page 11: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 11

University of Texas at Dallas B. Prabhakaran

Rendering• There are many ways to design a 3D renderer• The two most common approaches are:

– Traditional graphics pipeline– Ray-based rendering

• With the traditional approach, primitives (usually triangles) are rendered into the image one at a time, and complex visual effects often involve a variety of different tricks

• With ray-based approaches, the entire scene is stored and then rendered one pixel at a time. Ray based approaches can simulate light more accurately and offer the possibility of significant quality improvements, but with a large cost

• In this class, we will not be very concerned with rendering, as we will focus mainly on how objects move rather than how they look

Page 12: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 12

University of Texas at Dallas B. Prabhakaran

Coordinate Systems

x

y

z

• Right handed coordinate system

Page 13: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 13

University of Texas at Dallas B. Prabhakaran

3D Models

• Let’s say we have a 3D model that has an array of position vectors describing its shape

• We will group all of the position vectors used to store the data in the model into a single array: vn where 0 ≤ n ≤ NumVerts-1

• Each vector vn has components vnx vny vnz

Page 14: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 14

University of Texas at Dallas B. Prabhakaran

Vector Review

Page 15: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 15

University of Texas at Dallas B. Prabhakaran

Vector Arithmetic

zyx

zyx

zzyyxx

zzyyxx

zyx

zyx

sasasas

aaa

bababa

bababa

bbb

aaa

a

a

ba

ba

b

a

Page 16: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 16

University of Texas at Dallas B. Prabhakaran

Vector Magnitude• The magnitude (length) of a vector is:

• A vector with length=1.0 is called a unit vector• We can also normalize a vector to make it a unit vector:

222zyx vvv v

v

v

Page 17: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 17

University of Texas at Dallas B. Prabhakaran

Dot Product

cosbaba

ba

ba

zzyyxx

ii

bababa

ba

Page 18: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 18

University of Texas at Dallas B. Prabhakaran

Dot Product

baba

baba

ba

ba

T

zzyyxx

ii

bababa

ba

cos

z

y

x

zyx

b

b

b

aaa ba

Page 19: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 19

University of Texas at Dallas B. Prabhakaran

Example: Angle Between Vectors

• How do you find the angle θ between vectors a and b?

a

b θ

Page 20: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 20

University of Texas at Dallas B. Prabhakaran

Example: Angle Between Vectors

ba

ba

ba

ba

baba

1cos

cos

cos

a

b θ

Page 21: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 21

University of Texas at Dallas B. Prabhakaran

Dot Products with General Vectors

• The dot product is a scalar value that tells us something about the relationship between two vectors

– If a·b > 0 then θ < 90º

– If a·b < 0 then θ > 90º

– If a·b = 0 then θ = 90º (or one or more of the vectors is degenerate (0,0,0))

Page 22: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 22

University of Texas at Dallas B. Prabhakaran

Dot Products with One Unit Vector

a

u

a·u

• If |u|=1.0 then a·u is the length of the projection of a onto u

Page 23: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 23

University of Texas at Dallas B. Prabhakaran

Example: Distance to Plane

• A plane is described by a point p on the plane and a unit normal n. Find the distance from point x to the plane

•p

n

• x

Page 24: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 24

University of Texas at Dallas B. Prabhakaran

Example: Distance to Plane

• The distance is the length of the projection of x-p onto n:

•p

n

• x

x-p

npx dist

Page 25: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 25

University of Texas at Dallas B. Prabhakaran

Dot Products with Unit Vectors

bθ a

a·b = 00 < a·b < 1

a·b = -1

a·b = 1

-1 < a·b < 0

cos

0.1

ba

baa·b

Page 26: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 26

University of Texas at Dallas B. Prabhakaran

Cross Product

xyyxzxxzyzzy

zyx

zyx

babababababa

bbb

aaa

kji

ba

ba

Page 27: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 27

University of Texas at Dallas B. Prabhakaran

Properties of the Cross Product

0

sin

ba

ba

baba

ba

area of parallelogram ab

is a vector perpendicular to both a and b, in the direction defined by the right hand rule

if a and b are parallel

Page 28: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 28

University of Texas at Dallas B. Prabhakaran

Example: Normal of a Triangle

• Find the unit length normal of the triangle defined by 3D points a, b, and c

ab

c

Page 29: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 29

University of Texas at Dallas B. Prabhakaran

Example: Normal of a Triangle

n

nn

acabn

b-a

c-a

ab

c

Page 30: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 30

University of Texas at Dallas B. Prabhakaran

Example: Area of a Triangle

• Find the area of the triangle defined by 3D points a, b, and c

ab

c

Page 31: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 31

University of Texas at Dallas B. Prabhakaran

Example: Area of a Triangle

acab 2

1area

b-a

c-a

ab

c

Page 32: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 32

University of Texas at Dallas B. Prabhakaran

Example: Alignment to Target

• An object is at position p with a unit length heading of h. We want to rotate it so that the heading is facing some target t. Find a unit axis a and an angle θ to rotate around.

ph

t

Page 33: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 33

University of Texas at Dallas B. Prabhakaran

Example: Alignment to Target

ph

tt-p

θ

a

pt

pth

pth

ptha

1cos

Page 34: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 34

University of Texas at Dallas B. Prabhakaran

Vector Classclass Vector3 {public:

Vector3() {x=0.0f; y=0.0f; z=0.0f;}Vector3(float x0,float y0,float z0) {x=x0; y=y0; z=z0;}void Set(float x0,float y0,float z0) {x=x0; y=y0; z=z0;}void Add(Vector3 &a) {x+=a.x; y+=a.y; z+=a.z;}void Add(Vector3 &a,Vector3 &b) {x=a.x+b.x; y=a.y+b.y; z=a.z+b.z;}void Subtract(Vector3 &a) {x-=a.x; y-=a.y; z-=a.z;}void Subtract(Vector3 &a,Vector3 &b) {x=a.x-b.x; y=a.y-b.y; z=a.z-b.z;}void Negate() {x=-x; y=-y; z=-z;}void Negate(Vector3 &a) {x=-a.x; y=-a.y; z=-a.z;}void Scale(float s) {x*=s; y*=s; z*=s;}void Scale(float s,Vector3 &a) {x=s*a.x; y=s*a.y; z=s*a.z;}float Dot(Vector3 &a) {return x*a.x+y*a.y+z*a.z;}void Cross(Vector3 &a,Vector3 &b)

{x=a.y*b.z-a.z*b.y; y=a.z*b.x-a.x*b.z; z=a.x*b.y-a.y*b.x;}float Magnitude() {return sqrtf(x*x+y*y+z*z);}void Normalize() {Scale(1.0f/Magnitude());}

float x,y,z;};

Page 35: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 35

University of Texas at Dallas B. Prabhakaran

Translation

• Let’s say that we want to move our 3D model from it’s current location to somewhere else…

• In technical jargon, we call this a translation• We want to compute a new array of positions v′n

representing the new location• Let’s say that vector d represents the relative offset

that we want to move our object by• We can simply use: v′n = vn + d

to get the new array of positions

Page 36: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 36

University of Texas at Dallas B. Prabhakaran

Transformations

v′n = vn + d

• This translation represents a very simple example of an object transformation

• The result is that the entire object gets moved or translated by d• From now on, we will drop the n subscript, and just write

v′ = v + d

remembering that in practice, this is actually a loop over several different vn vectors applying the same vector d every time

Page 37: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 37

University of Texas at Dallas B. Prabhakaran

Transformations

• Always remember that this compact equation can be expanded out into

• Or into a system of linear equations:

dvv

z

y

x

z

y

x

z

y

x

d

d

d

v

v

v

v

v

v

zzz

yyy

xxx

dvv

dvv

dvv

Page 38: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 38

University of Texas at Dallas B. Prabhakaran

Rotation

• Now, let’s rotate the object in the xy plane by an angle θ, as if we were spinning it around the z axis

• Note: a positive rotation will rotate the object counterclockwise when the rotation axis (z) is pointing towards the observer

zz

yxy

yxx

vv

vvv

vvv

cossin

sincos

Page 39: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 39

University of Texas at Dallas B. Prabhakaran

• We can expand this to:

• And rewrite it as a matrix equation:

• Or just:

Rotation

zz

yxy

yxx

vv

vvv

vvv

cossin

sincos

zyxz

zyxy

zyxx

vvvv

vvvv

vvvv

1 0 0

0cossin

0sincos

z

y

x

z

y

x

v

v

v

v

v

v

100

0cossin

0sincos

vMv

Page 40: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 40

University of Texas at Dallas B. Prabhakaran

Rotation

• We can represent a z-axis rotation transformation in matrix form as:

or more compactly as:

where

z

y

x

z

y

x

v

v

v

v

v

v

100

0cossin

0sincos

vMv

100

0cossin

0sincos

zRM

Page 41: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 41

University of Texas at Dallas B. Prabhakaran

Rotation• We can also define rotation matrices for the x, y, and z axes:

100

0cossin

0sincos

zR

cossin0

sincos0

001

xR

cos0sin

010

sin0cos

yR

Page 42: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 42

University of Texas at Dallas B. Prabhakaran

Linear Transformations• Like translation, rotation is an example of a linear

transformation

• True, the rotation contains sin()’s and cos()’s, but those ultimately just end up as constants in the actual linear equation

• We can generalize our matrix in the previous example to be:

vMv

333

222

111

cba

cba

cba

M

Page 43: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 43

University of Texas at Dallas B. Prabhakaran

Linear Equation

• A general linear equation of 1 variable is:

where a and d are constants

• A general linear equation of 3 variables is:

• Note: there are no nonlinear terms like vxvy, vx2, sin(vx)

davvf

dcvbvavfvvvf zyxzyx v,,

Page 44: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 44

University of Texas at Dallas B. Prabhakaran

System of Linear Equations

• Now let’s look at 3 linear equations of 3 variables vx, vy, and vz

• Note that all of the an, bn, cn, and dn are constants (12 in total)

3333

2222

1111

dvcvbvav

dvcvbvav

dvcvbvav

zyxz

zyxy

zyxx

Page 45: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 45

University of Texas at Dallas B. Prabhakaran

Matrix Notation

dvMv

3

2

1

333

222

111

3333

2222

1111

d

d

d

v

v

v

cba

cba

cba

v

v

v

dvcvbvav

dvcvbvav

dvcvbvav

z

y

x

z

y

x

zyxz

zyxy

zyxx

Page 46: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 46

University of Texas at Dallas B. Prabhakaran

Translation• Let’s look at our translation transformation again:

• If we really wanted to, we could rewrite our three translation equations as:

zzz

yyy

xxx

dvv

dvv

dvv

zzyxz

yzyxy

xzyxx

dvvvv

dvvvv

dvvvv

100

010

001

dvv

Page 47: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 47

University of Texas at Dallas B. Prabhakaran

Identity• We can see that this is equal to a transformation by the

identity matrix

3

2

1

3

2

1

100

010

001

100

010

001

d

d

d

v

v

v

v

v

v

dvvvv

dvvvv

dvvvv

z

y

x

z

y

x

zyxz

zyxy

zyxx

Page 48: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 48

University of Texas at Dallas B. Prabhakaran

Identity

• Multiplication by the identity matrix does not affect the vector

vIv

I

100

010

001

Page 49: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 49

University of Texas at Dallas B. Prabhakaran

• We can apply a uniform scale to our object with the following transformation

• If s>1, then the object will grow by a factor of s in each dimension

• If 0<s<1, the object will shrink

• If s<0, the object will be reflected across all three dimensions, leading to an object that is ‘inside out’

Uniform Scaling

z

y

x

z

y

x

v

v

v

s

s

s

v

v

v

00

00

00

Page 50: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 50

University of Texas at Dallas B. Prabhakaran

• We can also do a more general nonuniform scale, where each dimension has its own scale factor

which leads to the equations:

Non-Uniform Scaling

z

y

x

z

y

x

z

y

x

v

v

v

s

s

s

v

v

v

00

00

00

zzz

yyy

xxx

vsv

vsv

vsv

Page 51: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 51

University of Texas at Dallas B. Prabhakaran

Multiple Transformations

• If we have a vector v, and an x-axis rotation matrix Rx, we can generate a rotated vector v′:

• If we wanted to then rotate that vector around the y-axis, we could simply:

vRv x

vRRv

vRv

xy

y

Page 52: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 52

University of Texas at Dallas B. Prabhakaran

• We can extend this to the concept of applying any sequence of transformations:

• Because matrix algebra obeys the associative law, we can regroup this as:

• This allows us to concatenate them into a single matrix:

• Note: matrices do NOT obey the commutative law, so the order of multiplications is important

Multiple Transformations

vMMMMv 1234

vMMMMv 1234

vMv

MMMMM

total

total 1234

Page 53: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 53

University of Texas at Dallas B. Prabhakaran

Matrix Dot Matrix

NML

333231

232221

131211

333231

232221

131211

333231

232221

131211

nnn

nnn

nnn

mmm

mmm

mmm

lll

lll

lll

32132212121112 nmnmnml

Page 54: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 54

University of Texas at Dallas B. Prabhakaran

Multiple Rotations & Scales

• We can combine a sequence of rotations and scales into a single matrix

• For example, we can combine a y-rotation, followed by a z-rotation, then a non-uniform scale, and finally an x-rotation:

vMv

RRsSRM

yzx

Page 55: Animation Process

Multimedia System and Networking Lab @ UTD Slide- 55

University of Texas at Dallas B. Prabhakaran

Multiple Translations• We can also take advantage of the associative

property of vector addition to combine a sequence of translations

• For example, a translation along vector t1 followed by a translation along t2 and finally t3 can be combined:

dvv

tttd

321