37
Animation Lecture 10 Slide 1 6.837 Fall 2003

Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

  • Upload
    others

  • View
    13

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Animation

Lecture 10 Slide 1 6.837 Fall 2003

Page 2: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Conventional AnimationDraw each frame of the animation

great controltedious

Reduce burden with cel animationlayerkeyframeinbetweencel panoramas (Disney’s Pinocchio)...

Lecture 10 Slide 2 6.837 Fall 2003

Page 3: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Computer-Assisted Animation

Lecture 10 Slide 3 6.837 Fall 2003

Keyframing automate the inbetweeninggood controlless tediouscreating a good animation

still requires considerable skilland talent

Procedural animationdescribes the motion algorithmicallyexpress animation as a function

of small number of parameteresExample: a clock with second, minute and hour hands

hands should rotate togetherexpress the clock motions in terms of a “seconds” variablethe clock is animated by varying the seconds parameter

Example 2: A bouncing ballAbs(sin(ωt+θ0))*e-kt

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 4: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Computer-Assisted AnimationPhysically Based Animation

Assign physical properties to objects (masses, forces, inertial properties)

Simulate physics by solving equationsRealistic but difficult to control

Motion CaptureCaptures style, subtle nuances and realismYou must observe someone do something

Lecture 10 Slide 4 6.837 Fall 2003

Image removed due to copyright considerations.

Page 5: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

OverviewHermite SplinesKeyframingTraditional Principles

Articulated ModelsForward KinematicsInverse KinematicsOptimizationDifferential Constraints

Lecture 10 Slide 5 6.837 Fall 2003

Squash & Stretch in Luxo Jr.'s Hop

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 6: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Keyframing

Describe motion of objects as a function of time from a set of key object positions. In short, compute the inbetween frames.

Lecture 10 Slide 6 6.837 Fall 2003

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 7: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Interpolating PositionsGiven positions:

find curve such that

( , , ), 0, ,i i ix y t i n= K

⎡ ⎤= ⎢ ⎥⎣ ⎦

( )( )

( )x t

ty t

C ⎡ ⎤= ⎢ ⎥⎣ ⎦

( ) ii

i

xt

yC

0u0 0 0( , , )x y t

1 1 1( , , )x y t

2 2 2( , , )x y t

( )tC

Lecture 10 Slide 7 6.837 Fall 2003

Page 8: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Linear Interpolation

Simple problem: linear interpolation between first two points assuming :The x-coordinate for the complete curve in the figure:

0 0 0( , , )x y t

1 1 1( , , )x y t

2 2 2( , , )x y t

)010 1 0 1

1 0 1 0

2 11 2 1 2

2 1 2 1

, ,( )

, ,

t tt t x x t t tt t t t

x tt t t tx x t t tt t t t

−−⎧ + ∈ ⎡⎣⎪ − −⎪= ⎨− −⎪ + ∈ ⎡ ⎤⎣ ⎦⎪ − −⎩

0 1=0 and =1t t ( )= − +0 1( ) 1x t x t x t

Derivation?

Lecture 10 Slide 8 6.837 Fall 2003

Page 9: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Polynomial Interpolation

0 0 0( , , )x y t

1 1 1( , , )x y t

2 2 2( , , )x y t

parabola

An n-degree polynomial can interpolate any n+1 points. The Lagrange formula gives the n+1 coefficients of an n-degree polynomial that interpolates n+1 points. The resulting interpolating polynomials are called Lagrange polynomials. On the previous slide, we saw the Lagrange formula for n = 1.

Lecture 10 Slide 9 6.837 Fall 2003

Page 10: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Spline InterpolationLagrange polynomials of small degree are fine but high degree polynomials are too wiggly.

How many n-degree polynomials interpolate n+1 points?

( )x t

t t t

8-degree polynomial spline spline vs. polynomial

Lecture 10 Slide 10 6.837 Fall 2003

Page 11: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Spline InterpolationLagrange polynomials of small degree are fine but high degree polynomials are too wiggly. Spline (piecewise cubic polynomial) interpolation produces nicer interpolation.

( )x t

t t t

8-degree polynomial spline spline vs. polynomial

Lecture 10 Slide 11 6.837 Fall 2003

Page 12: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Spline InterpolationA cubic polynomial between each pair of points:

