590 likes | 1.03k Views
Computer Graphics Animation Techniques. Ronen Barzel. Introduction Keyframe interpolation. About me. Pixar animation studios “Toy Story”: modeling, lighting, software Tools development Research Physically-based modeling Non-photorealistic rendering ronen@barzel.org. Outline for today.
E N D
Computer GraphicsAnimation Techniques Ronen Barzel Introduction Keyframe interpolation
About me • Pixar animation studios • “Toy Story”: modeling, lighting, software • Tools development • Research • Physically-based modeling • Non-photorealistic rendering • ronen@barzel.org
Outline for today • Overview of the course • Overview of CG animation process • Keyframe animation
Outline for today • Overview of the course • Overview of CG animation process • Keyframe animation
Goals of the class • Exposure to common techniques • Motivation and principles • Implementation of basic methods • Tools, not art • Mechanism, not user interface
Overview of the course • 9 class sessions: • ~1.5 hours lecture • ~2 hours TD • Projects • Large project (?) • Small project (?) • Final examination (?)
Types of Animation • Scripted Animation • Procedural Animation • Motion capture
Topics in Animation • Scripted Animation • Keyframe interpolation, articulated models, inverse kinematics, deformations, … • Procedural Animation • Particle Systems, Flocks, Crowds, Cloth, Fire, Smoke, Water, … • Motion capture • Filtering, editing, retargeting, stitching,… (more than 9 topics!)
About you • Why are you taking the class? • What’s your background? • What are you interested in learning?
Outline for today • Overview of the class • Overview of CG animation process • Keyframe animation
Overview of CG animation • Story
Overview of CG animation • Art
Overview of CG animation • Recording
Overview of CG animation • Modeling
Overview of CG animation • Layout
Overview of CG animation • Animation
Overview of CG animation • Shading
Overview of CG animation • Lighting
Overview of CG animation • Rendering
Why CG animation? • One medium of many: • live action, classical animation, clay, puppets, … • 3D has aspects of live film • Camera, cinematography • CG has aspects of classical animation: • Stylization, fantasy, scripted motion, … • Accessible • Computer editing. • Don’t need to act, don’t need to draw. • Need to understand acting, need to understand images
Story, Animation most important • Modeling, rendering can’t save bad story • Modeling, rendering can’t save bad acting • Great story, acting are all you need: • Simpsons, South Park • “Europe and Italy” • “Yes and No” [play]
Class projects: 2D • 3D fully rendered is more work • 2D simple shapes easier to do during class TD time • CG techniques are (mostly) the same
Outline for today • Overview of the class • Overview of CG animation process • Keyframe animation
Keyframe animation: classical • Animator draws character at “extreme” poses • Fill in in-betweens • Textbook “Illusion of Life”
Keyframe animation: CG • Model parameters • Position (x,y,z), joint angles, deformations, … • Key frames = data points • In-between = interpolation • Many ways to interpolate: • linear • splines (polynomial curves)
Linear interpolation • Given points P0 and P1, define curve L(t): L(t) = (1-t) P0 + t P1 t in [0,1] • Weighted average of endpoints. • “Curve” is linear segment
Linear interpolation: N points • Given P0…PN, define segment: Li(s) = (1-s) Pi + s Pi+1 s in [0,1] • Then define piecewise-linear curve: L(t) = Li(s) for ti< t < ti+1 Where s = (t-ti)/(ti+1-ti) and (let’s say) ti = i/N
Spline curves • To make smooth curves from data points • Many types of splines, many properties: • Interpolating, approximating, … • Build an order-k polynomial from k+1 points
Spline curve segment • General form for a segment: C(t) = B0(t)P0 + …+ Bk(t)Pk • Weighted average of k control points • Basis functions Bi(t), order-k polynomials • Many choices, many properties • Most commonly: k=3 (cubic) • We’ll use the cubic Bézier curve
k i Bézier spline segment • Pierre Bézier, 1972 (obituary 1999) • Basis functions are Bernstein Polynomials: Bik(t) = ti(1-t)k-i • For k=3: B0 = (1-t)3 B1 = 3t(1-t)2 B2 = 3t2(1-t) B3 = t3
Bézier spline segment • Properties: • Interpolates endpoints • Intermediate points control shape • Easy to use • Applets: • Someone at UCLA • Someone from blueyonder
Bézier curve: N points • Given P0…PN, define K=(N-1)/3 segments: Ci(s) = B0(s)P3i+B1(s)P3i+1+B2(s)P3i+2+B3(s)P3i+3 • Then define piecewise-cubic curve: C(t) = Ci(s) for ti< t < ti+1 Where s = (t-ti)/(ti+1-ti) and (let’s say) ti = i/K
Bézier curve: N points • Segments connect at endpoints • C0 continuous • Can be C1 continuous, with constraints • Applet: • Someone at princeton
Simple Animation • Use Bézier curve C(t) for character position. • Map frame (24 frames per second) to t: Position(f) = C((f-fstart)/(fend-fstart)) • See “TD1” demo • Notice trouble with speed
Speed along the spline • Uniform parameterization: speed varies • Arc-length parameterization: constant speed • User-specified speed
Arc-length parameterization • Really, reparameterization • Define S(t), length along curve until t ds2 = dx2 +dy2 S(t) = 0∫t ((dx/dt)2+(dy/dt)2)½ dt S(t) = 0∫t || dC(t)/dt|| dt • Reparameterize: Carc(s) = C(t(s)) where t(s) = S-1(s) • Need inverse function
Arc-length reparameterization • Exact computation is too expensive & hard • Simple approximation: chord length • Sample M times (sufficiently large, e.g. M=10N) Si = Si-1 + || C(i/M) – C((i-1)/M) || • To invert: • Given s in [0,SM] find i such that Si < s < Si+1 t = (i + (s-Si)/(Si+1-Si)) / M • For normalized arc length, use s SM, s in [0,1] • See “TD1” demo
User-specified speed • Assign times to knots • Ease-in, ease-out • Interesting questions re editing, UI… • Not going to get into this now…
Animating Arbitrary Parameters • Previous discussion created a 2D (3D) curve as a function of t, used for position • We want to create 1D function of frame, used for any parameter (“avar”) • Want to interpolate key values • Want to control shape between values • Many possible splines… • We will use 2D Bezier curves!
2D Bézier curve for avar values • Curve is C(t) => (Cx(t), Cy(t)) • Use x = frame, y = value • UI: “knots” with “handles” • Cx(t) needs to be single-valued • UI: knots always in increasing X order
2D curve for avar values • Curve is C(t) => (Cx(t), Cy(t)) • To get value at frame f, reparameterize: Avar(f) = Cy(t(f)) where t(f) = Cx-1(f) • To find inverse: • Given f find t: Cx(t)=f • Standard form: Cx(t)-f=0: root finding • We’ll use binary searchto find t
Root finding by binary search • Given function F(t) for t in [0,1], • want t such that F(t)=0 • assume t=0, t=1bracket a root • Algorithm: • start with tl=0, tr = 1 • compute tm= (tl + tr)/2 and F(tm) • if tl ,tmbracket a root trtm else tltm • repeat until tl≈ tr