Tutorial about Particles, Goals and Arraymapper Basics

Links for fast jump: particle flow and arraymapper basics

Array Mapper and Particle Flow:

Create a new scene and default NURBS Cylinder. Go to Dynamics / Particles / Emit from Object and use the option box. Set Surface for Emitter Type, Need Parent UV to on and press the create button. Press the Play button and you see particles emitted from the surface.

Now select the emitter that can be found parented under the NURBS cylinder (click here for a screenshot) and open the attribute editor. Scroll to the bottom of the emitter attributes and oben the Texture Emission Attributes. Activate Texture Rate and press the texture button on the right of texture rate (click here for a screenshot).
Now use Ramp and set the upper color to black and the lower one to white (just delete the middle color) and move the black color entry down near the white one. Set Type to U Ramp. Press Play. The particle should be emitted only at the lower part (click here for a screenshot). You can for example now animate where they are emitted.

Make a third, black colored entry and move the white entry a little bit higher and the new black one below the white. Now set in every color entry a key for position attribute (click here for a screenshot). Set the current time to something higher like 150. Now move all the colors to the upper end and set a key. And press Play. You could loop the animation to infinite, just open the Graph Editor and set the Post Infinity to linear (click here for a screenshot). If you wanna have more particles, than just set an higher rate in your emitter.
Now we want the particles to stay on the surface and move around and up. Set the Speed that can be found in the emitter / Basic Emission Speed Attributes to zero (click here for a screenshot). The particles stay on surface, but if you move it, they stand still, we want them to automatically follow the cylinder. Select the particle object and the cylinder and use Particle / Goal option box. Set the Weight to 1 (click here for a screenshot). Now the stay on the surface, but not where they are born. All the particles move to one of the vertices. To change that, we need an expression that tells every particle where it should stay. Select the particle object, open the attribute editor and select the particleshape tab. There are a few goal options, but none of them can help us. We need to create a custom expression and some attributes...

Go to the Per Particle (Array) Attributes press the General Button that can be found below under Add Dynamic Attributes (click here for a screenshot). Choose goalU and goalV, can be found in the Particle tab and press OK. You should have now two additional attributes (click here for a screenshot). Press the right mouse button over one of the new attributes and choose Creation Expression.
Enter the following:

goalU = parentU;
goalV = parentV;

Click create and close. Now move the cylinder and set some keys and press play... the particle stay on the surface and it's no problem to move the surface and because I animated my emission ramp, particles are created along the whole surface..
Now I want the particles to move a long the surface. Therefor I create a Runtime Expression. Just click with the right mouse button again and choose Runtime Expression and enter the following.

goalV += 0.01;
goalU += 0.01;

Now all the particle move a little higher and around the cylinder. The problem now is, that when they reach the top, they stay where they are. To change that, just we change the expression and add another attribute. Therefor go to Add Dynamic Attributes and press General. Choose the New tab and and create a Float and activate Per Particle (Array). Name it UpDownMotion and click OK (click here for a screenshot, this screenshot is with the name of another attrbitue that we'll need later, so don't care). Back in the particle shape right click and choose creation expression. Now add to the old commands this line:

UpDownMotion = 0.01;

Press edit and choose Runtime to access the Runtime Expression. Change it to the following one:

goalV += 0.1;
if (goalU <= 0)
UpDownMotion = 0.02;
if (goalU >= 2)
UpDownMotion = -0.02;
goalU += UpDownMotion;

Maya automatically adds to all attributes an prefix with the particleshape name, for better reading I've delete it here!

Now the particles move up and down. You could set particle lifetime to infite and key the Emission Rate. One thing about this expression. The Default Cylinder has an U Parameter range from 0 to 2, this is why I'm checking my goalU greater/equal to 2. Is it true, than the particles need to change their directions. The direction is the value we add, and this value is stored in our UpDownMotion attribute. That's also why every particle has this attribute. If we would have created a single attribute for the whole particle object, than all particles would have the same direction. If the motion is a little bit to uniform for you, than simple change the creation and/or runtime expression. In creation expression you set a randome value when the particle is born and in the runtime expression you just need to invert this value if one of the boundaries is reached.
This would look like this (creation expresion first):

goalU = parentU;
goalV = parentV;
UpDownMotion = rand(0.01, 0.05);

Runtime Expression:

goalV += 0.1;

if (goalU <= 0)
UpDownMotion *= -1;

if (goalU >= 2)
UpDownMotion *= -1;

Press Play to test it and you'll see that the particles now have a different speed.

The thing we didn't use by now is the array mapper. The up and down motion is controlled via an expression, so let's control the round motion with an simple ramp. Therefor create a new custom attribute called RoundMotion, set it to float and Per Particle without Inital State.
Right click on the new attribute and choose Create Ramp Option Box (click here for a screenshot). Now we need to set some attributes for the array mapper. Select goalU for Input U and goalV for Input V and Map To New Ramp and press OK. Now pressing play nothing happens. Because we didn't use the new attribute in the runtime expression. Go back to the particle shape and right click and choose Runtime Expression in one of the other attributes.
Change the goalV line into this new version:

goalV += RoundMotion;

Press play and something has changed. The around the cylinder motion is fast and the particles seam to stick on the isoparm. To change this select the particle object, open the particle shape in the attribute editor and right click on the RoundMotion attribute. Choose ...OutValuePP -> Edit Ramp. You see the ramp again. Delete the color entry in the middle so only black and white are left.
The problem now is that when the particles are on the white part of the ramp, they get really fast, and at the black part they stop. You could now edit the ramp or you could change some settings in the array mapper. Let's try the array mapper first. Go back to the particle shape and right click on the outValuePP in the Round Motion attribute again, choose ...outValuePP -> Edit Array Mapper. You get the settings for the array mapper. Set 0.010 for Min Value and 0.100 for Max Value. The values coming from the ramp (0 to 1) are changed to the new range from 0.010 to 0.100 (click here for a screenshot). Press play again and everything works now. Try to add other value test how this effects the particle motion (click here for a screenshot).

Besides an Ramp, the array mapper can also work with an file node. You just need to replace the ramp. Have a look at my particleDisplacement script that does this automatically. It's something like an "particle displacement system". The displacement work in all 3 dimensions and using animated image sequences works too... read my second arrray mapper tutorial for a more detailed look.

If you have more questions, just use your email editor dreamfactory@gmx.net...

go up