Procedural Methods (with a focus on particle systems) Angel, Chapter 11 slides from AW, open courseware, etc. CSCI 6360/4360.

Slides:



Advertisements
Similar presentations
Real-Time Game Physics
Advertisements

3D Graphics Rendering and Terrain Modeling
1. What is Lighting? 2 Example 1. Find the cubic polynomial or that passes through the four points and satisfies 1.As a photon Metal Insulator.
Based on slides created by Edward Angel
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Shading I.
University of New Mexico
1Notes. 2Heightfields  Especially good for terrain - just need a 2d array of heights (maybe stored as an image)  Displacement map from a plane  Split.
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”
1Notes  Text:  Motion Blur A.3  Particle systems 4.5 (and 4.4.1, 6.6.2…)  Implicit Surfaces  Classic particle system papers  W. Reeves, “Particle.
MAT 594CM S10Fundamentals of Spatial ComputingAngus Forbes Week 2 : Dynamics & Numerical Methods Goal : To write a simple physics simulation Topics: Intro.
Particle Systems 1 Adapted from: E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012.
Particle Systems and Fuzzy Shapes Presented by Dan Cogswell.
Particle Systems GPU Graphics. Sample Particle System Fire and SmokeWater.
1 7M836 Animation & Rendering Animation Jakob Beetz Joran Jessurun
1cs426-winter-2008 Notes  If you’re interested, read Bridson, Hourihan, Nordenstam, “Curl noise for procedural fluid flow”, SIGGRAPH ‘07.
Objectives Learn to shade objects so their images appear three- dimensional Learn to shade objects so their images appear three- dimensional Introduce.
Particle Systems Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
1cs426-winter-2008 Notes. 2 Velocity fields  Velocity field could be a combination of pre-designed velocity elements E.g. explosions, vortices, …  Or.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
1cs426-winter-2008 Notes  Assignment 1 is out, due immediately after reading week (Feb 25)  Please read: William T. Reeves, "Particle systems: a technique.
CS 480/680 Computer Graphics Shading I Dr. Frederick C Harris, Jr.
CS 4730 Physical Simulation CS 4730 – Computer Game Design.
CS 445 / 645: Introductory Computer Graphics
Computer Animation Rick Parent Computer Animation Algorithms and Techniques Physically Based Animation.
Physically Based Animation and Modeling
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Modelling and Simulation Dynamics. Dynamics Dynamics is a branch of physics that describes how objects move. Dynamic animation uses rules of physics to.
Technology and Historical Overview. Introduction to 3d Computer Graphics  3D computer graphics is the science, study, and method of projecting a mathematical.
Game Physics – Part I Dan Fleck Coming up: Rigid Body Dynamics.
Animation of Fluids.
CS559: Computer Graphics Lecture 38: Animation Li Zhang Spring 2008 Slides from Brian Curless at U of Washington.
Physically Based Modeling Let physics take over!.
Particle Systems – Technique for Modeling a Class of Fuzzy Objects Craig Schroeder Computer Graphics I April 22, 2004.
Forces and Motion Chapter 2 – Gravity, Motion, and Light.
CSC505 Particle Systems. CSC505 Object Representations So far we have represented (rendered) objects with –Lines –Polygons (triangles) –Curves These techniques.
Introduction to Procedural Methods, Particles Glenn G. Chappell U. of Alaska Fairbanks CS 481/681 Lecture Notes Monday, March.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
1 Perception and VR MONT 104S, Fall 2008 Lecture 21 More Graphics for VR.
Forces and Motion Chapter 2 – Gravity, Motion, and Light.
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.
Introduction to Particle Simulations Daniel Playne.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
Particles Paul Taylor Polygons are not so hot! Good for representing objects like A Cup A Robot A Pyramid Not so hot for creating Hair Snowflakes.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Multimedia Programming 21: Particle Animation Departments of Digital Contents Sang Il Park.
Perpetual Visualization of Particle Motion and Fluid Flow Presented by Tsui Mei Chang.
Graphics Lecture 17: Slide 1 Interactive Computer Graphics Lecture 17: Fire.
Particles and their home in Geometry Shaders Paul Taylor 2010.
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.
Advanced Games Development Game Physics CO2301 Games Development 1 Week 19.
Particle Systems Reference: Reeves W.: "Particle Systems -- A Technique for Modelling a Class of Fuzzy Objets", Computer Graphics, 17(3), pp ,
OpenGL Shading. 2 Objectives Learn to shade objects so their images appear three-dimensional Introduce the types of light-material interactions Build.
Advanced Computer Graphics Rigid Body Simulation
Particle Systems Ed Angel Professor Emeritus of Computer Science
CHAPTER 4: Systems of Particles
© University of Wisconsin, CS559 Fall 2004
Particle Systems.
ATCM 6317Procedural Animation
Procedural Animation Lecture 8: Particle systems
Physically Based Animation and Modeling
Motion in Real and Virtual Worlds
Particle Systems Ed Angel
Advanced Games Development Game Physics
Computer Graphics Lecture 15.
Particle Systems - A Technique for Modeling a Class of Fuzzy Objects
Particle Systems.
GPAT – Chapter 7 Physics.
Presentation transcript:

