Syllabus I. Image prcessing II. Mdeling Cmputer Animatin III. Rendering Rendering IV. Animatin (Michael Bstck, CS426, Fall99) Image Prcessing Adam Finkelstein & Tim Weyrich Princetn University (Rusty Cleman, CS426, Fall99) COS 426, Spring 2008 Mdeling (Dennis Zrin, CalTech) Animatin (Angel, Plate 1) 1 Cmputer Animatin 2 Simulatin What is animatin? Dynamics Make bjects change ver time accrding t scripted actins Cnsiders underlying frces Cmpute mtin frm initial cnditins and physics Kinematics What is simulatin? Cnsiders nly mtin Determined by psitins, velcities, acceleratins Pixar Predict hw bjects change ver time accrding t physical laws University f Illinis 3 Dynamics 4 Passive Dynamics N muscles r mtrs Hdgins Smke Water Clth Fire Firewrks Dice 5 6
Passive Dynamics Particle Systems Physical laws A particle is a pint mass Newtn!s laws Hk!s law Etc. Physical phenmena Gravity Mmentum Frictin Cllisins Elasticity Fracture Mass Psitin Velcity Frces Clr Lifetime v p = (x,y,z) Use lts f particles t mdel cmplex phenmena Keep array f particles Newtn!s laws 7 Particle Systems Creating Particles Fr each frame: 8 Where t create particles?! Predefined surce Surface f shape Where particle density is lw etc. Create new particles and assign attributes Delete any expired particles Update particles based n attributes and physics Render particles 9 Creating Particles Deleting Particles Where t create particles? Predefined surce! Surface f shape Where particle density is lw etc. 10 When t delete particles? Reeves Predefined sink Surface f shape Where density is high Life span Randm 11 12
Rendering Particles! Pints Plygns Shapes Trails etc. Rendering Particles Pints! Plygns Shapes Trails etc. 13 14 Rendering Particles Pints Plygns! Shapes Trails etc. Rendering Particles Pints Plygns Shapes! Trails etc. 15 16 Particle Systems Fr each frame: Create new particles and assign attributes Delete any expired particles! Update particles based n attributes and physics Render particles Equatins f Mtin Newtn!s Law fr a pint mass f = ma Cmputing particle mtin requires slving secnd-rder differential equatin Add variable v t frm cupled first-rder differential equatins 17 18
Slving the Equatins f Mtin Initial value prblem Knw p(0), v(0), a(0) Can cmpute frce at any time and psitin Cmpute p(t) by frward integratin Slving the Equatins f Mtin Euler integratin p(t+!t)=p(t) +!t v(t) v(t+!t)=v(t) +!t f(x,t)/m f p(0) p(t) Hdgins Hdgins 19 20 Slving the Equatins f Mtin Euler integratin p(t+!t)=p(t) +!t v(t) v(t+!t)=v(t) +!t f(p(t),t)/m Prblem: Accuracy decreases as!t gets bigger Slving the Equatins f Mtin Midpint methd (2 nd rder Runge-Kutta) Cmpute an Euler step Evalute f at the midpint Take an Euler step using midpint frce» v(t+!t)=v(t) +!t f( p(t) + 0.5*!t v(t),t) Hdgins Hdgins 21 22 Slving the Equatins f Mtin Adapting step size Cmpute p a by taking ne step f size h Cmpute p b by taking 2 steps f size h/2 Errr = p a - p b Multiply step size by factr (cnstant/errr) p b errr p a Particle System Frces Frce fields Gravity, wind, pressure Viscsity/damping Liquids, drag Cllisins Envirnment Other particles Other particles Springs between neighbring particles (mesh) Useful fr clth 23 24
Particle System Frces Example: Gravity 25 26 Example: Fire Example: Buncing Off Wall Requires Cllisin detectin Cllisin respnse (dynamic frces) 27 28 Example: Buncing Off Wall Example: Buncing Off Wall 29 30
Example: Buncing Off Wall Example: Buncing Off Wall 31 32 Example: Buncing Off Particles Example: Mre Buncing Bender 33 34 Example: Clth Example: Clth Spring-mass mesh Hke!s law f = frce k s = spring cnstant d = p - q s = resting length Breen Hdgins 35 36
Example: Clth Spring-mass mesh Example: Clth Hke!s law Damping term f = frce k s = spring cnstant d = p - q s = resting length Hdgins Hdgins 37 38 Example: Clth Example: Flcks & Herds Bender 39 40 Summary Particle systems Lts f particles Simple physics Interesting behavirs Waterfalls Smke Clth Flcks Slving mtin equatins Simplest methd is Euler integratin Better t use adaptive step sizes 41