Example Using the Particle Sampler Info node with rgbPP
Make a cone emitter emitting upwards with a speed of 8, set the particles' Lifespan Mode to Constant with a Lifespan of 2, and set their Render Type to cloud.
To do this, you can copy the following Mel commands from the online help and paste them into the Script Editor:
emitter -pos 0 0 0 -type volume -r 100 -vsh cone -alx 8; particle;
connectDynamic -em emitterl particlel; setAttr particleShapel.lifespanMode 1;
setAttr particleShape1.lifespan 2.0; setAttr particleShape1.particleRenderType 8;
2 Select the particle shape and select Fields > Create Gravity.
3 With the particle shape selected, display the Attribute Editor.
4 Under Add Dynamic Attributes, click Color. The Particle Color window is displayed.
5 Click Add Per Particle Attribute and click Add Attribute.
6 In the Attribute Editor, click the particleCloudl tab.
7 Next to the Incandescence attribute (not Life Incandescence), press the | *. | map button to display the Create Render Node window.
8 Click the Utilities tab, and under Particle Utilities, click the Particle Sampler Info button.
This automatically creates a new Particle Sampler Info node and connects its color output to the incandescence. (If you had already created a Particle Sampler Info node, you could use that and connect it directly, in the connection editor.)
9 Select the particle shape tab in the Attribute Editor. Under Per Particle (Array) Attributes, right click on rgbPP and select Runtime Expression.
10 In the Expression Editor, enter the following expression:
particleShape1.rgbPP = << mag(particleShape1.velocity) / 10, 0.0, 1 -mag(particleShape1.velocity)/10 >>;
This tells Maya to change the particle color from blue to red as the velocity increases.
We used an expression in this example to achieve a specific effect. However, you don't have to use expressions with the Particle Sampler Info node. You can also use a ramp, which will give you a different effect.
11 Play about 75 frames and render.
Notice that the Particle Sampler Info node outIncandescence output automatically uses rgbPP if that attribute is present. If there is no rgbPP, it uses colorRed/colorGreen/colorBlue, if they are present.
The advantage of using rgbPP is that you can set or animate its value in any of the ways available for per-particle attributes, and see the results in software. You will also then be using the same color attribute in both hardware and software rendering.
However, rgbPP can be animated only with expressions and ramps (or the component editor). The advantage of using Life Color is that you get a texture placement node and can make use of its additional controls. In particular, you can use any texture, not just a ramp, since you get both u and v control. You can connect any compatible Particle Sampler Info node attribute you want.
Setting transparency with the Particle Sampler Info node
As with color, Life Transparency is still available. It uses the outUvCoord attribute of a Particle Sampler Info node in conjunction with a texture placement node, instead of a particle transparency mapper and age mapper.
And as with color, you can use per-particle attributes such as opacityPP directly. You use the outTransparency attribute of the Particle Sampler Info node.
Post a comment