Well, so I have been tinkering with the idea of creating my own particle system library (yes..yet another library for particles! but I intend to try and implement it a bit more like Houdini's pops..or rather I'm hoping to!!) to be used with OF as a personal project. Also I like the idea of developing something I will be comfortable using knowing that it tries to be consistent with the way Houdini works (i.e with respect to the workflow) and I can use as a base for other projects I will be undertaking later on.
Well so here's how the design goes (very rough and brief):
There's a ParticleSystem which contains emitters. It can have any arbitrary number of
emitters in it which is setup by the user.
Emitters are only used to emit into the ParticleSystem. They do not manage
or care about particles only about how particles get emitted, their initial velocities
initial positions etc.
Kind of like Houdini's Location/Source pops inside the POP context which can have any number of emitters in it and all the emitters care about is Emission of Particles.
To keep things simple I have not yet implemented any deletions or killing
of particles but its kind of inevitable.
Also I have taken care to make it such that the result is always reproducible
using same seed values (which does take some extra steps).
At the moment there are 2 emitter types supported.
- Emitters akin to Location POP: They have controls for defining initial position of particles and intital velocities. As well as an activation flag which can be turned off to stop the given emitter and a jitter scale which just adds in some jitter.
- Emitters akin to Source POP: These use any triangulated mesh and emit particles from it. Theres support for inheriting colors from the mesh as well along with all the other features of the former type.
I've also designed a templated Attribute class for these but they are proving a bit tricky with all the different value types. One idea is to have pre-defined vectors to hold each value typed attribute
etc and push each attrib in relevant vectors.
and then set/get using specialized templated procedures.
But I'm still trying to get to a better solution for this.
Anyways this is a screenshot from what I have been able to get so far:
(Most of you should recall the openVDB dragon!)
The particles here are emitted from a base mesh with colors set on it.
The Emitter class just detects if the base mesh has any colors and if it does
it inherits it.
The particle have a basic perlin noise applied on them as a force and thats about it.
I intend to implement the killing procedures and then it would more or less have
what I'll need for the time being.