Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation...

37
Lecture 10 Slide 1 6.837 Fall 2003 Animation

Transcript of Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation...

Page 1: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 1 6.837 Fall 2003

Animation

Page 2: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 2 6.837 Fall 2003

Conventional AnimationDraw each frame of the animation

great control tedious

Reduce burden with cel animation layer keyframe inbetween cel panoramas (Disney’s Pinocchio) ...

ACM © 1997 “Multiperspective panoramas for cel animation”

Page 3: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 3 6.837 Fall 2003

Computer-Assisted AnimationKeyframing

automate the inbetweening good control less tedious creating a good animationstill requires considerable skilland talent

Procedural animation describes the motion algorithmically express animation as a function of small number of parameteres Example: a clock with second, minute and hour hands

hands should rotate together express the clock motions in terms of a “seconds” variable the clock is animated by varying the seconds parameter

Example 2: A bouncing ball Abs(sin(t+0))*e-kt

ACM © 1987 “Principles of traditional animation applied to 3D computer

animation”

Page 4: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 4 6.837 Fall 2003

Computer-Assisted AnimationPhysically Based Animation

Assign physical properties to objects (masses, forces, inertial properties) Simulate physics by solving equations Realistic but difficult to control

Motion Capture Captures style, subtle nuances and realism You must observe someone do something

ACM© 1988 “Spacetime Constraints”

Page 5: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 5 6.837 Fall 2003

OverviewHermite SplinesKeyframingTraditional Principles

Articulated ModelsForward KinematicsInverse KinematicsOptimizationDifferential Constraints

Page 6: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 6 6.837 Fall 2003

Keyframing

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

ACM © 1987 “Principles of traditional animation applied to 3D computer animation”

( )s t

Page 7: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 7 6.837 Fall 2003

Interpolating PositionsGiven positions:

find curve such that

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

( )( )

( )

x tt

y tC

( ) ii

i

xt

yC

0u0 0 0( , , )x y t

1 1 1( , , )x y t

2 2 2( , , )x y t

( )tC

Page 8: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 8 6.837 Fall 2003

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 tx x t t t

t t t tx t

t t t tx x t t t

t t t t

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

Derivation?

Page 9: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 9 6.837 Fall 2003

Polynomial Interpolation

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.

0 0 0( , , )x y t

1 1 1( , , )x y t

2 2 2( , , )x y t

parabola

Page 10: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 10 6.837 Fall 2003

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

Page 11: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 11 6.837 Fall 2003

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

Page 12: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 12 6.837 Fall 2003

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 freedomNumber of constraints:

interpolation constraintsn+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

Page 13: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 13 6.837 Fall 2003

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

Page 14: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 14 6.837 Fall 2003

KeyframingGiven keyframes

find curves such that

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

Interpolate each curve separately

0 1, , , , 0, ,i i i iK p p t i n

0

1( )

p t

t p tK ( )i it K K

0 1, ,i ip p

Page 15: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 15 6.837 Fall 2003

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.

Page 16: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 16 6.837 Fall 2003

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 Pixar surveys some the standard animation techniques: "Principles of Traditional Animation Applied to 3D Computer Graphics,“ SIGGRAPH'87, pp. 35-44.

Page 17: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 17 6.837 Fall 2003

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

Page 18: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 18 6.837 Fall 2003

Timing

Timing affects weight: Light object move quickly Heavier 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.

Page 19: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 19 6.837 Fall 2003

AnticipationAn action breaks down into:

Anticipation Action Reaction

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.

Page 20: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 20 6.837 Fall 2003

Articulated ModelsArticulated models:

rigid parts connected by joints

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

t1 t2

qi q ti ( )

t1 t2

Page 21: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 21 6.837 Fall 2003

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

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

Page 22: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 22 6.837 Fall 2003

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 q f s

, ,t t tq f s

cq

,ffq f

Derive world coordinates for an effecter with local coordinates ?