Procedural Methods (with a focus on particle systems) Angel, Chapter 11 slides from AW, open courseware, etc. CSCI 6360/4360

Introduction So far, “polygon based models” only –Which have achieved extraordinary success –… with implementation and use highly hardware supported, thus, furthering success –… but, there are other ways … E.g, see global illumination Some things just are not handled well Clouds, terrain, plants, crowd scenes, smoke, fire –Physical constraints and complex behavior not part of polygonal modeling Procedural methods –Generate geometric objects in different way –1. Describe objects in an algorithmic manner –2. Generate polygons only when needed as part of rendering process

Procedural Methods 3 Approaches Particles that obey Newton’s laws –Systems of thousands of particles capable of complex behaviors –Solving sets of differential equations Language based models –Formal language for producing objects –E.g., productions rules Fractal geometry –Based on self-similarity of seen in natural phenomena –Means to generate models to any level of detail Procedural noise –Introduce “controlled randomness” in models Turbulent behavior, realistic motion in animation, fuzzy objects

Physically-based Models Recall, “biggest picture” of computer graphics –Creating a world unconstrained by, well, anything –Is a good thing, e.g., scientific visualization of mathematic functions, subatomic particles and fields, visual representation of designs perhaps not realizable (yet) –Have seen series of techniques, e.g., Phong shading, that “look right” And even had a glimpse at what about viewer makes things look right (actually not look right), e.g., Mach banding Physically-based modeling –Can now feasibly investigate cg systems that fully model objects obeying all physical laws … still a research topic Hybrid approach –Combination of basic physics and mathematical constraints to control dynamic behavior of objects –Will look at particle systems as an example Dynamic behavior of (point) masses determined by solution of sets of coupled differential equations – will use an easily implemented solution

Kinematics and Dynamics Kinematics –Considers only motion –Determined by positions, velocities, accelerations Dynamics –Considers underlying forces –Compute motion from initial conditions and physics Dyamics - Active vs. Passive

Particle Systems Used to model: –Natural phenomena Clouds Terrain Plants –Group behavior Animal groups, crowds –Real physical processes Individual elements – –forces, direction attributes

Particle System History 1962: Pixel clouds in “Spacewar!” –2nd (or so) digital video game 1978: Explosion physics simulation in “Asteroids” 1983: “Star Trek II: Wrath of Kahn” –William T. Reeves –1st cg paper about particle systems –More later Now: Everywhere –Programmable and in firmware –Tools for creating, e.g., Maya

x

x

Particle System History 1983, Reeves, Wrath of Khan Some 400 particle systems –“Chaotic effects” –To 750k particles –Genesis planet Each Particle Had: Position Velocity Color Lifetime Age Shape Size Transparency Reeves1983: Reeves, William T.; Particle Systems – Technique for Modeling a Class of Fuzzy Objects. In SIGGRAPH Proceedings 1983,

Example: Wrath of Khan Distribution of particles on planet surface x Model spread

Example: Wrath of Khan Ejection of particles from planet surface Will see same approach for collisions

Angel Text Particle System Demo Yes, simple, but demonstrates utility of approach Code provided is more elaborate than that in text

Particle Systems A particle is a point mass –Mass –Position –Velocity –Acceleration –Color –Lifetime Use lots of particles to model complex phenomena –Keep array of particles For each frame: –Create new particles and assign attributes –Delete any expired particles –Update particles based on attributes & physics –Render particles

Newtonian Particles Angel Will model a set of particles subject to Newton’s laws –Though could use any “laws”, even your own Particles will obey Newton’s second law: –The mass of the particle (m) times the particle’s acceleration (a) is equal to the sum of the forces (f) acting on the particle –ma = f –Note that both acceleration, a, and force, f, are vectors (usually x, y, z) –With mass concentrated at a single point (an ideal point mass particle), state is determined completely by it position and velocity –Thus, in a 3d space ideal particle has 6 degrees of freedom, and a system of n particles has 6n state variables, position and velocity of all particles

Newtonian Particle Angel Particle system is a set of particles –Each particle is an ideal point mass Six degrees of freedom –Position –Velocity Each particle obeys Newton’s law – f = ma Particle equations – p i = (x i, y i z i ) – v i = dp i /dt = p i ‘ = (dx i /dt, dy i /dt, z i /dt) – m v i ‘ = f i Hard part is defining force vector

Newtonian Particles Details State of the i th particle is given by –Position matrix:-- Velocity matrix: Acceleration is the derivative of velocity and velocity is the derivative of position, so can write Newton’s second law for a particle as the 6n coupled first order differential equations –.

