Fundamentals of Computer Animation

59
University of Victoria Graphics Lab. CSC 473 2010 page 1 Fundamentals of Computer Animation Object Deformation

Transcript of Fundamentals of Computer Animation

Page 1: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 1

Fundamentals ofComputer Animation

Object Deformation

Page 2: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 2

Object Deformation

• Many objects are not rigid– jello– mud– gases/liquids– etc.

• Two main techniques:– Geometric deformations– Physically-based methods

Page 3: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 3

Object Deformation

• Assume general geometric objects• Morphing one object into another

– If the same number of points, same edgeconnectivity (simple)

• Simple shape modifications– General affine transformation

• Non-uniform scale• Shearing• Warping

Page 4: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 4

Geometric Deformations

• Deform the object’s geometry directly• Two main techniques:

– control point / vertex manipulation– space warping

Page 5: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 5

Control Point /Vertex Manipulation

Edit the surface vertices or control points directly

Page 6: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 6

Space Warping

Deform the object by deforming the space it is in

Two main techniques: Nonlinear Deformation Free Form Deformation (FFD)

Independent of object representation

Page 7: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 7

Nonlinear Global Deformation

Objects are defined in a local object space

Deform this space using a combination of: Non-uniform Scaling Tapering Twisting Bending

Combine these to produce complex shapes

Can produce quite interesting results

Page 8: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 8

Non-uniform Scale

Transformation matrix - diagonal elements

0

1

Sx

Sy

Sz

0

0

0

0

0

0 0

0

00 0

Page 9: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 9

Non-uniform Scale

Page 10: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 10

Nonlinear Global Deformation

Page 11: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 11

Nonlinear Global Deformation

Good for modeling [Barr 87]

Animation is harder

Page 12: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 12

Global Deformations

Transformation matrix elements - functions of coordinates

f(x,y,z) g(x,y,z)

Page 13: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 13

Global Deformations - taper

x’ = xy’ = f(x)

x’y’

1 00 f(x)

=x’y’

Tapered ObjectOriginal Object

Page 14: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 14

Global Deformations - taper

Page 15: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 15

Global Deformations - twist

x’ = x*cos(f(y)) – z*sin(f(y))y’ = yz’ = x*sin(f(y)) + z*cos(f(y))

Page 16: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 16

Global Deformations - twist

Page 17: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 17

Global Deformations - bend

y0

1/k

Page 18: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 18

Global Deformations - bend

Page 19: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 19

The Jacoboan MatrixThe Jacobian Matrix:

The Jacobian of a functionrepresents the tangent planeto the function at a given point

E.g. Transformation from spherical polar coordinates to cartesian

!

(x1,x2 ,x3)

!

