1 / 10

Advanced Particle System Development

Learn the advanced graphics techniques for implementing particle systems in game development, including particle physics simulation, integration strategies, collisions, force fields, and rendering with sprites.

pandorag
Télécharger la présentation

Advanced Particle System Development

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. UW ExtensionCertificate Program inGame Development 2nd quarter:Advanced Graphics Particle systems

  2. Goals • Understand the basic math of particle systems • Learn how to render them with sprites

  3. Particle system math • Particles are driven by simple physics simulation • Often use just Euler integration • Data per-particle: • Position and velocity • Mass (often elided, all particles have the same) • Age (particles must die) • Visuals (color, texture, transparency)

  4. Particle system simulation • Simplest way to implement them is iteratively: for(eachparticle'p') { Force=CalculateForce(p.Pos,p.Vel); Accel=Force/p.Mass; p.Pos+=p.Vel; p.Vel+=Accel; p.Age+=1; } • Do for every particle, every frame

  5. Integration strategies • Euler’s method isn’t very stable with non-trivial forces • A better method is midpoint integration p.Pos+=p.Vel+Accel/2; p.Vel+=Accel; • Can also use: Runge-Kutta • Must calculate the forces multiple times • More expensive Euler midpoint

  6. Collisions • You may need particles to interact with geometry • The particle describes a path (straight line or not) • Intersection of line segment with geometry • Record the position and normal at the collision point • Then, there must be a reaction when colliding • Bounce back: Vr = V + 2*dot(V,N)*N (pure reflection) • Better method: calculate two segments, before/after • Beware of monsters: multiple collisions, twitching

  7. Force fields • Forces dependent on the position • Can be stored in 2D or 3D arrays of vectors • Like images or textures • Or calculated procedurally from position, using math • Wind, for instance, with whirlwinds and eddies

  8. Rendering sprites Z-facing O-facing • Z-facing shows less distortion • But other geometry doesn’t • O-facing is more expensive • Generally not worth it • Sprites are represented by: • Position (P) and size (S) • And attributes (color, opacity, texture coordinates…) S S P P Z O

  9. Rendering sprites (cont) • Must find the four corners of the quad • P +/– (S*X) +/– (S*Y) • X, Y are axis of view space, in world coordinates • X, Y are the first two columns of the view matrix Y S S P X

  10. Other sprite-like things • Groups of crisscrossed quads • Provide more volume • Axis sprites • Defined on two points • Faces the camera, pivoting on axis • Criscrossed beams • Two or more axis sprites, not facing the camera • Sharing same axis • Also provides volume P1 P0 Axis sprite

More Related