Simply Put, … Particle Dynamics Again, for each frame: –Create new particles and assign attributes –Delete any expired particles –Update particles based on attributes & physics –Render particles Particle's position in each succeeding frame can be computed by knowing its velocity –speed and direction of movement This can be modified by an acceleration force for more complex movement, e.g., gravity simulation

Solution of Particle Systems Angel float time, delta state[6n], force[3n]; state = initial_state(); for(time = t0; time<final_time, time+=delta) { force = force_function(state, time); state = ode(force, state, time, delta); render(state, time) } Update every particle for each time step –a(t+  t) = g –v(t+  t) = v(t) + a(t)*  t –p(t+  t) = p(t) + v(t)*  t + a(t)2*Dt/2

Solution of ODEs Angel details Particle system has 6n ordinary differential equations Write set as du/dt = g(u,t) Solve by approximations using Taylor’s Theorem

Solution of ODEs, 2 Angel details Euler’s Method u(t + h) ≈ u(t) + h du/dt = u(t) + hg(u, t) Per step error is O(h 2 ) Require one force evaluation per time step Problem is numerical instability - depends on step size Improved Euler u(t + h) ≈ u(t) + h/2(g(u, t) + g(u, t+h)) Per step error is O(h 3 ) Also allows for larger step sizes But requires two function evaluations per step Also known as Runge-Kutta method of order 2

Force Vector Particle System Forces A number of means to specify forces have been developed Most simply, independent particles – no interaction with other particles –Gravity, wind forces –O(n) calculation Coupled Particles O(n) –Meshes Useful for cloth –Spring-Mass Systems Coupled Particles O(n 2 ) –Attractive and repulsive forces

Simple Forces E.g., Gravity Particle field forces –Usually can group particles into equivalent point masses –E.g.,Consider simple gravity –Not compute forces due to sun, moon, and other large bodies –Rather, we use the gravitational field –Same for wind forces, drag, etc. Consider force on particle i f i = f i (p i, v i ) Gravity f i = g –Really easy g i = (0, -g, 0) p i (t 0 ), v i (t 0 )

More Complex Force Local Force – Flow Field Stokes Law of drag force on a sphere F d = 6Πηr(v-v fl ) η = viscosity r = radius of sphere C = 6Πηr (constant) v = particle velocity v fl = flow velocity Sample Flow Field

Meshes Connect each particle to its closest neighbors –O(n) force calculation Use spring-mass system

Spring Forces Used modeling forces, e.g., meshes –Particle connected to its neighbor(s) by a spring –Interior point in mesh has four forces applied to it –Widely used in graph layout Hooke’s law: force proportional to distance (d = ||p – q||) between points Let s be distance when no force f = -k s (|d| - s) d/|d| k s is the spring constant d/|d| is a unit vector pointed from p to q

Spring Damping A pure spring-mass will oscillate forever Must add a damping term f = -(k s (|d| - s) + k d d·d/|d|)d/|d| Must project velocity ·

Attraction and Repulsion Inverse square law f = -k r d/|d| 3 General case requires O(n 2 ) calculation In most problems, the drop off is such that not many particles contribute to the forces on any given particle Sorting problem: is it O(n log n)?

Boxes O(n 2 ) algs when consider interactions among all particles Spatial subdivision technique Divide space into boxes Particle can only interact with particles in its box or the neighboring boxes Must update which box a particle belongs to after each time step

Constraints and Collisions Constraints –Easy in cg to ignore physical reality Surfaces are virtual –Must detect collisions if want exact solution O(n 2 ) limiting, O(6) for box sides! –Can approximate with repulsive forces Collisions –Once detect a collision, we can calculate new path –Use coefficient of restitution –Reflect vertical component –May have to use partial time step Contact forces

Angel Demo Collision Detection “good enough for cg” Just test to see if particle has hit sides of cube –At x, y, z = +1 and -1 float coef = 1.0; // global, 1.0=perfectly elastic collisions - can be set interactively for other “bounciness” void collision(int n) // tests for collisions against cube and reflect particles if necessary { int i; for (i=0; i<3; i++) { if(particles[n].position[i]>=1.0) { particles[n].velocity[i] = -coef*particles[n].velocity[i]; particles[n].position[i] = 1.0-coef*(particles[n].position[i]-1.0); } if(particles[n].position[i]<=-1.0) { particles[n].velocity[i] = -coef*particles[n].velocity[i]; particles[n].position[i] = -1.0-coef*(particles[n].position[i]+1.0); }

Grass Entire trajectory of a particle over its lifespan is rendered to produce a static image Green and dark green colors assigned to the particles which are shaded on the basis of the scene’s light sources Each particle becomes a blade of grass white.sand by Alvy Ray Smith (he was also working at Lucasfilm)

Tools - Alias|Wavefront’s Maya Tutorial – orials/Particles/ParticlesWeb.movhttp://dma.canisius.edu/~moskalp/tut orials/Particles/ParticlesWeb.mov

End.