(r,",#)

The gradient is the derivative of a scalarfunction. The Jacobian is the derivative of amultivariate function.

if (x2,y2) = f(x1,y1) is used to transform an image, the Jacobian of f, J(x1,y1)describes how much the image in the neighborhood of (x1,y1) is stretched in thex, y, and xy directions.

!

x1 = rsin" cos#x2 = rsin" sin#x3 = rcos"

!

JF =

"x1"r

"x1"#

"x1"$

"x2"r

"x2"#

"x2"$

"x3"r

"x3"#

"x3"$

%

&

' ' ' ' ' ' '

(

)

* * * * * * *

Page 20: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 20

!

JF =

"x1"r

"x1"#

"x1"$

"x2"r

"x2"#

"x2"$

"x3"r

"x3"#

"x3"$

%

&

' ' ' ' ' ' '

(

)

* * * * * * *

=

sin# cos$ rcos# cos$ +rsin# sin$sin# sin$ rcos# sin$ rsin# cos$cos# +rsin# 0

%

&

' ' '

(

)

* * *

Jacobian

For a square matrix the determinant is also called the Jacobian.The Jacobian determinant is used when making achange of variables when integrating a function over its domain.determinant of the above = r2 sin θ

Page 21: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 21

Using Jacobian to find Gradient of Barr WarpGlobal twist given by:

!

X = xC" # yS"Y = xS" + yC"

Z = z

!

" = f (z)C" = cos(")S" = sin(")

!

J =

"X"x

"X"y

"X"z

"Y"x

"Y"y

"Y"z

"Z"x

"Z"y

"Z"z

#

$

% % % % % % %

&

'

( ( ( ( ( ( (

=

C) *S) *zS) f '(z) * yS) f '(z)S) C) zC) f '(z) * yS) f '(z)0 0 1

#

$

% % %

&

'

( ( (

gives the normal transformation matrix.Determinant is unity so the twisttransform preserves volume.

Tangent

!

J "1T

!

J "1T =

C# "S# 0S# C# 0

yf '(z) "xf '(z) 1

$

%

& & &

'

(

) ) )

Page 22: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 22

Global Deformations - compound

Page 23: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 23

Barr Deformations apply to implicits too

Page 24: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 24

Implicits

Page 25: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 25

Animating Shape Change

• Per-vertex animation curves– beginning and end known

• Simply change parameters with time– Twist angle– Scaling constant– Seed vertex position

• All standard rules apply– Curve smoothness, motion controls, etc.

Page 26: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 26

Free Form Deformation (FFD)

Deform space by deforming a lattice around anobject

The deformation is defined by moving the controlpoints

Imagine it as if the object were encased in rubber

Page 27: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 27

Grid Deformation

2D technique used in the film HUNGER

Overlay 2D grid on top of object

Map object vertices to grid cells (create local coordinate system)

User distorts 2D grid vertices

Object vertices are remapped to local coordinate systemof 2D grid by using bilinear interpolation

Page 28: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 28

Grid Deformation

Page 29: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 29

0.5

0.8

For each vertexIdentify cellLocal u,v coorindate

Grid Deformation

Page 30: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 30

Coordinate grid deformation

2D Bilinear interpolation

P00

P01P11

P10

Pu1

Pu0

Puv

1110)1(01)1(00

10

11011

10000

11

)1()1()1(

PPPPvuP

vPPvPuPPuPuPPuP

uvvuvuuv

uuuv

u

u

+!+!+!

!=

+!=

+!=

+!=

u,v correspond to the coordinateson the rectangular grid before thelattice is deformed.

e.g. point at u=0.4 v=0.6

Page 31: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 31

Grid Deformation

Page 32: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 32

Grid Deformation

Page 33: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 33

Free-Form Deformations

(not necessarily mutually perpendicular)

S

T

U

Define local coordinate system for deformation

As for Burtnyk technique but higher order. Typically cubic - Bezier in Sederberg original.Local grid over objects.f(object P) --> P’(grid vertices)user manipulates grid changes coordinates of object.

Page 34: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 34

FFD - register point in cell

S

T

U

))/(())(( 0 SUTPPUTsrrrrrrr

!"!=P(s,t,u) e.g.determined

P0

vertex P

Page 35: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 35

Free Form Deformation (FFD)

• Local coord system: (S,T,U)• Point P coordinate along S:

• Equiv. for T,U• Algorithm:

– Introduce fine grid– Deform grid points– Use Bezier interpolation (or other) to get new position

• Treat new grid points as control points

))/(())(( 0 SUTPPUTsrrrrrrr

!"!=

Page 36: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 36

FFD - register point in cell

s = (TxU) . (P-P0) / ((TxU) . S)

TxU U

S

T

P

P0

((TxU) . S) (TxU) . (P-P0)

P = P0 + sS + tT + uU

U

s = (TxU).(P-P0) / ((TxU).S)t = (UxS).(P-P0) / ((UxS).T)u = (SxT) .(P-P0) / ((SxT).U)

Essentially this is the projection of S onto TxU.

0<=s<=1 is the proportion of the range that the point will map to.

Page 37: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 37

Could be non-cubic e.g. S,U,T 4x3x2 I x j x kPijk=P0 +(i/l) S + (j/m )T + (k/m)U0<=i<=l 0 <=j<=m 0<=k<=n

P151 text bookinterpolation function as per Bezier - Bernstein

Non-Cubic Lattice

Page 38: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 38

FFD - create control grid

(not necessarily mutually perpendicular)

Page 39: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 39

FFD - move and reposition

Move control grid points

Usually tri-cubic interpolation is used with FFDs

Originally Bezier interpolation was used.

B-spline and Catmull-Romm interpolation havealso been used (as well as tri-linear interpolation)(see Parent Animation Book Appendix )

Page 40: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 40

FFD - extensions

Hierarchical FFDs

Animated FFD

Static FFD that object moves through

Non-parallelpiped FFD

Page 41: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 41

FFD - films and videos

examples

Boppin’ in Bean Town by John Chadwick

Facit demo by Beth Hofer

Balloon Guy by Chris Wedge

Page 42: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 42

Bezier solids

• Bezier curves: 1D entity• Bezier patches: 2D

– Have a surface connectivity control mesh– Repeat DeCasteljau twice, get a point

• Bezier solids (3D): Same, but three times• Each (s,t,u) point can be written through

control points– Cubic polynomial in s, t, u (for cubic Bezier)

• New position:– same expression, same s,t,u– new c.p. positions

Page 43: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 43

Free Form Deformation (FFD)

The lattice defines a Bezier volume

!=ijk

ijk wBvBuBwvu )()()(),,( pQ

Compute lattice coordinates

Alter the control points

Compute the deformed points

),,( wvu

ijkp

),,( wvuQ

),,( wvu

),,( wvu

Page 44: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 44

Page 45: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 45

Page 46: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 46

Page 47: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 47

Page 48: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 48

Page 49: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 49

FFD Example

Page 50: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 50

FFD Example

Page 51: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 51

Animation with FFD

• Hierarchical FFD– Coarse level FFD modifies vertices and finer FFD grids

• Moving object through deformation tool– Can move the tool itself

• Modifying control points of FFD– Any technique applies

• Key frame• Physics based

• Example:– FFD is relative to wire skeleton– Moves of skeleton re-position FFD grid– Skin position is computed within new FFD

Page 52: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 52

Ad-hoc muscle

Page 53: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 53

Animate a reference and a deformed lattice

reference deformed morphed

FFD Animation

Page 54: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 54

FFD Animation

Animate the object through the lattice

reference deformed morphed

Page 55: Fundamentals of Computer Animation
Page 56: Fundamentals of Computer Animation
Page 57: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 57

Factor Curves

Modify the transformation applied to the object based on where andwhen it is applied

)()(0 tfwf tw!! =

)(!wR

wf

tf

Page 58: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 58

Factor Curves

Scripted animation can lead to complex motions(depending on animator skill)

Deformations can be nested

Page 59: Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 59

Show animation of :1. Deform control points over time2. Move Object through deformed space3. Deformation over time

Sample animations