Document started 27/01/2008 by Tiago Gusmão
Updated 02/02/2008 to reflect syntax changes
Updated 03/02/2008 to add trails (connected particles)
This is a short specification/tutorial to define particle systems in FlightGear using XML
Meaningless example (what i had accumulated due to tests):
fuel
false
true
35
-0.3
0
world
point
84
86
-1.5
1.5
10
2.5
0
0
0
0
0
0
1
0
billboard
0.9
0.09
0.09
1.0
1
0.1
0.1
0.0
0.25
4
10
0.25
0.1
air
enabled
enabled
Stick this inside any model XML like it was an animation and it should work (notice the condition requires wheel on the ground)
Specification:
Note:
means you can either specify a property with factor and offset (result = (prop*factor)+offset ) in the usual way
= the base tag
string can be "normal" or "trail", normal is the usual quad particles, trail is a string of connected quads, see note near the end
= this places the source of the particles (the emitter) in relation to the perhaps already offsetted model (see model-howto.html for details)
float
float
float
float
float
float
string = the name of the particle system (so it can then be referenced by animations)
string = can be "world" or "local". "world means the particles aren't "physically linked" to the model (necessary for use outside moving models), "local" means the opposite (can be used for static objects or inside moving objects)
string = the texture path relative to the XML file location
bool = self-explanatory
bool = yet to be tested, but seems obvious
string = can be "billboard" or "fixed", still being worked, don't use
= where particles are born
string = can be "sector" (inside a circle), "segments"(user-defined segments) and "point" (default)
*float = only for sector, inner radius at which particles appear
*float = only for sector, outter radius at which particles appear
*float = only for sector, starting angle of the slide at which particles appear
*float = only for sector, ending angle of the slide at which particles appear
= only for segments, encloses sequential points that form segments
= specifies one point, put as many as you want
float
float
float
....
...
= the shooter defines the initial velocity vector for your particles
*float = this is complicated to explain, for now look here: http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/particles/particles.html
*float
*float
*float
= the scalar velocity
= see note
* the "tolerance" in each direction so values are in the range [value-spread, value+spred]
= the range of initial rotational speed of the particles
*float
*float
*float
*float
*float
*float
= particles per second to be emitted
= see note
* the "tolerance" in each direction so values are in the range [value-spread, value+spred]
=a tipical condition that if not true stops particles from being emitted (PPS=0)
....
= defines the particle properties
= initial color (at time of emission)
= color component in normalized value [0,1]
= final color (at the end of the particle life)
= as above, but for size
* = the time the particles will be alive, in seconds
*
*float = each particles is physically treated as a sphere with this radius
*float = mass in KG
= defines external forces acting upon a particle
string = can be "air" or "water"
string = can be "enabled" or "disabled". uses standard gravity
string = can be "enabled" or "disabled". uses user position wind (not the model position, but shouldn't be noticeable, you want to disabled it when using local attach)
Remarks:
Don't forget you can use existing animations with particles, so if you want to direct or translate the emitter, just use translate, rotate, spin and so on (other animations might have interesting effects too i guess)
Particle XML should be compatible with plib, as the tags will be ignored (you might get some warning if you attach them to animations though)
Try not to use a lot of particles in a way that fills the screen, that will demand lots of fill rate and hurt FPS
If you don't use any properties nor condtions, your particle system doesn't need to use a callback a so it's slightly better on the CPU (mostly useful for static models)
If your particle lifetime is too big you might run out of particles temporarily (still being investigated)
Use mass and size(radius) to adjust the reaction to gravity and wind (mass/size = density)
Altough at the moment severe graphical bugs can be seen in the trails, they are usable. Consider your options correctly! You should consider giving them no initial velocity and most important, no spread, otherwise particles will race and the trail will fold. Start simple (no velocities and forces) and work your way up.