CS559: Computer Graphics Lecture 38: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington.

Slides:



Advertisements
Similar presentations
Stable Fluids A paper by Jos Stam.
Advertisements

Lecture 2. A Day of Principles The principle of virtual work d’Alembert’s principle Hamilton’s principle 1 (with an example that applies ‘em all at the.
Cht. IV The Equation of Motion Prof. Alison Bridger 10/2011.
Ch 3.8: Mechanical & Electrical Vibrations
Manipulator Dynamics Amirkabir University of Technology Computer Engineering & Information Technology Department.
1cs533d-term Notes  Required reading: Baraff & Witkin, “Large steps in cloth animation”, SIGGRAPH’98 Grinspun et al., “Discrete shells”, SCA’03.
1Notes  Textbook: matchmove 6.7.2, B.9. 2 Match Move  For combining CG effects with real footage, need to match synthetic camera to real camera: “matchmove”
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Linear dynamic systems
Intro to Fluid Simulation (I) Jeff Pool COMP
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
Particle Systems CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2004.
Linear Momentum Lecturer: Professor Stephen T. Thornton
Particle Systems Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
UNC Chapel Hill M. C. Lin Review Particle Dynamics (see transparencies in class)
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL Introduction to Modeling Fluid Dynamics 1.
Modeling, Simulating and Rendering Fluids Thanks to Ron Fediw et al, Jos Stam, Henrik Jensen, Ryan.
Computer graphics & visualization Rigid Body Simulation.
Motivation  Movie  Game  Engineering Introduction  Ideally  Looks good  Fast simulation  Looks good?  Look plausible  Doesn’t need to be exactly.
1 Game Physics. 2 Introduction to Game Physics Traditional game physics Traditional game physics Particle system Particle system Rigid body dynamics Rigid.
Physically Based Animation and Modeling
Electric Field You have learned that two charges will exert a force on each other even though they are not actually touching each other. This force is.
Procedural Methods (with a focus on particle systems) Angel, Chapter 11 slides from AW, open courseware, etc. CSCI 6360/4360.
Cloth Simulation By Chris Szendrovits o based on Jim Adams “Soft Body Mesh” demo.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
ME451 Kinematics and Dynamics of Machine Systems
Animation of Fluids.
1 Game Physics. 2 Introduction to Game Physics Traditional Game Physics Traditional Game Physics –Particle system –Rigid body dynamics –Flexible body.
Newton’s 1 st Law of Mechanics A particle will continue is a straight line at constant speed unless acted upon by a net push or pull (i.e. force). The.
Physically Based Modeling Let physics take over!.
Numerical Integration and Rigid Body Dynamics for Potential Field Planners David Johnson.
A particle-gridless hybrid methods for incompressible flows
Scientific Computing Numerical Solution Of Ordinary Differential Equations - Euler’s Method.
Lecture Fall 2001 Physically Based Animation Ordinary Differential Equations Particle Dynamics Rigid-Body Dynamics Collisions.
Forces and Motion PS C-5.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
Modeling motion subject to drag forces PHYS 361 Spring, 2011.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
University of Texas at Austin CS384G - Computer Graphics Fall 2010 Don Fussell Particle Systems.
University of Texas at Austin CS 378 – Game Technology Don Fussell CS 378: Computer Game Technology Physics for Games Spring 2012.
CS559: Computer Graphics Lecture 36: Animation Li Zhang Spring 2008 Many slides from James Kuffner’s graphics class at CMU.
Lecture 6: Time Response 1.Time response determination Review of differential equation approach Introduce transfer function approach 2.MATLAB commands.
Particle Systems. Applications Particle systems are broadly defined for: Explosion Cloth Fluid And more… It is integrated into many animation software,
Rigid Body Dynamics CSE169: Computer Animation
Lecture 3 Ordinary Differential equations Purpose of lecture: Solve 1 st order ODE by substitution and separation Solve 2 nd order homogeneous ODE Derive.
More on Particles Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Wednesday, March 24, 2004.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
Graphics for Games Particle Systems CO2301 Games Development 1 Week 23.
Advanced Computer Graphics Spring 2014 K. H. Ko School of Mechatronics Gwangju Institute of Science and Technology.
Chapter Five: Force  5.1 Forces  5.2 Friction  5.3 Forces and Equilibrium.
CSE 872 Dr. Charles B. Owen Advanced Computer Graphics1 Water Computational Fluid Dynamics Volumes Lagrangian vs. Eulerian modelling Navier-Stokes equations.
UW EXTENSION CERTIFICATE PROGRAM IN GAME DEVELOPMENT 2 ND QUARTER: ADVANCED GRAPHICS Advanced Math.
CS559: Computer Graphics Lecture 26: Animation Li Zhang Spring 2010 Slides from Brian Curless at U of Washington.
Advanced Computer Graphics Rigid Body Simulation
Manipulator Dynamics 1 Instructor: Jacob Rosen
Game Technology Animation.
Lecture 4: Modeling Mechanical Systems
Lecture 36: Animation Li Zhang Spring 2008
Review Particle Dynamics (see transparencies in class) UNC Chapel Hill
Mon. Mar. 31 Do Now If you graph speed vs. time, does speed or time go on the x-axis? Does the dependent or independent variable go on the x-axis?
Differential Equations
Review ODE Basics Particle Dynamics (see transparencies in class)
Review ODE Basics Particle Dynamics (see transparencies in class)
Physically Based Animation and Modeling
Introduction to Fluid Dynamics & Applications
Net Force.
Review ODE Basics Particle Dynamics (see transparencies in class)
GPAT – Chapter 7 Physics.
Presentation transcript:

CS559: Computer Graphics Lecture 38: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington

Today Computer Animation, Particle Systems Reading (Optional) Shirley, ch 16, overview of animation Witkin, Particle System Dynamics, SIGGRAPH ’01 course notes on Physically Based Modeling. Witkin and Baraff, Differential Equation Basics, SIGGRAPH ’01 course notes on Physically Based Modeling.

Animation Traditional Animation – without using a computer

Animation Computer Animation

Types of Animation Cartoon Animation

Types of Animation Cartoon Animation Key Frame Animation

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Nguyen, D., Fedkiw, R. and Jensen, H., "Physically Based Modeling and Animation of Fire", SIGGRAPH 2002

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Enright, D., Marschner, S. and Fedkiw, R., "Animation and Rendering of Complex Water Surfaces", SIGGRAPH 2002

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Data driven animation

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Data driven animation

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Data driven animation

Types of Animation Cartoon Animation Key Frame Animation Physics based animation Data driven animation

Particle Systems What are particle systems? – A particle system is a collection of point masses that obeys some physical laws (e.g, gravity, heat convection, spring behaviors, …). Particle systems can be used to simulate all sorts of physical phenomena:

Balls in Sports

Fireworks

Water

Fire and Explosion

Galaxy

Particle in a flow field We begin with a single particle with: – Position, – Velocity, Suppose the velocity is actually dictated by some driving function g: x g(x,t) x y

Vector fields At any moment in time, the function g defines a vector field over x: – Wind – River How does our particle move through the vector field?

Diff eqs and integral curves The equation is actually a first order differential equation. We can solve for x through time by starting at an initial point and stepping along the vector field: This is called an initial value problem and the solution is called an integral curve. – Why do we need initial value? Start Here

Euler’s method One simple approach is to choose a time step,  t, and take linear steps along the flow: Writing as a time iteration: This approach is called Euler’s method and looks like: Properties: – Simplest numerical method – Bigger steps, bigger errors. Error ~ O(  t 2 ). Need to take pretty small steps, so not very efficient. Better (more complicated) methods exist, e.g., “Runge-Kutta” and “implicit integration.”

Particle in a force field Now consider a particle in a force field f. In this case, the particle has: – Mass, m – Acceleration, The particle obeys Newton’s law: The force field f can in general depend on the position and velocity of the particle as well as time. Thus, with some rearrangement, we end up with:

This equation: is a second order differential equation. Our solution method, though, worked on first order differential equations. We can rewrite this as: where we have added a new variable v to get a pair of coupled first order equations. Second order equations

Phase space Concatenate x and v to make a 6-vector: position in phase space. Taking the time derivative: another 6-vector. A vanilla 1 st -order differential equation.

Differential equation solver Applying Euler’s method: Again, performs poorly for large  t. And making substitutions: Writing this as an iteration, we have: Starting with:

Particle structure position velocity force accumulator mass Position in phase space How do we represent a particle? typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle; typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle;

Single particle solver interface getDim derivEval getState setState typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle; typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle;

Particle systems particles ntime In general, we have a particle system consisting of n particles to be managed over time: typedef struct{ Particle *p; /* array of pointers to particles */ int n; /* number of particles */ float t; /* simulation clock */ } *ParticleSystem typedef struct{ Particle *p; /* array of pointers to particles */ int n; /* number of particles */ float t; /* simulation clock */ } *ParticleSystem typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle; typedef struct{ float m; /* mass */ float *x; /* position vector */ float *v; /* velocity vector */ float *f; /* force accumulator */ } *Particle;

Particle system solver interface particles ntime getDim For n particles, the solver interface now looks like: int ParticleDims(ParticleSystem p){ return(6 * p->n); }; int ParticleDims(ParticleSystem p){ return(6 * p->n); };

Particle system solver interface particles ntime get/setState getDim For n particles, the solver interface now looks like: int ParticleGetState(ParticleSystem p, float *dst){ for(int i=0; i n; i++){ *(dst++) = p->p[i]->x[0]; *(dst++) = p->p[i]->x[1]; *(dst++) = p->p[i]->x[2]; *(dst++) = p->p[i]->v[0]; *(dst++) = p->p[i]->v[1]; *(dst++) = p->p[i]->v[2]; } int ParticleGetState(ParticleSystem p, float *dst){ for(int i=0; i n; i++){ *(dst++) = p->p[i]->x[0]; *(dst++) = p->p[i]->x[1]; *(dst++) = p->p[i]->x[2]; *(dst++) = p->p[i]->v[0]; *(dst++) = p->p[i]->v[1]; *(dst++) = p->p[i]->v[2]; }

Particle system solver interface particles ntime derivEval get/setState getDim For n particles, the solver interface now looks like:

Particle system diff. eq. solver We can solve the evolution of a particle system again using the Euler method: void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ } void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ }

Forces Each particle can experience a force which sends it on its merry way. Where do these forces come from? Some examples: – Constant (gravity) – Position/time dependent (force fields) – Velocity-dependent (drag) – N-ary (springs) How do we compute the net force on a particle?

Force objects are black boxes that point to the particles they influence and add in their contributions. We can now visualize the particle system with force objects: Particle systems with forces particles ntime forces F2F2 F nf nf F1F1

Gravity and viscous drag The force due to gravity is simply: Often, we want to slow things down with viscous drag:

A spring is a simple examples of an “N-ary” force. Recall the equation for the force due to a spring: We can augment this with damping: Note: stiff spring systems can be very unstable under Euler integration. Simple solutions include heavy damping (may not look good), tiny time steps (slow), or better integration (Runge-Kutta is straightforward). Damped spring r = rest length

derivEval 1.Clear forces Loop over particles, zero force accumulators 2.Calculate forces Sum all forces into accumulators 3.Return derivatives Loop over particles, return v and f/m Apply forces to particles Clear force accumulators Return derivatives to solver F2F2 F3F3 F nf F1F1

Particle system solver interface int ParticleDerivative(ParticleSystem p, float *dst){ Clear_Forces(p); /* zero the force accumulators */ Compute_Forces(p); /* magic force function */ for(int i=0; i n; i++){ *(dst++) = p->p[i]->v[0]; /* xdot = v */ *(dst++) = p->p[i]->v[1]; *(dst++) = p->p[i]->v[2]; *(dst++) = p->p[i]->f[0]/m; /* vdot = f/m */ *(dst++) = p->p[i]->f[1]/m; *(dst++) = p->p[i]->f[2]/m; } int ParticleDerivative(ParticleSystem p, float *dst){ Clear_Forces(p); /* zero the force accumulators */ Compute_Forces(p); /* magic force function */ for(int i=0; i n; i++){ *(dst++) = p->p[i]->v[0]; /* xdot = v */ *(dst++) = p->p[i]->v[1]; *(dst++) = p->p[i]->v[2]; *(dst++) = p->p[i]->f[0]/m; /* vdot = f/m */ *(dst++) = p->p[i]->f[1]/m; *(dst++) = p->p[i]->f[2]/m; } }

Particle system diff. eq. solver We can solve the evolution of a particle system again using the Euler method: void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ } void EulerStep(ParticleSystem p, float DeltaT){ ParticleDeriv(p,temp1); /* get deriv */ ScaleVector(temp1,DeltaT) /* scale it */ ParticleGetState(p,temp2); /* get state */ AddVectors(temp1,temp2,temp2); /* add -> temp2 */ ParticleSetState(p,temp2); /* update state */ p->t += DeltaT; /* update time */ }