Four parameters (degrees of freedom) for each spline segment.Number of parameters:n+1 points ⇒ n cubic polynomials ⇒ 4n degrees of freedom

Number of constraints:interpolation constraints

n+1 points ⇒ 2 + 2 (n-1) = 2n interpolation constraints

“endpoints” + “each side of an internal point”rest by requiring smooth velocity, acceleration, etc.

2 30 1 2 3( )x t c c t c t c t= + + +

Lecture 10 Slide 12 6.837 Fall 2003

Page 13: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Hermite SplinesWe want to support general constraints: not just smooth velocity and acceleration. For example, a bouncing ball does not always have continuous velocity:

Solution: specify position AND velocity at each pointDerivation? = = =0 1 2 3 0 0 0 1 1 1, , , ? for , : and , :c c c c x v t t x v t t

Lecture 10 Slide 13 6.837 Fall 2003

Page 14: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

KeyframingGiven keyframes

find curves such that

What are parameters ?position, orientation, size, visibility, …

Interpolate each curve separately

( )= =K K0 1, , , , 0, ,i i i iK p p t i n

( )( )

⎡ ⎤⎢ ⎥= ⎢ ⎥⎢ ⎥⎣ ⎦M

0

1( )p t

t p tK ( )i it =K K

K0 1, ,i ip p

Lecture 10 Slide 14 6.837 Fall 2003

Page 15: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Interpolating Key FramesInterpolation is not fool proof. The splines may undershoot and cause interpenetration. The animator must also keep an eye out for these types of side-effects.

Lecture 10 Slide 15 6.837 Fall 2003

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 16: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Traditional Animation PrinciplesThe in-betweening, was once a job for apprentice animators. We described the automatic interpolation techniques that accomplish these tasks automatically. However, the animator still has to draw the key frames. This is an art form and precisely why the experienced animators were spared the in-betweening work even before automatic techniques.The classical paper on animation by John Lasseter from Pixarsurveys some the standard animation techniques: "Principles of Traditional Animation Applied to 3D ComputerGraphics,“ SIGGRAPH'87, pp. 35-44.

Lecture 10 Slide 16 6.837 Fall 2003

Page 17: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Squash and stretchSquash: flatten an object or

character by pressure or by its own power

Stretch: used to increase the sense of speed and emphasize the squash by contrast

Lecture 10 Slide 17 6.837 Fall 2003

Squash & Stretch In Bouncing Ball

Squash & Stretch in Luxo Jr.'s Hop

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 18: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

TimingTiming affects weight:

Light object move quicklyHeavier objects move slower

Timing completely changes the interpretation of the motion. Because the timing is critical, the animators used the draw a time scale next to the keyframe to indicate how to generate the in-between frames.

Lecture 10 Slide 18 6.837 Fall 2003

TIMING CHART FOR BALL BOUNCE

EXTREME

EXTREME

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 19: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

AnticipationAn action breaks down into:

AnticipationActionReaction

Anatomical motivation: a muscle must extend before it can contract. Prepares audience for action so they know what to expect. Directs audience’s attention. Amount of anticipation can affect perception of speed and weight.

Lecture 10 Slide 19 6.837 Fall 2003

Squash & Stretch in Luxo Jr.'s Hop

Image adapted from:Lasseter, John. "Principles of Traditional Animation applied to 3D Computer Animation."ACM SIGGRAPH Computer Graphics 21, no. 4 (July 1987): 35-44.

Page 20: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Articulated ModelsArticulated models:

rigid partsconnected by joints

They can be animated by specifying the joint angles as functions of time.

Lecture 10 Slide 20 6.837 Fall 2003

qi q ti ( )

t1 t2t1 t2

Page 21: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Forward KinematicsDescribes the positions of the body parts as a function of the joint angles.

Lecture 10 Slide 21 6.837 Fall 2003

1 DOF: knee1 DOF: knee 2 DOF: wrist2 DOF: wrist 3 DOF: arm3 DOF: arm

Page 22: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Skeleton HierarchyEach bone transformation described relative to the parent in the hierarchy:

hips

r-thigh

r-calf

r-foot

left-leg ...

, , , , ,h h h h h hx y z θ φ σ

, ,t t tθ φ σ

,f fθ φ

Derive world coordinates for an effecter with local coordinates ?

vs

y

xz

wv sv

Lecture 10 Slide 22 6.837 Fall 2003

