|
|
|||||||||
|
ParticleId
in Fusion5
tutorial for- well, you got it Fusion5 particles have great potential, and often times they will spare you the hassle of doing particles in a separate 3D application. However, if you like to drive your Maya particles with expressions (like I do), you'll soon notice that the pCustom tool you'd use to do it inside Fusion is not exposing the particleId attribute, which is useful in many situations and just needed in others. I'll show a way to 'fake' the particleId attribute by recalculating it after the actual particle creation and mapping it to the unused mass attribute; it's just a quick hack and not 100% precise, but sufficient for a range of circumstances. Let's start with a basic particle flow: a pEmitter, a pRender, and a pCustom we'll put inbetween to assign a particleId to all the particles. Name it pParticleId and set the End Age value in the Conditions tab to 0.0 - so that it will only affect newly created particles. ![]() ![]() Initial setup The only way to keep track of the number of particles created at each frame is to recalculate it. Trivial if emission rate is constant (rate*time) but if it's animated we must resort to sum all rate values, frame by frame, up to the current frame. A quick way to do this is using an InTool script - in pParticleId of course. We'll put the result in Number In 1.
Given the floating nature of the emitter's Number control the result will be float as well, but we'll deal with this later. Now we have a good starting point. To differentiate between all of the particles created in a certain frame we'll use a dirty trick. First we should know how many of these particles we have; add this to the script:
Then we can finally calculate the actual particleId and assign it to the mass expression in the Particles tab:
We hope that rand(0,n2) will evaluate to equidistant values for the newly created particles - in fact it won't and we'll get duplicated particleIds, and that's exactly why so many people say that life sucks. We then make sure that our particleId gets as close to an integer as possible via an int(). ![]() ![]() Well... final setup Though not perfect it works just fine in many situations. Here I animated the emitter rate, and put another pCustom to split the particles in 10 groups and drive positionY with those. ![]() Moduloing particleId is not a dream anymore There are many other ways to do it and many improvements can be made, for example the script can be modified so that it automatically retrieves all the emitters in the upstream. I hope this technique will be useful for your particles. |
|||||||||
|
|