18 - Computer Animation - Princeton University

14 downloads 117 Views 3MB Size Report
Adam Finkelstein. Princeton University. COS 426, Spring 2003. Advertisement. Computer Animation. • What is animation? o Make objects change over time.
Advertisement

Computer Animation Adam Finkelstein Princeton University COS 426, Spring 2003

Computer Animation

3-D and 2-D animation

• What is animation? o Make objects change over time according to scripted actions

• What is simulation?

Pixar

o Predict how objects change over time according to physical laws

Homer 3-D

Homer 2-D

University of Illinois

Outline

Principles of Traditional Animation

• Principles of animation • Keyframe animation • Articulated figures • Kinematics • Dynamics

Angel Plate 1

• • • • • • • • • • •

Squash and stretch Slow In and out Anticipation Exaggeration Follow through and overlapping action Timing Staging Straight ahead action and pose-to-pose action Arcs Secondary action Appeal

Disney

1

Principles of Traditional Animation

Principles of Traditional Animation

• Squash and stretch

• Slow In and Out

Lasseter `87

Principles of Traditional Animation

Principles of Traditional Animation

• Anticipation (and squash & stretch)

Lasseter `87

Computer Animation

• • • • • • • • • • •

Squash and stretch Slow In and out Anticipation Exaggeration Follow through and overlapping action Timing Staging Straight ahead action and pose-to-pose action Arcs Secondary action Appeal

Disney

Keyframe Animation

Animation pipeline o o o o o o o o

Watt Figure 13.5

• Define character poses at specific time steps called “keyframes”

3D modeling Articulation Motion specification Motion simulation Shading Lighting Rendering Postprocessing » Compositing

Pixar

Lasseter `87

2

Keyframe Animation

Keyframe Animation

• Interpolate variables describing keyframes to determine poses for character “in-between”

• Inbetweening: o Linear interpolation - usually not enough continuity

Linear interpolation

H&B Figure 16.16

Lasseter `87

Keyframe Animation

Keyframe Animation

• Inbetweening:

• Inbetweening:

o Spline interpolation - maybe good enough

o Cubic spline interpolation - maybe good enough » May not follow physical laws

H&B Figure 16.11

Keyframe Animation

Lasseter `87

Keyframe Animation

• Inbetweening:

• Inbetweening:

o Cubic spline interpolation - maybe good enough » May not follow physical laws

Lasseter `87

o Inverse kinematics or dynamics

Rose et al. `96

3

Outline

Articulated Figures

• Principles of animation

• Character poses described by set of rigid bodies connected by “joints”

• Keyframe animation • Articulated figures

Base

• Kinematics Arm

• Dynamics

Hand Scene Graph Angel Plate 1

Articulated Figures

Angel Figures 8.8 & 8.9

Articulated Figures

• Well-suited for humanoid characters

Joints provide handles for moving articulated figure

Root Chest Neck Head

LHip

LCollar LCollar LShld

LShld

RHip

LKnee RKnee LAnkle RAnkle

LElbow LElbow LWrist

LWrist Mike Marr, COS 426, Princeton University, 1995

Rose et al. `96

Articulated Figures

Example: Walk Cycle

• Inbetweening

• Articulated figure:

o Compute joint angles between keyframes

Good arm

Bad arm Watt & Watt

Watt & Watt

4

Example: Walk Cycle

Example: Walk Cycle

• Hip joint orientation:

• Knee joint orientation:

Watt & Watt

Example: Walk Cycle

Watt & Watt

Example: Run Cycle

• Ankle joint orientation:

Mike Marr, COS 426, Princeton University, 1995

Watt & Watt

Example: Ice Skating

Outline • Principles of animation • Keyframe animation • Articulated figures • Kinematics • Dynamics

(Mao Chen, Zaijin Guan, Zhiyan Liu, Xiaohu Qie, CS426, Fall98, Princeton University)

Angel Plate 1

5

Kinematics and Dynamics

Example: 2-Link Structure

• Kinematics

• Two links connected by rotational joints

o Considers only motion o Determined by positions, velocities, accelerations

Θ2

• Dynamics

“End-Effector” 2

o Considers underlying forces o Compute motion from initial conditions and physics

X = (x,y)

1 Θ1 (0,0)

Forward Kinematics

Forward Kinematics

• Animator specifies joint angles: Θ1 and Θ2

• Joint motions can be specified by spline curves

• Computer finds positions of end-effector: X

Θ2 2

Θ2 2

Θ1

X = (x,y)

1

X = (x,y)

1 (0,0)

Θ1

Θ1

