Particle Systems Ed Angel Professor Emeritus of Computer Science

Slides:



Advertisements
Similar presentations
A TASTE OF CHAOS By Adam T., Andy S., and Shannon R.
Advertisements

Force Force is a push or pull on an object The object is called the System Force on a system in motion causes change in velocity = acceleration Force is.
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. 2 Triangle intersection  Many, many ways to do this  Most robust (and one of the fastest) is to do it based on determinants  For vectors a,b,c.
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 Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts Director, Arts Technology Center University.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Shading I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Procedural Methods (with a focus on particle systems) Angel, Chapter 11 slides from AW, open courseware, etc. CSCI 6360/4360.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Physically Based Modeling Let physics take over!.
Equation of Motion for a Particle Sect nd Law (time independent mass): F = (dp/dt) = [d(mv)/dt] = m(dv/dt) = ma = m(d 2 r/dt 2 ) = m r (1) A 2.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 12.
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
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Perpetual Visualization of Particle Motion and Fluid Flow Presented by Tsui Mei Chang.
1 Two of Newton’s Law of Motions 1) In the absence of any forces applied, an object at rest will stay at rest, and a body moving at a constant velocity.
Game Technology Animation V Generate motion of objects using numerical simulation methods Physically Based Animation.
MECHANICS Ms. Peace Introduction. Sequence 1.1 What is Mechanics? 1.1 What is Mechanics? 1.2 Fundamental Concepts and Principles 1.2 Fundamental Concepts.
What is the centripetal force acting on a 2000 kilogram airplane if it turns with a radius of 1000 meters while moving at 300 meters per second? a c =
Universal Gravitation Brought to you by: Ashley, Chelsey, and Jordan.
Newton’s Law of Universal Gravitation
PHY 151: Lecture Motion of an Object attached to a Spring 12.2 Particle in Simple Harmonic Motion 12.3 Energy of the Simple Harmonic Oscillator.
Fall 2011 PHYS 172: Modern Mechanics Lecture 4 – Physical Models, Fundamental Interactions Read 2.7–2.8,
Newton’s Law of Gravitation Definition of Newton’s Law of Gravitation: The gravitational force between two bodies is directly proportional to the product.
Advanced Computer Graphics Rigid Body Simulation
ECE 383 / ME 442 Fall 2015 Kris Hauser
Introduction.
Unit 2: Forces in Physics
Part 7 - Chapter 25.
Introduction to Computer Graphics with WebGL
Ordinary Differential Equations
Ch 7 Objective Warm-Up You will learn about circular acceleration and Force You will learn to use Newton’s Universal Gravitation formula You will learn.
Introduction to Computer Graphics with WebGL
Newton’s Law of Gravity
Introduction.
Mechanical Engineering at Virginia Tech
Particle Systems.
Reflection and Transmission
SE301: Numerical Methods Topic 8 Ordinary Differential Equations (ODEs) Lecture KFUPM (Term 101) Section 04 Read , 26-2, 27-1 CISE301_Topic8L4&5.
Introduction.
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Introduction to Computer Graphics with WebGL
Implementation II Ed Angel Professor Emeritus of Computer Science
Building Models Ed Angel Professor Emeritus of Computer Science
Introduction.
Introduction to Computer Graphics with WebGL
Part 7 - Chapter 25.
Introduction.
Isaac Gang University of Mary Hardin-Baylor
Motion in Real and Virtual Worlds
Introduction to Computer Graphics with WebGL
Universal Gravitation
Particle Systems Ed Angel
Introduction to Computer Graphics with WebGL
Texture Mapping Ed Angel Professor Emeritus of Computer Science
Universal Gravitation
Designing Parametric Cubic Curves
Particle Systems.
Implementation II Ed Angel Professor Emeritus of Computer Science
Introduction.
GPAT – Chapter 7 Physics.
Shading II Ed Angel Professor Emeritus of Computer Science
Presentation transcript:

Particle Systems Ed Angel Professor Emeritus of Computer Science University of New Mexico E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Introduction Most important of procedural methods Used to model Natural phenomena Clouds Terrain Plants Crowd Scenes Real physical processes E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Newtonian Particle Particle system is a set of particles Each particle is an ideal point mass Six degrees of freedom Position Velocity Each particle obeys Newtons’ law f = ma E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Particle Equations pi = (xi, yi zi) vi = dpi /dt = pi‘ = (dxi /dt, dyi /dt , zi /dt) m vi‘= fi Hard part is defining force vector E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Force Vector Independent Particles Coupled Particles O(n) Gravity Wind forces O(n) calulation Coupled Particles O(n) Meshes Spring-Mass Systems Coupled Particles O(n2) Attractive and repulsive forces E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Solution of Particle Systems 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) } E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Simple Forces Consider force on particle i fi = fi(pi, vi) Gravity fi = g gi = (0, -g, 0) Wind forces Drag pi(t0), vi(t0) E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Meshes Connect each particle to its closest neighbors O(n) force calculation Use spring-mass system E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Spring Forces Assume each particle has unit mass and is connected to its neighbor(s) by a spring Hooke’s law: force proportional to distance (d = ||p – q||) between the points E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Hooke’s Law Let s be the distance when there is no force f = -ks(|d| - s) d/|d| ks is the spring constant d/|d| is a unit vector pointed from p to q Each interior point in mesh has four forces applied to it E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Spring Damping · A pure spring-mass will oscillate forever Must add a damping term f = -(ks(|d| - s) + kd d·d/|d|)d/|d| Must project velocity · E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Attraction and Repulsion Inverse square law f = -krd/|d|3 General case requires O(n2) 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)? E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Boxes 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 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Linked Lists Each particle maintains a linked list of its neighbors Update data structure at each time step Must amortize cost of building the data structures initially E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Particle Field Calculations Consider simple gravity We don’t compute forces due to sun, moon, and other large bodies Rather we use the gravitational field Usually we can group particles into equivalent point masses E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Solution of ODEs Particle system has 6n ordinary differential equations Write set as du/dt = g(u,t) Solve by approximations using Taylor’s Thm E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Euler’s Method u(t + h) ≈ u(t) + h du/dt = u(t) + hg(u, t) Per step error is O(h2) Require one force evaluation per time step Problem is numerical instability depends on step size E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Improved Euler u(t + h) ≈ u(t) + h/2(g(u, t) + g(u, t+h)) Per step error is O(h3) Also allows for larger step sizes But requires two function evaluations per step Also known as Runge-Kutta method of order 2 E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Contraints Easy in computer graphics to ignore physical reality Surfaces are virtual Must detect collisions separately if we want exact solution Can approximate with repulsive forces E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Collisions Once we detect a collision, we can calculate new path Use coefficient of resititution Reflect vertical component May have to use partial time step E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012

Contact Forces E. Angel and D. Shreiner: Interactive Computer Graphics 6E © Addison-Wesley 2012