MayaMan Help Contents

# Particles

MayaMan provides support for Maya's particle system including the passing of data from the particle system to the shaders so that particleSamplerInfo can be supported, there are however a couple of differences between Maya's and MayaMan's interpretation of the particle data that you should be aware of.

#### Software .vs. Hardware

MayaMan makes no distinction between the two, all particle types are converted to the appropriate type and rendered in software.

NB: as of 1.2.51 the cloud type will be rendered with Air's Volume primitive. Previously it was interpreted as a sphere render and the same result can be obtained for backward compatability purposes by changing the particleShape to sphere.

#### Shading Caveats

Maya's default particle shader includes a volume shader inside an opaque surface, the intention is to not see the volume. Unfortunately the way MayaMan handles this causes the volume rather than the surface to be seen. If you're using an opaque surface then there should be no volume shader in the shading group you assign to the surface.

When present, the rgbPP and opacityPP values are placed into the rib and applied as the default color and transparency information for the shader thus resulting in easy to control color and opacity for each particle. Where Maya and MayaMan differ is the case where the surface shader has it's color or transparency information plugged into a shading network, Maya ignores the network and uses the particle values, MayaMan uses the shading network values... if you want the rgbPP and opacityPP to have an effect then the surface shader must not have networked color/transparency plugs.

#### RiPoints

When MayaMan is using RiPoints to emulate the Points and MultiPoints render types it will depart from Maya's screen space based interpretation of pointSize if, and only if, the particle shape has a radiusPP value in which case the points have a world size which is the product of the particle's entry in the radiusPP array and the current pointSize setting. PointSize is still rolled in so that you have a convenient (if limited in resolution) scale for the size.

#### Blur

Particles will now blur when either vertex blur or motion blur is enabled in the global blur switches. If both are enabled then vertex blur will override unless the permodel attributes are set to exclude the object from vertex blur.

In a few limited cases, multi-segment motion blur now actually works! Use cached particles, try to arrange it such that the oversampling causes cache entries at the same subframe times as mayaman will interrogate. For example, if you have 200% motion blur and oversampling is set to 2 then 4 segments works out well, more than 4 segments is meaningless as the underlying data is not there to support it, 3 segments would cause subframe sample times that don't line up with the cache entries, 2 segments would work but is under utilizing the subframe information available in the cache. Another example, for really extreme motion blur (ie 1000%) then a setting of 5 segments makes the most sense given the number-of-segments limitations that most renderers on the total number of segments allowable.

Multi segment motion blur is implemented for render type is sphere/streak/multistreak/point/multipoint. Note, only the translation component is blurred.

PRman users will probably want to have 'clampmotion' turned off which is available in prman as of 12.5, this is not the default. Air has no equivalent option which may result in particles being too bright just as they are born or die and apropriate steps may need to be taken in the shader to fade them off as their lifeSpan is approached.

#### Exporting Specified Attributes

When using custom shaders it may be useful to have access to the per particle attribute values. To do this turn on 'Force Export Of Some Per Particle Attributes' in the MayaManAttributes node attached to the particle shape. The 'Attributes To Export' is a space seperated list of attribute names to export. If the particle shape doesn't have those attributes then no additional data will be placed in the rib.

The data type used in the rib for vector attributes can controlled through the use of decorators on the end of the attribute names. If no decorator is supplied then MayaMan will guess... and usually pick color. To select a specific data type for a specific attribute append the following suffixes to their names (only in this text field, the attribute name itself remains unchanged).

Suffix | Meaning
_C | export the vector as a color
_P | export the vector as a point
_N | export the vector as a normal
_V | export the vector as a vector

Examples: ``

       foo_P          # export the attribute called 'foo' as a point
       bar_V          # export the attribute called 'bar' as a vector
       sev_N          # export the attribute called 'sev' as a normal
       col_N          # export the attribute called 'col' as a color

#### Shading Instanced Geometry

MayaMan extends the ability of the particleSampler node for use on instanced geometry. For renderers that support user attributes, MayaMan will insert attributes that indicate the age and particleId for the instance. Magic shaders can use a particleSampler's particleId and age output to individualize the look of each instance. Custom renderman shaders can access this data like this: ``

    	float particleId = 0;
    	attribute("user:particleId", particleId);
    	float age = 0;
    	attribute("user:age", age);

and then use those values something like this: `

    	color col = color cellnoise(particleId);
    	col *= clamp(age / 5, 0, 1);

` which will chose a random color for each instance then fade it in from black over the first five age units.

#### Rotation extensions for Spheres

