Chap 7 Physically Based Animation - PowerPoint PPT Presentation

chap 7 physically based animation n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Chap 7 Physically Based Animation PowerPoint Presentation
Download Presentation
Chap 7 Physically Based Animation

play fullscreen
1 / 158
Chap 7 Physically Based Animation
196 Views
Download Presentation
ormanda
Download Presentation

Chap 7 Physically Based Animation

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Chap 7Physically Based Animation CS Dept., NCTU, J. H. Chuang

  2. Physically Based Animation • Forces are typically used to maintain relationships among geometric elements • Accuracy vs. physical realism • Animators is not necessarily concerned with being accurate but rather with believabibity • Some forces may not relate to physics at all • They may model constraints that an animator may wish to enforce on the motion CS Dept., NCTU, J. H. Chuang

  3. Physically Based Animation • When modeling motion using physics principles, we need to decide the level at which to model the process • Procedure • Computationally less expensive, easier to program • Lacks flexibility • Purely physics • Computationally expensive • More flexible CS Dept., NCTU, J. H. Chuang

  4. Physically Based Animation • When physical models are used, animator • is relieved of lower level specification of motions • Needs to be concerned with specifying high-level relationships or qualities of the motion CS Dept., NCTU, J. H. Chuang

  5. Outline • Basic physics • Spring meshes • Particle systems • Rigid body simulation • Enforcing soft and hard constraints A Good reference: • Read Witkin and Baraff’s SIGGRAPH’01 course notes: Physics-based modeling at http://www.pixar.com/companyinfo/research/pbm2001/index.html CS Dept., NCTU, J. H. Chuang

  6. Basic physics • Newton’s laws of motions CS Dept., NCTU, J. H. Chuang

  7. Basic physics CS Dept., NCTU, J. H. Chuang

  8. Basic physics CS Dept., NCTU, J. H. Chuang

  9. Spring meshes • Flexible objects • Flexibility is modeled by a spring-mass-damper simulation simulating the reaction of the body to external forces. • Each vertex: a point mass • Assigned by animators • Evenly distributed among object’s vertices • Each edge: a spring • Rest length is original edge length • Spring constants • Arbitrary, assigned uniformly throughout the object CS Dept., NCTU, J. H. Chuang

  10. Spring meshes • Spring-mass-damper simulation • As external forces are applied to specific vertices • Vertices will be displaced relative to other vertices • The displacement induces spring forces, which will impart forces to the adjacent vertices and reactive forces back to initial vertices. • Force propagation one time step at a time CS Dept., NCTU, J. H. Chuang

  11. Spring meshesA simple example Instant force F applied to V2. Length of springs E12 and E23 changes. Spring forces impart restoring forces to V1 and V2, and V2 and V3 Since external force is wrongly assumed constant throughout the time step, a spring simulation may numerically explode (the motions get larger and larger). A smaller time step, or smaller spring constant, or larger masses can be used; but slow down the simulation. A common method: add dampers. CS Dept., NCTU, J. H. Chuang

  12. Spring meshesDampers • A damper introduces an additional force in the spring that works against the velocity of the spring length, thus helping to limit the speed at which a spring changes length. • Help to control the change in length and keep it within some range that does not allow the simulation to explode. CS Dept., NCTU, J. H. Chuang

  13. Spring meshes • Modeling with only object edges with spring dampers can result in a model that has more than one stable configuration. • Additional spring dampers can help to stabilize the shape. If a cube’s edges are modeled with spring dampers, during applications of extreme external force is applied, the cube can turn Inside out. CS Dept., NCTU, J. H. Chuang

  14. Spring meshesAngular spring dampers • angular spring resists deviation to the rest angle between faces and imparts a torque along the edge that attempts to restore the rest angle. CS Dept., NCTU, J. H. Chuang

  15. Spring meshesVirtual springs • Virtual springs introduce forces into the system that do not directly model physical elements. For example, • Example on the last page • Virtual springs with zero rest lengths can be used to constrained one object to lie on the other • Virtual springs with non-zero rest lengths can be used to maintain separation between moving objects. CS Dept., NCTU, J. H. Chuang

  16. Particle systems • Particles have been used to animate many behaviors, such as gases, water, fire, rubber, clothes, flocking, hair. CS Dept., NCTU, J. H. Chuang

  17. Particle systemsAssumptions • Particles do not collide with other particles • Particles do not cast shadow on each other, except in an aggregate sense • Particles only cast shadow on the rest of environment • Particles do not reflect light • Particles often have a finite life span CS Dept., NCTU, J. H. Chuang

  18. Particle systemsSteps in a frame • Generate any new particles • Each new particle is assigned attributes • Any particles that have exceeded their life span are terminated • The remaining particles are animated and their shading parameters changes according to the controlling process • The particles are rendered CS Dept., NCTU, J. H. Chuang

  19. Particle generation • For each frame, particles are generated according to a controlled stochastic process • User-specified distribution centered at the desired average number of particle per frame • Can be function of time CS Dept., NCTU, J. H. Chuang

  20. Particle attributes • Particle properties: • mass • position • velocity • force accumulator • age, lifespan • rendering properties (shape parameters, color, transparency) • Each of the attributes is initialized when the particle is created. CS Dept., NCTU, J. H. Chuang

  21. Particle life span At each new frame, each particle’s lifetime is decremented by one When the attribute reaches zero, the particle is removed from the system. CS Dept., NCTU, J. H. Chuang

  22. Particle animation • Each particle is animated throughout its life. • Includes position, velocity, and rendering attributes • Position and velocity • Users consider forces and compute the resultant particle acceleration, update its velocity, and update the position. • Color and transparency can be a function of time, its own life span remaining, its height, and so on. Shape can be a function of its velocity CS Dept., NCTU, J. H. Chuang

  23. Particle animation Forces on particles • Forces can be unary, particle pair, or environmental. • Unary forces • Gravity, viscous drag • Particle pair forces • Can be represented by springs and dampers, if desired. • Environmental forces • Arise from a particle’s relationship to the environment CS Dept., NCTU, J. H. Chuang

  24. phase space Forces on particles • Particles respond to forces • We represent this using differential equations 2nd order ODE 1st order ODEs CS Dept., NCTU, J. H. Chuang

  25. Unary Forces • Forces that only depend on one particle fdrag v Viscous Drag Gravity Wind Fields f = mg f = -kdv f = kvwind CS Dept., NCTU, J. H. Chuang

  26. n-ary Forces • Forces that depend on n particles • Example: binary forces between two particles - spring and damper Springs CS Dept., NCTU, J. H. Chuang

  27. n-ary Forces: Spring Force • If particle is located farther than the rest position, the spring force needs to pull it back • If the particle is located nearer than the rest position, the spring force needs to push it away • Combine two cases: CS Dept., NCTU, J. H. Chuang

  28. n-ary Forces: Damping Forces • According to the law of energy conservation, a particle system consists of only masses and springs keep bouncing from each other after external forces disappear • Damping/viscous drag force resist motion, making a particle system gradually come to rest in the absence of external forces CS Dept., NCTU, J. H. Chuang

  29. n-ary Forces: Damping Forces (cont.) • It is highly recommended that at least a small amount of damping is applied to each particle • Excessive damping, however, makes a particle appear that floating in molasses (energy dissipates out too quickly, not responsive) CS Dept., NCTU, J. H. Chuang

  30. n-ary Forces: Damper Force • If two particles are departing, the damper force needs to pull them back • If two particles are approaching, the damper force needs to push them away • Combine two cases: CS Dept., NCTU, J. H. Chuang

  31. Spatial data structures can optimize computations Spatial Forces • Forces that depend on nearby particles within a local region Gravity, Lennard-Jones and electric potentials CS Dept., NCTU, J. H. Chuang

  32. Particle rendering • Several methods • Model each particle as a point light source • Each particle is rendered to a small graphical primitive (blob). • Particles that map to the same pixels in the image are additive - the color of a pixel is simply the sum of the color values of all the particles that map to it • Model each particle as a textured billboard • Polygon facing the viewer, texture • Rendered as Metaballs in off-line rendering; isosurfaces computed from particle-metaballs make quite convincing liquids. CS Dept., NCTU, J. H. Chuang

  33. Particle renderingParticle CS Dept., NCTU, J. H. Chuang

  34. Particle renderingParticle CS Dept., NCTU, J. H. Chuang

  35. Particle rendering Billboard texture CS Dept., NCTU, J. H. Chuang

  36. Particle rendering Billboard texture CS Dept., NCTU, J. H. Chuang

  37. Particle rendering Billboard texture From Mark Harris’s work http://www.markmark.net/clouds/ CS Dept., NCTU, J. H. Chuang

  38. Particle renderingBillboard texture • An impostor replaces a cloud with a billboard textured with an image of the cloud from a certain viewpoint. • Image is updated only when translation of the viewpoint introduces enough error in the image • Impostors can be reused for many frames. • By using impostors, we are able to render cloudy scenes of hundreds of clouds and hundreds of thousands of particles at very high frame rates. CS Dept., NCTU, J. H. Chuang

  39. Particle renderingBillboard texture Figure 6: Impostor generation and translation error metric. Impostor generation and translation error metric CS Dept., NCTU, J. H. Chuang

  40. Particle rendering Video Cloud rendering by Niniane Wang http://www.ofb.net/~niniane/clouds/ CS Dept., NCTU, J. H. Chuang

  41. Particle renderingMetaballs and isosurface From “Screen Space Fluid Rendering with Curvature Flow “ http://industrialarithmetic.blogspot.com/2009/01/ our-paper-screen-space-fluid-rendering.html CS Dept., NCTU, J. H. Chuang

  42. Collision Detection • Determine when a particle has collided an object • Particle has collided if and only if Object’s surface CS Dept., NCTU, J. H. Chuang

  43. coefficient of restitution Collision Response • What should we do when a particle has collided? • The correct thing to do is rollback the simulation to the exact point of contact • Easier to just modify positions and velocities After the collision: CS Dept., NCTU, J. H. Chuang

  44. Contact Forces • When the particle is on the collision surface a contact force resists penetration • Contact forces do not resist leaving the surface • Simple friction can be modeled CS Dept., NCTU, J. H. Chuang

  45. Structure of Particle Systems • Separate the data structures and integration state Particle System Solver send data as 6n vectors particles time state derivatives state/derivatives Particle x v f m x v f m x v f m x v f m CS Dept., NCTU, J. H. Chuang

  46. Structure of Particle SystemsImplementation • Solver Interface Solver System GetDim 6 Get/Set State x v f m x v v f/m Deriv Eval CS Dept., NCTU, J. H. Chuang

  47. Structure of Particle SystemsImplementation • Solver Interface Solver System GetDim 6n particles Get/Set State x1 v1 x2 v2 xn vn n time v1 f1/m1 v2 f2/m2 vn fn/mn Deriv Eval CS Dept., NCTU, J. H. Chuang

  48. Physics Engines for Dynamics Simulation • Open Dynamics Engine (ODE) • Free software http://www.ode.org/ • high performance library for simulating rigid body dynamics. • It is fully featured, stable, mature and platform independent with an easy to use C/C++ API. • It has advanced joint types and integrated collision detection with friction. • ODE is useful for simulating vehicles, objects in virtual reality environments and virtual creatures. CS Dept., NCTU, J. H. Chuang

  49. Physics Engines for Dynamics Simulation • Havok • Commercial software • “Reactor” in 3ds MAX • State-of-the-art game physics solution, for use with in-house game animation systems • Havok Destruction™ is the cross-platform tool for simulation of rigid body destruction. CS Dept., NCTU, J. H. Chuang

  50. Physics Engines for Dynamics Simulation • NVIDIA PhysX • A powerful physics engine which enables real-time physics in leading edge PC and console games. • Is widely adopted by over 150 games, is used by more than 10,000 registered users. • Designed specifically for hardware acceleration by powerful processors with hundreds of cores. Combined with the tremendous parallel processing capability of the GPU, PhysX will provide an exponential increase in physics processing power CS Dept., NCTU, J. H. Chuang