splines and animation - cornell university€¦ · keyframe animation •keyframing is the...

21
© 2012 Kavita Bala (with previous instructors James/Marschner) Cornell CS4620/5620 Fall 2012 • Lecture 30 1 CS4620/5620: Lecture 30 Splines and Animation © 2012 Kavita Bala (with previous instructors James/Marschner) Cornell CS4620/5620 Fall 2012 • Lecture 30 Announcements • 4621 – Friday (Animation) • HW 3 released tonight 2

Upload: others

Post on 12-Apr-2020

15 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30 1

CS4620/5620: Lecture 30

Splines and Animation

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Announcements

• 4621– Friday (Animation)

• HW 3 released tonight

2

Page 2: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Bezier curveRecursive algorithm: Option 2

void DrawRecBezier (float eps) { if Linear (curve, eps) DrawLine (curve); else SubdivideCurve (curve, leftC, rightC); DrawRecBezier (leftC, eps); DrawRecBezier (rightC, eps);}

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Termination Criteria

• Test for linearity– distance between control points– distance of control points from line

p1

p2

p3

p4

4

d0 < εd1 < εd0 d1

Page 3: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

B-splines

• We may want more continuity than C1

• B-splines are a clean, flexible way of making long splines with arbitrary order of continuity

• Various ways to think of construction– a simple one is convolution

• An approximating spline

5

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Deriving the B-Spline

• Approached from a different tack than Hermite-style constraints– Want a cubic spline; therefore 4 active control points

– Want C2 continuity– Turns out that is enough to determine everything

6

Page 4: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Efficient construction of any B-spline

• B-splines defined for all orders– order d: degree d – 1– order d: d points contribute to value

• One definition: Cox-deBoor recurrence

7

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

B-spline construction, alternate view

• Recurrence– ramp up/down

• Convolution– smoothing of basis fn– smoothing of curve

8

Page 5: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Cubic B-spline matrix

9

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Cubic B-spline curves

• Treat points uniformly• C2 continuity

• C(t) = [(1-t)3 Pi-3 + (3t3 – 6 t2 + 4)Pi-2 + (-3 t3 + 3t2 + 3t + 1) Pi-1 + t3 Pi]/6

• Notice blending functions still add to 1

Page 6: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Cubic B-spline basis

11

• B-spline from each 4-point sequence matches previous, next sequence with C2 continuity!• Treats all points uniformly

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Cubic B-spline basis

12

• B-spline from each 4-point sequence matches previous, next sequence with C2 continuity!• Treats all points uniformly

Page 7: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

di-1

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Rendering the spline-curve

• Given B-spline points d-1, … dL+1

• Compute Bézier points b0, … b3L

• Use De Casteljau algorithm to render

1/3

1/31/2 1/2

1/3 di

di+2

di+1

b3i-1

b3i-2b3i

b3i+1

b3i+2b3i+3

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Equations and boundary conditions

• Equations

•��b3i = (b3i-1+b3i+1)/2

• b3i-1 = di-1/3 + 2di/3

• b3i-2 = 2di-1/3 + di/3

• Boundary conditions•b0 = d-1, b1 = d0, b2 = (d0+d1)/2

•b3L = dL+1, b3L-1 = dL, b3L-2 = (dL-1+dL)/2

b0 = d-1

b1 = d0

d1b2

Page 8: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Converting spline representations

• All the splines we have seen so far are equivalent– all represented by geometry matrices

• where S represents the type of spline– therefore the control points may be transformed from one type

to another using matrix multiplication

15

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Other types of B-splines

• Nonuniform B-splines– discontinuities not evenly spaced– allows control over continuity or interpolation at certain points– e.g. interpolate endpoints (commonly used case)

• Nonuniform Rational B-splines (NURBS)– ratios of nonuniform B-splines: x(t)/w(t), y(t)/w(t)– key properties:

• invariance under perspective• ability to represent conic sections exactly

16

Page 9: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 305

Why Splines?

• Advantages• Smooth curves: C0, C1, C2 continuity

• Intuitive editing

• Smooth animation

• Compact: represent complex curves simply

• Convenient parametric representation

•Point p = (x,y) = (x(t), y(t))

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Surfaces

• Generalize by product of basis functions in 2 dimensions

18

Page 10: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Summary• Splines

– Smoothness, continuity (C0, C1, C2)

• Hermite– No convex hull property– 2 points and 2 tangents

• Bezier– Convex hull property– De Casteljau evaluation– Invariant to affine transformations

• B splines– Non-interpolation; i.e., approximating splines– C2 continuity

19

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation

20

Page 11: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation

• Industry production process leading up to animation• How animation works (very generally)• Artistic process of animation• Further topics in how it works

21

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

What is animation?

• Modeling = specifying shape• Animation = specifying shape as a function of time