Maya Sphere particles don't normally rotate.. but it would be nice if they would... to allow rotation of sphere particles in the rib MayaMan will look for and handle 6 per-particle attributes. This type of blur is controled by enabling vertex blur and the amount will be scaled according to the blur amount.

Per Particle Attribute | Usage
rotXPP | an angle (in radians) to rotate about the X axis, default is 0
rotYPP | an angle (in radians) to rotate about the Y axis, default is 0
rotZPP | an angle (in radians) to rotate about the Z axis, default is 0
rotLastXPP | the rotXPP value from the previous frame, used for motion blur
rotLastYPP | the rotYPP value from the previous frame, used for motion blur
rotLastZPP | the rotZPP value from the previous frame, used for motion blur

#### Radius and Rotation extensions for Blobbies

Each blob in renderman is actually represented by transformation matrix but maya only offers a single radius and position. To work around this limitation MayaMan will now look for and interpret 6 new per-particle attributes:

Per Particle Attribute | Usage
radiusXPP | an override for radiusPP but only for the X axis, default is radiusPP or, if missing, radius
radiusYPP | an override for radiusPP but only for the Y axis, default is radiusPP or, if missing, radius
radiusZPP | an override for radiusPP but only for the Z axis, default is radiusPP or, if missing, radius
rotXPP | an angle (in radians) to rotate about the X axis, default is 0
rotYPP | an angle (in radians) to rotate about the Y axis, default is 0
rotZPP | an angle (in radians) to rotate about the Z axis, default is 0

Likewise it maybe desirable to explicitly control __Pref data.

Per Particle Attribute | Usage
birthRadiusPP | an override for radiusPP for use in _Pref
birthRadiusXPP | an override for bitrthRadiusPP but only for the X axis
birthRadiusYPP | an override for bitrthRadiusPP but only for the Y axis
birthRadiusZPP | an override for bitrthRadiusPP but only for the Z axis
birthRotXPP | an angle (in radians) to rotate about the X axis, default is 0
birthRotYPP | an angle (in radians) to rotate about the Y axis, default is 0
birthRotZPP | an angle (in radians) to rotate about the Z axis, default is 0

#### Material Sharing On Instanced Particles

Sometimes memory will blow out when using PRman to render instanced particles... this happens because PRman can't always share the shaders and a copy gets made for every instance. If you are experiencing memory problems and the object being instanced has a shader that does not do 3d procedurals then assign the shader to the particle shape and invoke the 'Add Particle Shape Attributes' MayaMan menu entry. Then look in the 'Extra Attributes' section of the particle shape, you'll find that MayaMan has added a 'Propagate Materials` flag. Turning on this flag will cause the instanced objects that use the same material as the one on the particle shape to go into the rib with no material at all... and as a result they will then inherit the material from the particle shape... this can result in significant memory savings.

#### Air's Points As Sprites Rendering

Air 3.1.26 and later can render RiPoints as screen aligned patch objects, this is considerably more efficient than rendering general sprites. To use this feature you need to configure the particleShape to render as points and set the point size as required. Then, select 'Add Particle Shape Attributes' from the main mayaman menu. This will add some attributes to the extra attributes section of the particleShape one of which is 'Points As Sprites` which, when enabled, will add `Attribute "render" "string pointtype" ["patch"]` to the rib.

#### Air's Points As Spheres Rendering

Air can render RiPoints as spheres and this can be used in one of two ways. On a particle system that is set to render 'spheres', in this case the system will be written as an RiPoints primitive which can be significantly more efficient than rendering spheres individually.... this capability has been around since mayaman 1.2.36, as of mayaman 1.2.59 this flag will also apply to particle systems that are set to the 'points' render type. In this case each point turns into a sphere instead of a screen aligned hexagon. To use this feature you need to configure the particleShape to render as points and set the point size as required. Then, select 'Add Particle Shape Attributes' from the main mayaman menu. This will add some attributes to the extra attributes section of the particleShape one of which is 'Points As Spheres` which, when enabled, will add `Attribute "render" "string pointtype" ["sphere"]` to the rib.

#### Limitations

There is no way to explicitly turn on or off the export of a particular array. MayaMan does attempt to minimize the amount of data that it sends. If you see it sending too much or not enough please let us know.

Unless the particle system is cached the motion blur will only work properly if it's in backward mode.

#### Tips

Cache the particle system, if you're doing distributed rib gen rather than rib gen from start to end on a single machine then you should use a disk cache to avoid large runup penalties.

Don't have more array attributes than you need on the particle system.