Page 23: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Forward Kinematics

Transformation matrix for an effecter vs is a matrix composition of all joint transformation between the effecter and the root of the hierarchy.

vsvsvs

y

xz

, , , , ,h h h h h hx y z θ φ σ

, ,t t tθ φ σ

,f fθ φ

w =v

Lecture 10 Slide 23 6.837 Fall 2003

sv( , )f fθ φTR( )cθTR)( , ,t t tθ φ σTR( , , ) ( , , )h h h h h hx y z θ φ σT R

( )θ φ σ θ φ σ θ θ φ⎛ ⎞⎜ ⎟⎜ ⎟⎝ ⎠14444444244444443w hv =S x , , , , , , , , , , , =Sh h h h h t t t c f f s s

p

y z v p v

Page 24: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Inverse KinematicsForward Kinematics

Given the skeleton parameters (position of the root and the joint angles) p and the position of the effecter in local coordinates vs, what is the position of the sensor in the world coordinates vw?Not too hard, we can solve it by evaluating

Inverse KinematicsGiven the position of the effecter

in local coordinates vs and the desired position ṽw in world coordinates, whatare the skeleton parameters p?

Much harder requires solving the inverseof the non-linear function:

Underdetermined problem with many solutions

( ) sS p v

( ) = %? such that s wp S p v v

vsvs

, , , , ,h h h h h hx y z θ φ σ

, ,t t tθ φ σ

,f fθ φ%wv

Lecture 10 Slide 24 6.837 Fall 2003

Page 25: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Real IK ProblemFind a “natural” skeleton configuration for a given collection of pose constraints.

Definition: A scalar objective function g(p) measures the quality of a pose. The objective g(p) reaches its minimum for the most natural skeleton configurations p.

Definition: A vector constraint function C(p) = 0 collects all pose constraints:

( )( )

⎡ ⎤−⎢ ⎥− =⎢ ⎥⎢ ⎥⎣ ⎦

%

%

M1442443

0 0 0

1 1 1

( )

0

C p

S p v vS p v v

Lecture 10 Slide 25 6.837 Fall 2003

Page 26: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

OptimizationCompute the optimal parameters p* that satisfy pose constraints and maximize the natural quality of skeleton configuration:

Example objective functions g(p):deviation from natural pose: joint stiffnesspower consumption…

=

=

* argmin ( )

s.t. ( ) 0p

p g p

C p

( )= − −( ) ( )Tg p p p M p p

Lecture 10 Slide 26 6.837 Fall 2003

Page 27: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Unconstrained OptimizationDefine an objective function f(p) that penalizes violation of pose constraints:

Necessary condition:

= + ⎡ ⎤⎣ ⎦

=

∑ 2

*

( ) ( ) ( )

argmin ( )

i ii

p

f p g p w C p

p f p

+ ∆ − ≥

∇ ∆ + ≥

∇ = ∆

L

* * *

*

*

( ) ( ) 0 ( is local minimum)

( ) 0 (Taylor series)

( ) 0 ( is arbitrary)

T

f p p f p pf p p

f p p

Lecture 10 Slide 27 6.837 Fall 2003

Page 28: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Numerical SolutionGradient methods

Guess initial solution x0

IterateUntil

The conditions guarantee that each new iterate is more optimal . Derive?

Some choices for direction dk:Steepest descent

Newton’s methodQuasi-Newton methods

α α+ = + > ∇ <1 , 0, ( ) 0Tk k k k k k kx x d f x d

∇ =( ) 0kf x

α > ∇ <0, ( ) 0Tk k kf x d

+ <1( ) ( )k kf x f x

∂ ∂= −∇ = − −

∂ ∂∑( ) 2 ik k i i

i

g Cd f x w Cp p

−⎡ ⎤= − ∇ ∇⎣ ⎦

12 ( ) ( )k k kd f x f x= − ∇ ( )k k kd D f x

Lecture 10 Slide 28 6.837 Fall 2003

Page 29: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Gradient ComputationRequires computation of constraint derivatives:

Compute derivatives of each transformation primitiveApply chain rule

Example:

Derive if R is a rotation around z-axis?

( ) ( , , ) ( , , ) ( , , ) ( ) ( , )

( )( , , ) ( , , ) ( , , ) ( , )

h h h h h h t t t c f f s w

ch h h h h h t t t f f s

c c

C p x y z v vC x y z v

T R TR TR TRRT R TR T TR

θ φ σ θ φ σ θ θ φθθ φ σ θ φ σ θ φ

θ θ

≡ −∂∂ =

∂ ∂

( )c

c

R θθ

∂∂

Lecture 10 Slide 29 6.837 Fall 2003

Page 30: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Constrained OptimizationUnconstrained formulation has drawbacks:

Sloppy constraintsThe setting of penalty weights wi must balance the constraints and the natural quality of the pose

Necessary condition for equality constraints:Lagrange multiplier theorem:

λ0 , λ1, … are scalars called Lagrange multipliers

Interpretations:Cost gradient (direction of improving the cost) belongs to the subspace spanned by constraint gradients (normals to the constraints surface).Cost gradient is orthogonal to subspace of feasible variations.

λ∇ + ∇ =∑* *( ) ( ) 0i ii

f p C p

Lecture 10 Slide 30 6.837 Fall 2003

Page 31: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Example

= +

+ =

*1 2

2 21 2

argmin

s.t. 2p

p p p

p p

⎡ ⎤∇ = ⎢ ⎥

⎣ ⎦* 1

( )1

f p

−⎡ ⎤∇ = ⎢ ⎥−⎣ ⎦

* 2( )

2C p

Lecture 10 Slide 31 6.837 Fall 2003

Page 32: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Nonlinear ProgrammingUse Lagrange multipliers and nonlinear programming techniques to solve the IK problem:

In general, slow for interactive use!

}

