Emit into multiple objects
Here is a setup that you can use when working with Thinking Particles and emitting into objects. This setup allows you to emit particles from multiple objects but only using one emitter. The principle is as follows…
You basically iterate through a list of objects. Then pass these objects into the volume position node, the result being that the particles are then placed into each object from the list. There is also included a simple method of enabling or disabling the objects from being included. Therefore you can control which objects have particles inside or not on a per object basis.
The great thing about a setup like this is that it is fairly simple to use and expand. It is easy to adjust the particle emitter as you are only using one emitter, yet it is quite powerful because it allows you to emit particles into an infinite number of objects. Well ok, perhaps not infinite, but you can certainly emit into hundreds if not thousands of objects with relative ease.
If you look at the screenshot above it may look like the particles are all in the same mesh, but each letter of the logo is an independent object. This means each letter can be transformed, textured and animated individually. Yet all the particles are generated with one emitter.
Anyway enough of this banter, how does it actually work?
Here is a screenshot of the Xpresso setup. The first node is the Object List node. You can find this by right clicking in the Xpresso window and choosing
New Node > Xpresso > Iterator > ObjectList
Object List Node
This node is really handy as it allows you to drag any objects from your scene into the Iteration List field and it will then iterate through the list. In other words it will output the object for every object in the list. It doesn’t matter where in the object manager hierarchy these objects are, so they don’t all need to exist in the same hierarchy. If you do want to add multiple objects by shift or control clicking to select your objects, remember to lock the attribute manager with the ObjectList parameters visible before you start clicking in the object manager to select your objects. If you don’t, you’ll lose the Iteration List field and will have to go back and select the ObjectList node in your Xpresso window again.
The next node along is a simple object node. Link the Instance output into the object node Object input port. If you drag one of your objects into the Xpresso window it will automatically add the Object node for you. You can see I dragged the ‘L’ object into my setup.
To emit particles we will use the most basic of all the TP generators. We would like to create particles and we are not really bothered about speed, position etc at this point in the setup. ThePBorn node is found under…
New Node > Thinking Particles > TP Generators > PBorn
Add the PBorn node
Next we need to place our particles into each of the objects. To do this we can use the PVolumePosition node.
New Node > Thinking Particles > TP Helper > PVolumePosition
Add the PVolumePosition node
The PVolumePosition node allows us to specify an object volume that we would like to use with our particles. So you could link an object node output port into the PVolumePosition Object input port. However we want to iterate through our list, so we will link the ObjectList Instance output into this port instead. This in itself will not place the particles into the objects. We need to explicitly define the particles we would like to affect and what we would like to do to them. We use the PSetData node for this, which can be found under
New Node > Thinking Particles > TP Standard > PSetData
Add the PSetData node
First of all you drag the Particle Birth from the PBorn node into the PSetData Particle input port. This tells the node that these are the particles we would like to affect. We then drag the PVolumePosition Position output and link it into the PSetData Position input port. Basically saying that we would like to place our particles into the positions that are defined by the PVolumePosition node.
So in a setup where you use one object, this would all work fine now. If you have been building the setup as you read through this, then press play and you will probably see all your particles being created in the first object that you placed into the ObjectList. It seems that it isn’t iterating through the list. So at this point we can employ a new trick which offers another benefit as well. We need to force the PBorn node to refresh on each frame. By default the PBorn node is on. If we link our iteration through the On port of the node it will check this port for every frame as the ObjectList iterates through each object. The trick I chose to use for this was to link the Xray checkbox into the PBorn On port. By doing this we have the added benefit of including or excluding objects from the setup depending on the state of the Xray checkbox. Of course you don’t need to use the Xray checkbox, you could add some userdata and link that to the On port.
The Xray checkbox
In my setup the Object from the ObjectList is passed through the Xpresso, the Xray checkbox is evaluated, the particles are created and the same object is passed into the PVolumePosition and the particles are placed there. The objects are of course iterated through, so this happens for all the objects in the list. This is then repeated.
So as you can see a nice simple setup with a great workflow and lots of potential. Certainly saves creating an emitter for every object you’d like to place particle into. Now what you do with those particles is entirely up to you.
If you’d like to download the sample scene I created which demonstrates this then click here. It was made in 11.5, but should be fine in r11 and r12 too. Have fun!