Using the Particle Sampler Info node with mental ray shaders

The Particle Sampler Info node can be used to provide additional particle shading control in mental ray shaders.

Follow this workflow to use the particleSamplerInfo node with a mental ray shader. This example creates a particle emitter where each particle has a random color and then uses a particleSamplerInfo node to supply the per particle color information to a mental ray shader.

  1. Create an emitter.
  2. Set Rate (Particles/Sec) to 300 and set Speed to 5.
  3. Play the animation so that particles appear and assign a new mib_illum_lambert material to the particle shape.
  4. Open the nParticleShape Attribute Editor. In the Shading section, set Particle Render Type to Blobby Surface (s/w).
  5. Click the Add Attributes For Current Render Type.
  6. Set Radius to 0.2.
  7. In order to access per particle color data, you must add the rgbPP attribute to the particle shape. The rgbPP attribute is exposed through the outColor attribute on the particleSamplerInfo node.

    In the Particle Color Editor window, select Add Per Particle Attribute and click Add Attribute. The RGB PP field now appears.

  8. Right click the RGB PP field in the Per Particle (Array) Attributes section and add a Runtime Expression Before Dynamics. Enter particleShape1.rgbPP = sphrand(1) for the expression and click Create.
  9. Open the Attribute Editor for the mib_illum_lambert shader.
  10. Click the map button for the Diffuse channel and select Particle Sampler from the Utilities section under the Maya section of the Create Render Node window.
  11. Play the animation and preview render with mental ray for Maya. The particles each have a random color assigned to it.

Related topics