1 Document started 27/01/2008 by Tiago Gusmão
2 Updated 02/02/2008 to reflect syntax changes
3 Updated 03/02/2008 to add trails (connected particles)
5 This is a short specification/tutorial to define particle systems in FlightGear using XML
7 Meaningless example (what i had accumulated due to tests):
11 <!-- <texture>particle.rgb</texture> -->
12 <emissive>false</emissive>
13 <lighting>true</lighting>
19 <!--<pitch-deg>90</pitch-deg>-->
25 <property>engines/engine/smoking</property>
29 <property>position/altitude-agl-ft</property>
35 <attach>world</attach>
42 <theta-min-deg>84</theta-min-deg>
43 <theta-max-deg>86</theta-max-deg>
44 <phi-min-deg>-1.5</phi-min-deg>
45 <phi-max-deg>1.5</phi-max-deg>
51 <x-min-deg-sec>0</x-min-deg-sec>
52 <y-min-deg-sec>0</y-min-deg-sec>
53 <z-min-deg-sec>0</z-min-deg-sec>
54 <x-max-deg-sec>0</x-max-deg-sec>
55 <y-max-deg-sec>0</y-max-deg-sec>
56 <z-max-deg-sec>0</z-max-deg-sec>
67 <align>billboard</align>
114 <mass-kg>0.25</mass-kg>
115 <radius-m>0.1</radius-m>
120 <gravity type="bool">true</gravity>
121 <wind type="bool">true</wind>
125 Stick this inside any model XML like it was an animation and it should
126 work (notice the condition requires wheel on the ground)
131 <VALUEORPROP/> means you can either specify a property with factor and
132 offset (result = (prop*factor)+offset ) in the usual way
136 <particlesystem> = the base tag
137 <type>string</type> can be "normal" or "trail", normal is the usual quad particles, trail is a string of connected quads, see note near the end
138 <offsets> = this places the source of the particles (the emitter) in relation to the perhaps already offsetted model (see model-howto.html for details)
142 <pitch-deg>float</pitch-deg>
143 <roll-deg>float</roll-deg>
144 <heading-deg>float</heading-deg>
146 <condition> =a typical condition that if not true stops particles from being emitted (PPS=0)
149 <name>string</name> = the name of the particle system (so it can then be referenced by animations)
150 <attach>string</attach> = 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)
151 <texture>string</texture> = the texture path relative to the XML file location
152 <emissive>bool</emissive> = self-explanatory
153 <lighting>bool</lighting> = yet to be tested, but seems obvious
154 <align>string</align> = can be "billboard" or "fixed", still being worked, don't use
155 <placer> = where particles are born
156 <type>string</type> = can be "sector" (inside a circle), "segments"(user-defined segments) and "point" (default)
157 *<radius-min-m>float</radius-min-m> = only for sector, inner radius at which particles appear
158 *<radius-max-m>float</radius-max-m> = only for sector, outer radius at which particles appear
159 *<phi-min-deg>float</phi-min-deg> = only for sector, starting angle of the slide at which particles appear
160 *<phi-max-deg>float</phi-max-deg> = only for sector, ending angle of the slide at which particles appear
161 <segments> = only for segments, encloses sequential points that form segments
162 <vertex> = specifies one point, put as many as you want
173 <shooter> = the shooter defines the initial velocity vector for your particles
174 *<theta-min-deg>float</theta-min-deg> = horizontal angle limits of the particle cone
175 *<theta-max-deg>float</theta-max-deg>
176 *<phi-min-deg>float</phi-min-deg> = vertical angle limits of the particle cone
177 *<phi-max-deg>float</phi-max-deg> for an illustration of theta/phi see http://www.cs.clemson.edu/~malloy/courses/3dgames-2007/tutor/web/particles/particles.html
178 <speed-mps> = the scalar velocity (meter per second)
179 <VALUEORPROP/> = see note
180 *<spread> the "tolerance" in each direction so values are in the range [value-spread, value+spread]
182 <rotation-speed> = the range of initial rotational speed of the particles
183 *<x-min-deg-sec>float</x-min-deg-sec>
184 *<y-min-deg-sec>float</y-min-deg-sec>
185 *<z-min-deg-sec>float</z-min-deg-sec>
186 *<x-max-deg-sec>float</x-max-deg-sec>
187 *<y-max-deg-sec>float</y-max-deg-sec>
188 *<z-max-deg-sec>float</z-max-deg-sec>
193 <VALUEORPROP/> = see note
194 *<spread> the "tolerance" in each direction so values are in the range [value-spread, value+spread]
197 <particle> = defines the particle properties
199 <color> = initial color (at time of emission)
200 <red><VALUEORPROP/></red> = color component in normalized value [0,1]
201 <green><VALUEORPROP/></green>
202 <blue><VALUEORPROP/></blue>
203 <alpha><VALUEORPROP/></alpha>
205 <size> = as above, but for size
210 <color> = final color (at the end of the particle life)
211 <red><VALUEORPROP/></red>
212 <green><VALUEORPROP/></green>
213 <blue><VALUEORPROP/></blue>
214 <alpha><VALUEORPROP/></alpha>
220 *<life-sec> = the time the particles will be alive, in seconds
223 *<radius-m>float</radius-m> = each particles is physically treated as a sphere with this radius
224 *<mass-kg>float</mass-kg> = mass in KG
226 <program> = defines external forces acting upon a particle
227 <fluid>string<fluid> = can be "air" or "water"
228 <gravity>bool</gravity> = can be "true" or "false". uses standard gravity
229 <wind>bool</wind> = can be "true" or "false". uses user position wind (not the model position, but shouldn't be noticeable, you want to disabled it when using local attach)
234 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)
235 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)
236 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
237 If you don't use any properties nor conditions, your particle system doesn't need to use a callback a so it's slightly better on the CPU (mostly useful for static models)
238 If your particle lifetime is too big you might run out of particles temporarily (still being investigated)
239 Use mass and size(radius) to adjust the reaction to gravity and wind (mass/size = density)
240 Although 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.