– Just modeling done once per frame?– Need smooth, concerted movement

• Controlling shape = the technical problem• Using shape controls = the artistic problem

22

Page 12: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Approaches to animation

• Straight ahead– Draw/animate one frame at a time– Can lead to spontaneity, but is hard to get exactly what you

want

23

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Approaches to animation

• Straight ahead– Draw/animate one frame at a time– Can lead to spontaneity, but is hard to get exactly what you

want

• Pose-to-pose– Top-down process:

• Plan shots using storyboards• Plan key poses first• Finally fill in the in-between frames

24

Page 13: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Pose-to-pose animation planning

– First work out poses that are key to the story– Next fill in animation in between

25

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Keyframe animation

• Keyframing is the technique used for pose-to-pose animation– Head animator draws key poses—just enough to indicate what

the motion is supposed to be– Assistants do “in-betweening” and draw the rest of the frames– In computer animation substitute “user” and “animation

software”– Interpolation is the main operation

– Pro: lots of artistic control– Con: Manually intensive

26

Page 14: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Principles of Animation

• Classic paper by Lasseter– "Principles of Traditional Animation Applied To 3D Computer

Animation", John Lasseter, ACM Computer Graphics, Volume 21 Number 4, July 1987

27

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Principles of Animation–Timing–Ease In and Out (or Slow In and Out)–Arcs–Anticipation–Exaggeration–Squash and Stretch–Secondary Action–Follow Through and Overlapping Action–Straight Ahead Action and Pose-To-Pose Action–Staging–Appeal–Personality

28

Page 15: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

• Speed of an action is crucial to the impression it makes– gives physical and emotional meaning– examples with same keyframes, different times:

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

60 fr: looking around 30 fr: “no” 5 fr: just been hit

[Mic

hael

B. C

omet

]Animation principles: timing

29

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Timing

• Indicates emotional state• Eg. Look over left shoulder, then right

• On a scale of 1 to 10No in-between: snap1 in-between: hit with force2 in-betweens: nervous twitch3 in-betweens: dodging something4 in-betweens: giving an order6 in-betweens: sees something inviting9 in-betweens: thinking10 in-betweens: stretching

30

Page 16: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

• Real objects do not start and stop suddenly– animation parameters shouldn’t either

– a little goes a long way (just a few frames acceleration or deceleration for “snappy” motions)

Animation principles: ease in/out[M

icha

el B

. Com

et]

straight linear interp. ease in/out

31

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

• Real objects also don’t move in straight lines– generally curves are more graceful and realistic

Animation principles: moving in arcs

[Mic

hael

B. C

omet

]

32

Page 17: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: anticipation[M

icha

el B

. Com

et]

• Most actions are preceded by some kind of “wind-up”

33

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: exaggeration

[Mic

hael

B. C

omet

]

• Animation is not about exactly modeling reality• Exaggeration is very often used for emphasis

34

Page 18: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: squash & stretch[M

icha

el B

. Com

et]

• Objects do not remain perfectly rigid as they move• Adding stretch with motion and squash with impact:

– models deformation of soft objects

35

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: squash & stretch

[Mic

hael

B. C

omet

]

• Objects do not remain perfectly rigid as they move• Adding stretch with motion and squash with impact:

– scale object along direction of motion (elongate or squash)• maintain constant volume

– indicates motion by simulating exaggerated “motion blur”

36

Page 19: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: follow through[M

icha

el B

. Com

et]

[Mic

hael

B. C

omet

]

• We’ve seen that objects don’t start suddenly• They also don’t stop on a dime

– Let arm complete motion– Let leg kick complete motion

37

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Anim. principles: overlapping action

[Mic

hael

B. C

omet

]

• Usually many actions are happening at once

• Have a plan

38

Page 20: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Principles of Animation–Timing–Ease In and Out (or Slow In and Out)–Arcs–Anticipation–Exaggeration–Squash and Stretch–Follow Through and Overlapping Action–Staging–Appeal–Personality

39

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Animation principles: staging

[Mic

hael

B. C

omet

]

• Want to produce clear, good-looking 2D images• Attract attention to key character/actor

– need good camera angles, set design, and character positions– rim lighting

40

Page 21: Splines and Animation - Cornell University€¦ · Keyframe animation •Keyframing is the technique used for pose-to-pose animation –Head animator draws key poses—just enough

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Principles at work: weight[M

icha

el B

. Com

et]

41

© 2012 Kavita Bala •(with previous instructors James/Marschner)

Cornell CS4620/5620 Fall 2012 • Lecture 30

Computer-generatedmotion

• Interesting aside: manyprinciples of characteranimation follow indirectlyfrom physics

• Anticipation, follow-through,and many other effectscan be produced by simplyminimizing physical energy

• Seminal paper: “SpacetimeConstraints” by Witkin andKass in SIGGRAPH 1988

42