(0,0) Θ2

X = (l1 cos Θ1 + l2 cos(Θ1 + Θ 2 ), l1 sin Θ1 + l2 sin(Θ1 + Θ 2 ))

Forward Kinematics

Example: 2-Link Structure

• Joint motions can be specified by initial conditions and velocities

• What if animator knows position of “end-effector” Θ2

Θ2

“End-Effector”

2

2 X = (x,y)

X = (x,y)

1 Θ1 (0,0)

t

Θ1 (0) = 60o dΘ1 = 1.2 dt

1 Θ1

Θ 2 (0) = 250o dΘ 2 = −0.1 dt

(0,0)

6

Inverse Kinematics

Inverse Kinematics

• Animator specifies end-effector positions: X

• End-effector postions can be specified by splines

• Computer finds joint angles: Θ1 and Θ2:

Θ2 2

Θ2 2

X = (x,y)

 x 2 + x 2 − l12 − l2 2   Θ 2 = cos −1   2l1l2  

1 Θ1 (0,0)

Θ1 =

X = (x,y)

1 Θ1 (0,0)

x

− (l2 sin(Θ 2 ) x + (l1 + l2 cos(Θ 2 )) y (l2 sin(Θ 2 )) y + (l1 + l2 cos(Θ 2 )) x

Inverse Kinematics

y

t

Inverse Kinematics

• Problem for more complex structures

• Solution for more complex structures:

o System of equations is usually under-defined o Multiple solutions

o Find best solution (e.g., minimize energy in motion) o Non-linear optimization

X = (x,y)

Θ2

3

2

X = (x,y)

Θ2 2

Θ3

1

Θ3

1 Θ1

Three unknowns: Θ1, Θ2 , Θ3 Two equations: x, y

(0,0)

Summary of Kinematics • Forward kinematics o Specify conditions (joint angles) o Compute positions of end-effectors

• Inverse kinematics o “Goal-directed” motion o Specify goal positions of end effectors o Compute conditions required to achieve goals

3

Θ1 (0,0)

Overview • Kinematics o Considers only motion o Determined by positions, velocities, accelerations

• Dynamics o Considers underlying forces o Compute motion from initial conditions and physics

Inverse kinematics provides easier specification for many animation tasks, but it is computationally more difficult

7

Dynamics

Spacetime Constraints

• Simulation of physics insures realism of motion

• Animator specifies constraints: o What the character’s physical structure is » e.g., articulated figure o What the character has to do » e.g., jump from here to there within time t o What other physical structures are present » e.g., floor to push off and land o How the motion should be performed » e.g., minimize energy

Lasseter `87

Spacetime Constraints

Spacetime Constraints

• Computer finds the “best” physical motion satisfying constraints o x(t) is position of particle at time t o f(t) is force of jet propulsion at time t o Particle’s equation of motion is:

mx ' '− f − mg = 0 o Suppose we want to move from a to b within t0 to t1 with minimum jet fuel: t1



f (t ) 2 dt subject to x(t0)=a and x(t1)=b

t0

xi − xi −1 h x − 2 xi + xi −1 x' 'i = i +1 h2 x'i =

• Example: particle with jet propulsion

Minimize

• Discretize time steps:

x − 2 xi + xi −1   m x' 'i = i +1  − f i − mg = 0 h2   Minimize h

i

Witkin & Kass `88

Spacetime Constraints



2

f i subject to x0=a and x1=b Witkin & Kass `88

Spacetime Constraints

• Solve with iterative optimization methods

• Advantages: o Free animator from having to specify details of physically realistic motion with spline curves o Easy to vary motions due to new parameters and/or new constraints

• Challenges: o Specifying constraints and objective functions o Avoiding local minima during optimization

Witkin & Kass `88

8

Spacetime Constraints

Spacetime Constraints

• Adapting motion:

• Adapting motion:

Original Jump

Hurdle

Heavier Base Witkin & Kass `88

Spacetime Constraints

Witkin & Kass `88

Spacetime Constraints

• Adapting motion:

• Editing motion:

Ski Jump Witkin & Kass `88

Spacetime Constraints

Li et al. `99

Dynamics

• Morphing motion:

• Other physical simulations: o o o o o o

Rigid bodies Soft bodies Cloth Liquids Gases etc. Cloth (Baraff & Witkin `98)

Hot Gases Gleicher `98

(Foster & Metaxas `97)

9

Summary • Principles of animation • Keyframe animation • Articulated figures • Kinematics o Forward kinematics o Inverse kinematics

• Dynamics o Space-time constraints o Also other physical simulations

10