Particle Systems (Motion Machines of 2D Objects with Textures)
description
Transcript of Particle Systems (Motion Machines of 2D Objects with Textures)
![Page 1: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/1.jpg)
Particle Systems(Motion Machines of 2D Objects with Textures)
Matthew K. Bowles
Advanced Computer Graphics
Spring 2004
![Page 2: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/2.jpg)
Particle Systems
• What are particle systems used for?
• Why do we care?
![Page 3: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/3.jpg)
Particle Systems
• Properties:– Evolves (not static).– Procedural (state machines).– Non-deterministic (randomness).– Simple (computationally efficient).– LOD is easy (particle count & size).– Good at complex objects (grass).– Good at amorphous objects (fire).– Good at complex behaviour (explosions).
![Page 4: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/4.jpg)
Particle Systems
• Process:1. Generate new particles with initial
attributes.
2. Kill off particles destined to die.
3. Modify particle attributes.
4. Render remaining particles.
![Page 5: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/5.jpg)
Particle Motion
• State Machines
• Two primary methods for modeling transitions.– Age-
• State transitions due to the temporal plane
– Collision Planes-• State transitions due to the spatial plane
![Page 6: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/6.jpg)
Particle Systems
• Variance:– For all particle attributes we want to provide
some randomness in order to make the system seem more natural.
– Result = Mean + Variance * Rand()
![Page 7: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/7.jpg)
Particle Motion
• Position(x, y, z):– Position = Position + Velocity * Delta_Time
• High variance = Rain & Star field
• Med variance = Fire & Grass
• Low variance = Fireworks & Fountains
– We only draw living particles.
![Page 8: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/8.jpg)
Particle Motion
• Velocity(vx, vy, vz):– Velocity = Velocity – Acceleration *
Delta_Time• High variance = Fireworks & Fountains
• Med variance = Fire & Grass
• Low variance = Rain & Starfield
– The motion is dependent on the relative velocity of each component.
![Page 9: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/9.jpg)
Particle Motion
• Acceleration(ax, ay, az):– Models the sum of the forces on a particle
(typically constant over an entire set of particles). Might change as a function of the current state.
– X and Z often differentiated from Y (i.e., most 3D models maintain Y as the dimension with Earth’s gravity).
![Page 10: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/10.jpg)
Particle Motion
• What about using a direction vector and a velocity magnitude for modeling motion? (d,|m|)– More useful for 3D objects, which must
maintain an orientation.– Particles have no orientation.
![Page 11: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/11.jpg)
Particle Motion
• What about using global accelerations?– Pros – Uses less space and easier to maintain.– Cons – Supports a limited set of particle sets.
![Page 12: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/12.jpg)
Particle Objects
• Idea – – A particle’s shape is essentially the same, no matter
what side of the particle we are looking at.
• Result – – We render a particle as a 2D object.
• Problem – – What about the change in shape due to the camera
view?
![Page 13: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/13.jpg)
Particle Objects
• Bill Boarding– Rendering a 2D object so that the surface of the object is
always perpendicular to the camera view vector.– v0 = vCenter + ((-vRight - vUp) * (particle_size / 2));– v1 = vCenter + (( vRight - vUp) * (particle_size / 2));– v2 = vCenter + (( vRight + vUp) * (particle_size /
2));– v3 = vCenter + ((-vRight + vUp) * (particle_size /
2));– Where vCenter is the location of our particle, and vRight and
vUp are taken from the model-view matrix.
![Page 14: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/14.jpg)
Particle Objects
• Do we have to build a quad for a particle?
• Building the quad and executing the Bill Boarding algorithm takes some overhead processing.
![Page 15: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/15.jpg)
Particle Objects
• Many graphic languages (DirectX and openGL) implement point sprites.
• Point sprites – Build the quad and execute the Bill Boarding
algorithm on the GPU, thus saving CPU processing time.
![Page 16: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/16.jpg)
Particle Textures
• RGBA – – Red, Green, Blue, and Alpha…– What is alpha?
• Alpha used to model opacity (solid objects) and translucence (i.e., glass, water, etc…)
• Lower Alpha Greater Opacity• Higher Alpha Greater Translucence• Is Alpha all that we need?
![Page 17: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/17.jpg)
Particle Textures
• We must enable blending and specify how to blend with a blending factor for source and destination.– Source Incoming Fragment Color (Rs,Gs,Bs,As)
– Destination Stored Pixel Color (Rd,Gd,Bd,Ad)
– Source Blending Factor (Sr, Sg, Sb, Sa)
– Destination Blending Factor (Dr, Dg, Db, Da),
– (RsSr+RdDr, GsSg+GdDg, BsSb+BdDb, AsSa+AdDa)
![Page 18: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/18.jpg)
Particle Textures
• We model the particle as a quad (i.e., a square). However, most particles don’t look like squares… What’s the deal?
• In our particle texture we render some portions invisible. We do this by specifying a clear color and setting the invisible portions of the texture to the same RGB values of the clear color.
![Page 19: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/19.jpg)
Particle Textures
• What about RGB?– We modulate the particle color with the particle
texture so that we can have a dynamic color variance between particles (i.e., we would like to use a limited amount of textures, so we can’t support to many different colors with just texture).
![Page 20: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/20.jpg)
Particle Textures
• Other considerations?– Disable hidden-surface removal. Particles must
blend colors with the objects behind them. Therefore, we must consider all objects that are hidden by particles.
![Page 21: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/21.jpg)
Particle Systems
• Advanced Work– Modeling complex physical phenomena using
real world physics.– Flocking (modeling particles as boids)
• Remember the limitations on motion and shape we stated earlier. We lied. There is a whole other world out there.
![Page 22: Particle Systems (Motion Machines of 2D Objects with Textures)](https://reader036.fdocuments.in/reader036/viewer/2022081603/56814499550346895db1416f/html5/thumbnails/22.jpg)
Particle System References
• William T. Reeves, Particle Systems - A Technique for Modeling a Class of Fuzzy Objects”, Computer Graphics 17:3 pp. 359-376, 1983 (SIGGRAPH 83).
• www.cs.otago.ac.nz/cosc455/ParticleSystems.pdf • www.opengl.org• www.codesampler.com• www.gametutorials.com• OpenGL Programming Guide (Addison-Wesley
Publishing Company) Second Edition 1997