Presentation is loading. Please wait.

Presentation is loading. Please wait.

Point Sprites Course Information CVG: Programming 4 My Name: Mark Walsh Website: www.activehelix.co.uk/courseswww.activehelix.co.uk/courses Recommended.

Similar presentations


Presentation on theme: "Point Sprites Course Information CVG: Programming 4 My Name: Mark Walsh Website: www.activehelix.co.uk/courseswww.activehelix.co.uk/courses Recommended."— Presentation transcript:

1 Point Sprites Course Information CVG: Programming 4 My Name: Mark Walsh Website: www.activehelix.co.uk/courseswww.activehelix.co.uk/courses Recommended Reading Introduction to 3D Game Programming with DirectX 9.0 (Frank D. Luna)

2 Particle Systems: Introduction Many natural phenomena consist of many small particles that behave in a similar manner –stars in a star field, snow flakes, sparks, etc There are also many phenomena that can be described using small particles such as bullets from a gun Particle systems are used to model these phenomena.

3 Definition The term particle system refers to a computer graphics technique to simulate certain fuzzy phenomena, which are otherwise very hard to reproduce with conventional rendering techniques Examples of such phenomena which are commonly replicated using particle systems include: Fire, explosions, smoke, flowing water, sparks, falling leaves, clouds, fog, snow, dust, meteor tails, hair, fur, grass, or abstract visual effects like glowing trails, magic spells, etc.

4 Typical Implementation: Emitter A particle system's position and motion in 3D space are controlled by what is referred to as an emitter The emitter acts as the source of the particles, and its location in 3D space determines where they are generated and from whence they proceed

5 A regular 3D mesh object, such as a cube or a plane, can be used as an emitter: –The particles are rendered but the underlying mesh object is usually invisible The emitter has attached to it a set of particle behaviour parameters; these parameters can include –The spawning rate –The particles' initial velocity vector –Particle lifetime –Particle colour

6 It is common for all or most of these parameters to be "fuzzy" The parameters are specified by a central value and the degree of randomness allowable on either side of the center When using a mesh object as an emitter, the initial velocity vector is often set to be normal to the individual face(s) of the object, making the particles appear to "spray" directly from each face A typical particle system's update loop (which is performed for each frame of animation) can be separated into two distinct stages, the parameter update/simulation stage and the rendering stage.

7 Simulation stage The number of new particles that must be created is calculated based on spawning rates and the interval between updates, and each of them is spawned in a specific position in 3D space based on the emitter's position and the spawning area specified Each of the particle's parameters is initialised according to the emitter's parameters At each update, all existing particles are checked to see if they have exceeded their lifetime, in which case they are removed from the simulation Otherwise, the particles' position and other characteristics are advanced based on some sort of physical simulation, which can be as simple as translating their current position, or as complicated as performing physically-accurate trajectory calculations which take into account external forces

8 Rendering stage After the update is complete, each particle is rendered… …before we deal with rendering….

9 Animated or Static Particle systems can be either animated or static The lifetime of each particle can either be distributed over time or rendered all at once

10 Particle Systems and Point Sprites There are different ways of modelling a particle system Metaballs 3D mesh objects can "stand in" for the particles One of these ways is by using point sprites –Textured billboarded quad

11 Point Sprites Particles can be modelled using small objects These small objects can be mathematically modelled as points Since the days of DirectX 8.0 and on the methods used to implement point sprites have improved We don’t just want a single point primitive –very small and uniform in size –we often want to texture our sprites

12 Billboard Sprites Pre-DirectX 8.0 we had to use billboard sprites to simulate point sprites and to construct particle system Post DirectX 8.0 we now have access to a special point primitive that is mainly applicable to particles systems

13 DirectX Point Primitives Can map textures to them They can change size We can define a point primitive using only a single point They are always rotated to face the camera

14 Balancing Deception and Realism In the real world: A snow storm is made up of millions of snowflakes –Falling at different speeds (velocities) in our field of view –We know that (generally) no 2 snowflakes are the same Our aim is to try and code a snowstorm that, whilst being as realistic as possible, doesn't require a Silicon Graphics workstation to watch

15 It is a balancing act between appearance and deception In this case, we can handle appearance by having hundreds (or even thousands) of snowflake particles We're going to have to use some deception by making all our snowflakes identical If we don't, we'll need a separate texture for every flake which, besides being pointless and impractical, the average user would never even notice!

16 Point Primitive Rendering Controls Direct3D for DirectX 9.0 supports additional parameters to control the rendering of point sprites These parameters enable points to be of variable size and have a full texture map applied

17 Set Flags and Render states Point Size Computations Texturing Clipping

18

19 The End


Download ppt "Point Sprites Course Information CVG: Programming 4 My Name: Mark Walsh Website: www.activehelix.co.uk/courseswww.activehelix.co.uk/courses Recommended."

Similar presentations


Ads by Google