Fundamentals of Computer Animation

Post on 01-May-2022

2 views 0 download

Transcript of Fundamentals of Computer Animation

University of Victoria Graphics Lab. CSC 473 2010 page 1

Fundamentals ofComputer Animation

Object Deformation

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

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

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

University of Victoria Graphics Lab. CSC 473 2010 page 5

Control Point /Vertex Manipulation

Edit the surface vertices or control points directly

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

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

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

University of Victoria Graphics Lab. CSC 473 2010 page 9

Non-uniform Scale

University of Victoria Graphics Lab. CSC 473 2010 page 10

Nonlinear Global Deformation

University of Victoria Graphics Lab. CSC 473 2010 page 11

Nonlinear Global Deformation

Good for modeling [Barr 87]

Animation is harder

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)

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

University of Victoria Graphics Lab. CSC 473 2010 page 14

Global Deformations - taper

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

University of Victoria Graphics Lab. CSC 473 2010 page 16

Global Deformations - twist

University of Victoria Graphics Lab. CSC 473 2010 page 17

Global Deformations - bend

y0

1/k

University of Victoria Graphics Lab. CSC 473 2010 page 18

Global Deformations - bend

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"$

%

&

' ' ' ' ' ' '

(

)

* * * * * * *

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 θ

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

$

%

& & &

'

(

) ) )

University of Victoria Graphics Lab. CSC 473 2010 page 22

Global Deformations - compound

University of Victoria Graphics Lab. CSC 473 2010 page 23

Barr Deformations apply to implicits too

University of Victoria Graphics Lab. CSC 473 2010 page 24

Implicits

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.

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

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

University of Victoria Graphics Lab. CSC 473 2010 page 28

Grid Deformation

University of Victoria Graphics Lab. CSC 473 2010 page 29

0.5

0.8

For each vertexIdentify cellLocal u,v coorindate

Grid Deformation

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

University of Victoria Graphics Lab. CSC 473 2010 page 31

Grid Deformation

University of Victoria Graphics Lab. CSC 473 2010 page 32

Grid Deformation

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.

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

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

!"!=

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.

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

University of Victoria Graphics Lab. CSC 473 2010 page 38

FFD - create control grid

(not necessarily mutually perpendicular)

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 )

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

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

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

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

University of Victoria Graphics Lab. CSC 473 2010 page 44

University of Victoria Graphics Lab. CSC 473 2010 page 45

University of Victoria Graphics Lab. CSC 473 2010 page 46

University of Victoria Graphics Lab. CSC 473 2010 page 47

University of Victoria Graphics Lab. CSC 473 2010 page 48

University of Victoria Graphics Lab. CSC 473 2010 page 49

FFD Example

University of Victoria Graphics Lab. CSC 473 2010 page 50

FFD Example

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

University of Victoria Graphics Lab. CSC 473 2010 page 52

Ad-hoc muscle

University of Victoria Graphics Lab. CSC 473 2010 page 53

Animate a reference and a deformed lattice

reference deformed morphed

FFD Animation

University of Victoria Graphics Lab. CSC 473 2010 page 54

FFD Animation

Animate the object through the lattice

reference deformed morphed

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

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

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