Today
Computer • How do we specify or generate motion? – Keyframing Animation – Procedural Animation & Particle – Physically-Based Animation Systems – Forward and Inverse Kinematics – Motion Capture Some slides courtesy of • What is a Particle System? Jovan Popovic & Ronen • Particle System Examples Barzel • Advanced “Particle Systems”
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Keyframing Procedural Animation
• Use spline curves to automate the inbetweening • Describes the motion algorithmically, – Good control as a function of small number of – Less tedious than drawing every frame parameters • Creating a good animation still requires considerable • Example: a clock with second, minute skill and talent and hour hands – express the clock motions in terms of a “seconds” variable – the clock is animated by varying the seconds parameter • Example: A bouncing ball ω θ -kt –Abs(sin( t+ 0))*e
ACM © 1987 “Principles of traditional animation applied to 3D computer animation” CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Physically-Based Animation Articulated Models
• Assign physical properties to objects • Articulated models: (masses, forces, inertial properties) – rigid parts • Simulate physics by solving equations – connected by joints • Realistic but difficult to control • They can be animated by specifying the joint angles as functions of time.
v0 qi qi ()t mg
t1 t2 t1 t2
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
1 Skeleton Hierarchy Forward Kinematics
• Each bone transformation • Given skeleton xyzhhhhhh,,,,,qf s described relative xyz,,,,,qf s parameters p, hhhhhh qf,, s to the parent in and the position ttt hips of the effecter in the hierarchy: qfttt,, s left-leg ... local coordinates V , r-thigh s qc what is the position y qc of the effector in the v r-calf s v x y world coordinates Vw? qfff, s z
vs qfff, x r-foot z Vw = T(xh,yh,zh)R(qh,fh,sh)ThR(qt,ft,st)TtR(Qc)TcR(qf,ff)Vs 1 DOF: knee 2 DOF: wrist 3 DOF: arm Vw = S(p)Vs
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Inverse Kinematics (IK) IK Challenge
• Given the position of the • Find a “natural” skeleton configuration for a
effecter in local coordinates Vs xyzhhhhhh,,,,,qf s given collection of pose constraints and the desired position Vw •A scalar objective function g(p) measures the qfttt,, s in world coordinates, what quality of a pose, g(p) is minimum for most are the skeleton parameters p? qc natural poses • Much harder requires solving – Example g(p): deviation from natural pose, V joint stiffness, power consumption, etc… the inverse of the non-linear qfff, s V function: w •A vector constraint function C(p) = 0 find p s.t. S(p)Vs = Vw collects all pose constraints: • Underdetermined problem with many solutions
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Motion Capture How Do They Animate Movies?
• Optical markers, • Keyframing mostly high-speed cameras, • Articulated figures, inverse kinematics triangulation • Skinning → 3D position – Complex deformable skin, muscle, skin motion • Hierarchical controls • Captures style, subtle nuances and realism – Smile control, eye blinking, etc. • You must observe someone do something – Keyframes for these higher-level controls • A huge time is spent building the 3D models, its skeleton and its controls • Physical simulation for secondary motion – Hair, cloths, water – Particle systems for “fuzzy” objects
Images from the Maya tutorial CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
2 Questions? Today
• How do we specify or generate motion? • What is a Particle System? – Each particle maintains its state (position, velocity, color, etc.) – Describe the external forces with a force field – Integrate the laws of mechanics (ODE Solvers) – Collisions (later… ) • Particle System Examples • Advanced “Particle Systems”
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Types of Dynamics What is a Particle System?
• Point • Collection of many small simple particles • Particle motion influenced by force fields • Rigid body • Particles created by generators
ACM© 1988 “Spacetime Constraints” • Particles often have lifetimes • Deformable body • Used for, e.g: (include clothes, fluids, smoke, etc.) – sand, dust, smoke, sparks, flame, water, …
CSCI-6962 AdvancedCarlson, Computer Mucha, Graphics Van Cutler Horn, & Turk 2002 CSCI-6962 Advanced Computer Graphics Cutler
Particle Motion
• mass m, position x, velocity v • equations of motion:
• Ordinary Differential Equation:
Demos by Mark B. Allan http://users.rcn.com/mba.dnai/software/flow/CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
3 Numerical solutions to ODEs Solving ODEs for animation • Analytic solutions can be found for some classes of differential equations, but most can’t be solved analytically (e.g., 3-body problem) • For animation, want a series of values:
• Given a function f(X,t) compute X(t) • Typically, initial value problems: – samples of the continuous function X(t) – Given values X(t0)=X0 – i.e., frames of an animation – Find values X(t) for t > t0 • Also, boundary value problems, constrained problems, etc…
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Questions? Path through a field
• f(X,t) is a vector field defined everywhere – E.g. a velocity field which may change over time
• X(t) is a path through the field
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Higher order ODEs E.g., for a 3D particle
• E.g., Mechanics has 2nd order ODE: • We have a 6 dimension ODE problem:
• Express as 1st order ODE by defining v(t):
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
4 and for a collection of 3D particles… Intuitive solution: take steps • Current state X • Examine f(X,t) at (or near) current state • Take a step to new value of X • Most solvers do some form of this
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Euler’s method Effect of step size
• Simplest and most intuitive. • Step size controls accuracy • Define step size h • Smaller steps more closely follow curve
•Given X0=X(t0), take step: • For animation, may need to take many small steps per frame
• Piecewise-linear approximation to the curve
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Euler’s method: inaccurate Euler’s method: unstable
• Moves along tangent; can leave curve, e.g.: • Exact solution is decaying exponential: • Exact solution is circle: • Limited step size:
• Euler’s spirals outward • no matter how small h is
• If k is big, h must be small
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
5 Analysis: Taylor series Can we do better than Euler’s method?
• Expand exact solution X(t) • Problem: f has varied along the step • Idea: look at f at the arrival of the step and • Euler’s method approximates: compensate for variation
• First-order method: Accuracy varies with h • To get 100x better accuracy need 100x more steps
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
2nd-order methods Comparison: Euler, Midpoint, Runge-Kutta
• Midpoint: a f1 –½Euler step fm – evaluate fm
– full step using fm • Trapezoid: b – Euler step (a)
– evaluate f1
– full step using f1 (b) – average (a) and (b) • Not exactly same result • Same order of accuracy
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Questions? What is a force?
• Forces can depend on location, time, velocity • There can be multiple force sources
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
6 Forces: Gravity on Earth Forces: Gravity for N-body problem
• depends only on particle mass: • Depends on all other particles • f(X,t) = constant • Opposite for pairs of particles
• for smoke, flame: make gravity point up! • Force in the direction of pipj with magnitude inversely proportional to square distance 2 •Fij= G mimj / r v0 Pi mi G
Pj
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Forces:Damping Forces: Spatial fields • force on particle i depends only on position of i –wind • force on particle i depends only on velocity of i – attractors • force opposes motion – repulsers – vortices • removes energy, so system can settle • can depend on time • small amount of damping can stabilize solver • note: these add energy, may need damping too • too much damping makes motion too glue-like
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Forces: Spatial interaction Questions?
• e.g., approximate fluid: Lennard-Jones force:
•O(N2) to test all pairs – In practice, only local
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
7 Today Particle Animation [Reeves et al. 1983]
Start Trek, The Wrath of Kahn • How do we specify or generate motion? • What is a Particle System? • Particle System Examples • Advanced “Particle Systems”
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
How they did it? Where do Particles come from?
• One big particle system at impact • Often created by generators (or “emitters”) – can be attached to objects in the model • Secondary systems for rings of fire. • Given rate of creation: particles/second
– record tlast of last particle created
– create n particles. update tlast if n > 0 • Create with (random) distribution of initial x and v – if creating n > 1 particles at once, spread out on path
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Particle Lifetimes
• Record time of “birth” for each particle • Specify lifetime • Use particle age to: – remove particles from system when too old – often, change color – often, change transparency (old particles fade) • Sometimes also remove particles that are offscreen
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
8 Rendering and Motion Blur “Particle Dreams” by Karl Sims
• Particles are usually not shaded (just emission) • 1988 • Often, rendered last with z-buffer disabled • “A Connection Machine CM-2 computer was • Draw a line for motion blur (x, x + vdt) used to perform physical simulations on • Sometimes use texture maps (fire, clouds) thousands of particles simultaneously, one processor for each particle.” • Karl Sims, "Particle Animation and Rendering Using Data Parallel Computation", SIGGRAPH 1990 • http://www.genarts.com/karl/
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Particle Modeling Questions?
• grass made from particles [Reeves et al. 1983]
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Today Advanced “Particle Systems”
• How do we specify or generate motion? • Each bird modeled as a complex particle (“boid”) • What is a Particle System? • A set of forces control its behavior based on • Particle System Examples location of other birds and control forces • Advanced “Particle Systems”
• Craig Reynolds http://www.red3d.com/cwr/boids
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
9 Advanced “Particle Systems” Fish School, Crowds • “Boid" is an abbreviation of "birdoid", as the rules apply equally to simulated flocking birds, and schooling fish.
• Craig Reynolds
“Finding Nemo” Pixar
CSCI-6962 Advanced Computer Graphics Cutler CSCI-6962 Advanced Computer Graphics Cutler
Questions?
CSCI-6962 Advanced Computer Graphics Cutler
10