1 / 24

Building a Particle System

Building a Particle System. References: 1. Gamasutra article by Van der Berg 2. Particle System API by McAllister 3. Explosion.c. Particle System (PS) Gallery. Performance and Requirement.

abrial
Télécharger la présentation

Building a Particle System

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Building a Particle System References: 1. Gamasutra article by Van der Berg 2. Particle System API by McAllister 3. Explosion.c

  2. Particle System (PS) Gallery

  3. Performance and Requirement • Keep in mind: a PS greatly increases the number of polygon per frame (one particle: four vertices & 2 triangles) • Perform as few memory operations (allocation/release) as possible • Use a flag to mark a particle dead or respawn • Ability to link PS within the hierarchy of other geometry (smoke out of a cigarette)

  4. Data Structure Reference 1 contains all other details

  5. Explosion • A simple particle system demo for explosion effects (particles and debris) • Observe how particle evolves and how debris rotates

  6. Particle System API (McAllister) • API used in some academic projects • Design modeled after OpenGL • Design goals: • Run-time efficiency • Flexibility: create effects from simple building blocks (gravity, bounce, …) • Scalable simulation quality • Easy to learn

  7. Particle Position Velocity Color Alpha Size Age Secondary position Secondary velocity Particle group A set of particles acted upon by the same forces API applies to the current group Action Functions modify the attributes of particles in the current group Currently has 27 actions (some are physically related) Building blocks for special effects API Description

  8. ActionList Actions compiled (similar to displaylist) Actions in Use

  9. API state (color, velocity, size, …) pSource: create new particles Domain: a uniform mechanism for specifying a region of three-space pColorD: a region of color space pVelocityD: a region of vector space A variety of shapes: PDSphere, PDPlane, … Specified by 9 or fewer floats Attributes and Domains

  10. Newton’s law Use Euler’s method with user-specified step size dt Particle Simulation

  11. Design a PS that suits your needs • Starting pos • Breaking pos • Timeline: ADSR envelope • Color attributes • Rendering style • Dynamics

  12. PAPI (v.210) You need VC80! Uses freeglut

  13. Particle Data Structure

  14. GenParticleGroups P_group_count Max_particles (similar to display list) CurrentGroup Current particle group all actions and commands apply SetMaxParticles GetGroupCount # of particles in the group GetParticlePointer Expose internal storage of particles (avoid copying for higher performance) Example: ParticleContext_t P

  15. GetParticlePointer

  16. Gravity Move (vel, rotvel) Update pos, orient (up vector) P.Source (rate, dom) Particles to add per unit time P.Sink (inOrOut, dom) Kill particles w.r.t dom Bounce (friction, resilience, cutoff, dom) Sphere, rectangle, triangle disc, plane Color (rgb); Color(dom) Translate pos into color Velocity (dom) … ParticleContext_t P

  17. pDomain • Blob, Box, Cone, Cylinder, Disc, Line, Plane, Point, Rectangle, Sphere, Triangle

More Related