⎫= ⎬⎭=

* argmin ( ) nonlinear objective

s.t. ( ) 0 nonlinear constraints

pp g p

C p

Lecture 10 Slide 32 6.837 Fall 2003

Page 33: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Differential ConstraintsDifferential constraints linearizeoriginal pose constraints.

Rewrite constraints by pulling the desired effecter locations to the right hand side

Construct linear approximation around the current parameter p. Derive with Taylor series.

( )( )

⎡ ⎤ ⎡ ⎤⎢ ⎥ ⎢ ⎥=⎢ ⎥ ⎢ ⎥⎢ ⎥ ⎢ ⎥⎣ ⎦⎣ ⎦

%

%

M M14243

0 0 0

1 1 1

( )C p

S p v vS p v v

∂∆ = ∆

∂%( )C p p v

p

Lecture 10 Slide 33 6.837 Fall 2003

Page 34: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

IK with Differential ConstraintsInteractive Inverse Kinematics

User interface assembles desired effecter variationsSolve quadratic program with Lagrange multipliers:

Update current pose:

Objective function is quadratic, differential constraints are linear.Some choices for matrix M:

Identity: minimizes parameter variationsDiagonal: minimizes scaled parameter variations

∆ %v

∆∆ = ∆ ∆

∂∆ = ∆

∂%

* argmin

( ) s.t.

T

pp p M p

C p p vp

α+ = + ∆ *1k k kp p p

Lecture 10 Slide 34 6.837 Fall 2003

Page 35: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Quadratic Program

Lecture 10 Slide 35 6.837 Fall 2003

Elimination procedure

Apply Lagrange multiplier theorem and convert to vector notation:general form in scalar notation:

Rewrite to expose ∆p:

Use this expression to replace ∆p in the differential constraint:

Solve for Lagrange multipliers and compute ∆p*

λ⎛ ⎞∂∆ + =⎜ ⎟∂⎝ ⎠

( )0

TC pM p

pλ∇ + ∇ =∑* *( ) ( ) 0i i

i

f p C p

λ− ⎛ ⎞∂∆ = − ⎜ ⎟∂⎝ ⎠

1 ( )T

C pp Mp

λ− ⎛ ⎞∂ ∂= −∆⎜ ⎟∂ ∂⎝ ⎠

%1( ) ( )T

C p C pM vp p

Page 36: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

Kinematics vs. DynamicsKinematicsDescribes the positions of body parts as a function of skeleton parameters.DynamicsDescribes the positions of body parts as a function of applied forces.

Lecture 10 Slide 36 6.837 Fall 2003

Page 37: Viewing and Projection · Conventional Animation Draw each frame of the animation great control tedious Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s

NextDynamics

ACM© 1988 “Spacetime Constraints”

Lecture 10 Slide 37 6.837 Fall 2003