vs

y

xz

wv sv

Page 23: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 23 6.837 Fall 2003

Forward Kinematics

vs

y

x

z

w =vsv( , )

ffq fTR( )cqTR( , , )

t t tq f sTR( , , ) ( , , )

h h h h h hx y z q f sT R

vsvs

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

w hv =S x , , , , , , , , , , , =Sh h h h h t t t c ff s s

p

y z v p v

, , , , ,h h h h h hx y z q f s

, ,t t tq f s

cq

,ffq f

Page 24: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 24 6.837 Fall 2003

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 Kinematics Given the position of the effecter in local coordinates vs and the desired

position ṽw in world coordinates, what

are 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 q f s

, ,t t tq f s

cq

,ffq fwv

Page 25: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 25 6.837 Fall 2003

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:

0 0 0

1 1 1

( )

0

C p

S p v v

S p v v

Page 26: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 26 6.837 Fall 2003

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 stiffness power consumption …

* argmin ( )

s.t. ( ) 0p

p g p

C p

( ) ( )T

g p p p M p p

Page 27: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 27 6.837 Fall 2003

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

* * *

*

*

( ) ( ) 0 ( is local minimum)

( ) 0 (Taylor series)

( ) 0 ( is arbitrary)

T

f p p f p p

f p p

f p p

Page 28: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 28 6.837 Fall 2003

Numerical SolutionGradient methods

Guess initial solution x0

Iterate Until

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

Some choices for direction dk: Steepest descent

Newton’s method Quasi-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 C

p p

12 ( ) ( )k k kd f x f x

( )k k kd D f x

Page 29: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 29 6.837 Fall 2003

Gradient ComputationRequires computation of constraint derivatives:

Compute derivatives of each transformation primitive Apply chain rule

Example:

Derive if R is a rotation around z-axis?

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

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

h h h h h h t t t c ff s w

ch h h h h h t t t ff s

c c

C p x y z v v

Cx y z v

T R TR TR TR

RT R TR T TR

q f s q f s q q f

qq f s q f s q f

q q

º -

¶¶=

¶ ¶

%

( )c

c

R qq

¶¶

Page 30: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 30 6.837 Fall 2003

Constrained OptimizationUnconstrained formulation has drawbacks:

Sloppy constraints The 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

Page 31: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 31 6.837 Fall 2003

Example

*1 2

2 21 2

argmin

s.t. 2

pp p p

p p

* 1

( )1

f p

* 2( )

2C p

Page 32: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 32 6.837 Fall 2003

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

Page 33: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 33 6.837 Fall 2003

Differential ConstraintsDifferential constraints linearize original 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.

0 0 0

1 1 1

( )C p

S p v v

S p v v

( )C p

p vp

Page 34: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 34 6.837 Fall 2003

IK with Differential ConstraintsInteractive Inverse Kinematics

User interface assembles desired effecter variations Solve quadratic program with Lagrange multipliers:

Update current pose:

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

Identity: minimizes parameter variations Diagonal: minimizes scaled parameter variations

v

* argmin

( ) s.t.

T

pp p M p

C pp v

p

*1k k kp p p

Page 35: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 35 6.837 Fall 2003

Quadratic ProgramElimination 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 p

M pp

* *( ) ( ) 0i ii

f p C p

1( ) ( )T

C p C pM v

p p

1 ( )T

C pp M

p

Page 36: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 36 6.837 Fall 2003

Kinematics vs. DynamicsKinematics Describes the positions of body parts as a function of skeleton parameters.Dynamics Describes the positions of body parts as a function of applied forces.

Page 37: Lecture 10Slide 16.837 Fall 2003 Animation. Lecture 10Slide 26.837 Fall 2003 Conventional Animation Draw each frame of the animation great control tedious.

Lecture 10 Slide 37 6.837 Fall 2003

NextDynamics

ACM© 1988 “Spacetime Constraints”