Rendering Particles with MTOR


MTOR supports many of the common Maya Particle system rendering modes as pure software (ala prman) rendering. Because prman has optimized primitives for particles and curves you may find that it will perform nearly as well as Maya's hardware rendering options. The real benefits, however, are the general benefits of software rendering:
1) You can attach arbitrary shaders to the particles. You can write your own custom RenderMan shaders that collaborate with mel expressions to calculate RenderMan attributes based on particle lifetime, coloring, etc.

2) Particles can cast shadows

3) Antialiasing, motion blur, etc.

When rendering particles through RenderMan (and any software rendering mechanism) you have control over the physical size of the particles in world space units. This is due to the fact that RenderMan is resolution independent while hardware rendering modes commonly work in pixel units.

A problem arises when you want to software render points and streaks. Maya provides point sizes in units of pixels and this isn't resolution independent. To work around this limitation MTOR utilizes the particle attribute Radius and radiusPP to establish the size of point and streak primitives. You can cause the Radius attribute to appear by first choosing the spheres render type and pressing the button Add Attributes for Current Render Type. This will cause the Radius attribute to appear and now you can choose the rendering size of your points. Now, you can switch back to the points or streaks rendering style and the Radius attribute will be available for MTOR to interpret.

MTOR Support for Maya Particles

To get started rendering particles with MTOR all that is needed is to set up a particle system in Maya. MTOR can interpret most types of Maya particles.  

The following Maya rendering modes are supported by MTOR. The RenderMan primitive used to represent the rendering mode is provided in parenthesis and the translated attributes are indicated as sub-bullets.

 

Supported Maya Particles:

streak (RiCurve)

        Radius

        tailFade, tailSize

multistreak (RiCurve)

        Radius

        tailFade, tailSize

point (RiPoint)

        Radius

multipoint (RiPoint)

        Radius

        multiCount, multiRadius

sphere, blob, blob, cloud (RiSphere)

        Radius

sprite (RiPatch - bilinear)

        spriteScaleX, spriteScaleY, spriteTwist

        spriteScaleXPP, spriteScaleYPP, spriteTwistPP

blobby surface (RiBlobby)

        Radius

Per Particle Effects & Arbitrary Attributes

MTOR automatically establishes the correct rendering context for variations in particle color, opacity and radius. You can write MEL expressions to calculate per-particle radii (radiusPP), color (rgbPP), opacity (opacityPP) and lifespan (lifespanPP and useLifespanPP). You can also use Maya to setup procedural ramps which remap these values.

The age of a particle is particularly interesting to shader developers. Many effects like fire and smoke, rely upon the age of a particle to determine its color and opacity. For this reason, MTOR attaches a special RenderMan attribute ageNormPP to particle primitives. For shader writers, this varying float value can be used to calculate arbitrary functions of the normalized age. Remember that MTOR automatically normalizes the age to lie in the range of 0 (birth) to 1 (death).

Finally you can create arbitrary attributes and associate them with the RenderMan representation of your particle objects. This might be of use if you plan to write a custom shader to perform calculations using per-particle or per-particle-object attributes. For more on the general mechanism for transmitting arbitrary primitive attributes through RenderMan, please refer to the primitive variables reference.

A Particle Expression Example

The images at right were calculated with a few simple MEL expressions. The per-particle colors resulted from a procedural remapping through a ramp. Here's the basic idea:

particleShape.lifespanPP = .5 + rand(1);
particleShape.radiusPP = particleShape.radius * particleShape.ageNormalized;
particleShape.rgbPP <- arrayMapper3.outColorPP

A Simple RenderMan Accumulation Shader

Here's a simple RenderMan shader that shows how to access the ageNormPP parameter. This example simple causes particles to be colored a gray value according to the normalized age. In addition, by setting Oi to 0 colors are accumulated over one another in much the same way as is used by hardware rendering algorithms.

surface accum(varying float ageNormPP = 0)
{
    Ci = ageNormPP;
    Oi = 0;
}
 

Pixar Animation Studios
(510) 752-3000 (voice)   (510) 752-3151 (fax)
Copyright © 1996- Pixar. All rights reserved.
RenderMan® is a registered trademark of Pixar.