As you probably got by the “subtle” clue hidden in the post headline, I spent this week making a simple prototype particle editor, where I tried out some of the parameters that a user will be able to play around with in the final version of the program. The prototype has one type of particle and one type of particle emitter, but they’re located in the same editor. In the final version I’ll have one editor for the particles and another for the paricle emitters.
In the prototype you can modify the amount of particles that gets emitted every frame, how many particles that are alowed to be active at the same time, how long the particles will live after they’re born (in seconds, should parbably have written that in the GUI description, oops), the size of the particles, the direction they’re emitted, the velocity the particles are emitted with, and by the maximum angle that the particles emittion direction can be tilted by (it’s chosen at random).
For the prototype particle I decided to implement a billboard that has a texture with an alpha channel making parts of the billboard transparent. A billboard means that the object will constantly be facing a given target, in most cases (also in this case) the target is the camera. So a viewer will always see the same part of the object. One thing that I didn’t know when i started was that when using transparent objects the objects needs to be draw in a specific order, namely the object furthest form the camera needs to be rendered first and the object located closest to the camera must be rendered last. If this criteria isn’t meet the object closer to the camera will overwritte the pixels of the objects located furter from the camera instead of blend with them. This becomes very apparent in the demo if you increase the size of the particles. This is because the distance form the particle to the camera is calculated from the center of the particle billboards, meaning that if two particles are very close together but the differnece in the positions y coordinate is relatively large, the particle that should be located behind the other particle can get a distnace that’s closer to the camera then the particle infront of it.
After I did those test programs in OpenCL last week I also realised that i need to design my particle system using a data oriented approach inorder to efficient transfer data from the host program to OpenCL. I also decided that I’ll use TinyXML-2 which is a free XML parser written by Lee Thomason to load and save data about the particles, particle emitters. I’ll also use it to load the different textures that the user can select for the particles and most likely for the shaders aswell.
If you want to try the particle demo you can click on the milestone two link in the upper right corner and navigate to the TestPrototype folder and click on the ParticleEnginePrototype.zip file, or just click on this link, I’d choose the later:P.
Next week (tomorrow) I’ll start to transform the prototype into the alpha and the omega version, whish me luck:).