Set nParticle attributes using expressions or MEL

The following table gives a summary of the nParticle shape node attributes you can set or examine in expressions or MEL. See About particle expressions

The attributes affect the particle object within which they exist. Note these issues:

Attribute Long Name (and Short Name)

Attribute long name (and short name) Description Data Type

acceleration (acc)

Sets the rate of change of velocity on a per particle basis.

vector array

age (ag)

Contains the number of seconds each particle in the object has existed since the first frame. This is a read-only attribute.

float array

attributeName*

Specifies the name of the attribute whose values are to be displayed at particle positions. By default, particle id numbers are displayed. Valid for Numeric render type.

string

betterIllumination*

Provides smoother lighting and shadowing at the expense of increased processing time. Valid for Cloud render type.

boolean

birthPosition

Stores the position at which each particle was born in the particle’s local space.

vector array

birthTime (bt)

Contains the Current Time value at which each particle in the object was created. This is a read-only attribute.

float array

cacheData (chd)

Turns on or off dynamic state caching for the object.

boolean

castsShadows (rsh)

Turns on or off the object’s ability to cast shadows in software rendered images. Valid for Cloud, Blobby Surface, and Tube render types.

boolean

centroidX, centroidY, centroidZ (ctdx, ctdy, ctdz)

Contains the X, Y, and Z elements of the average position of its particles. These are read-only attributes.

float

collisionFriction (cfr)

Sets how much the colliding particle’s velocity parallel to the surface decreases or increases as it bounces off the collision surface. This attribute is displayed as Friction in the user interface. It works on a per geometry basis.

float (multi)

collisionResilience (crs)

Sets how much rebound occurs when particles collide with a surface. This attribute is listed as Resilience in the user interface. It works on a per geometry basis.

float (multi)

collisionU, collisionV*

U and V positions of the NURBS surface where a particle collided in the current frame. For polygonal surfaces, the values are always 0. The values are reset to -1 at the start of each frame. Values change only in frames where collision occurs. These are read-only attributes.

float

colorAccum*

Adds the RGB components of overlapping particles. Also adds opacity values of overlapping particles. Generally, colors become brighter and more opaque as they overlap. To see the effect of Color Accum, you must add an opacity attribute to particles displayed as Points. Valid for MultiPoint, MultiStreak, Points, and Streak render types.

Note: For Viewport 2.0: You do not need to use the Opacity attribute to see the effect of Color Accum. However, combining the use of both attributes produces a more realistic glowing particle effect. The opacity of each particle is first multiplied by the Opacity value; then overlapping particles are added together. Lowering the Opacity value prevents the particles from appearing overly bright, resulting in a smoother effect.

boolean

colorBlue*

Sets blue component of RGB color. Valid for all render types except Numeric and Tube.

float

colorGreen*

Sets green component of RGB color. Valid for all render types except Numeric and Tube.

float

colorRed*

Sets red component of RGB color. Valid for all render types except Numeric and Tube.

float

conserve (con)

Sets how much of a particle object’s velocity attribute value is retained from frame to frame.

float

count (cnt)

Contains the total number of particles in the object. This is a read-only attribute.

integer

currentTime (cti)

Sets the time value for the particle object’s independent clock.

time

depthSort (ds)

Turns on or off depth sorting of particles for rendering. This prevents unexpected colors when you hardware render overlapping colored, transparent particles. Valid for MultiPoint, MultiStreak, Points, Streak, and Sprites render types.

boolean

dynamicsWeight (dw)

Scales the effect of fields, collisions, springs, goals, and emission on particles.

float

emissionInWorld (eiw)

When on, emission occurs in the world coordinate system. This is the default setting. When off, emission occurs in the emitted particle object’s local space.

boolean

emitterRatePP*

Sets the per particle emission rate.

float array

enforceCountFromHistory (ecfh)

In a soft body, if you change the original geometry’s construction history in a way that alters the number of CVs, vertices, or lattice points, Maya updates the number of particles of the soft body correspondingly.

boolean

event*

Contains the number of times each particle in the object has hit something. This is a read-only attribute.

float array

expressionsAfterDynamics (ead)

Sets whether expressions are evaluated before or after other dynamics.

boolean

force (frc)

Contains the accumulation of all forces acting on the particle object. This is a read-only attribute. If you use this attribute in an expression, first turn on expressionsAfterDynamics.

vector array

forcesInWorld (fiw)

Sets whether forces are applied to the object in world space or in its local space.

boolean

goalActive (ga)

For a goal object, turns each goal on or off. It has the same effect as setting the corresponding goalWeight to 0, except the animation processing is more efficient. This attribute works on a per object basis.

boolean (multi)

goalOffset*

Sets an offset to the world space position of the goal object.

vector array

goalPP*

Sets how much the particles try to follow the goal on a per particle basis.

float array

goalSmoothness (gsm)

Sets how smoothly goal forces change as the goal weight changes from 0 to 1. The higher the number, the smoother the change.

float

goalU, goalV*

Set the exact locations on a NURBS surface where the particles are attracted.

float array

goalWeight (gw)

Sets how much all particles of the object are attracted to the goal.

float (multi)

incandescencePP*

Sets glow color in conjunction with a software rendering Particle Incand Mapper Node (see Rendering.) Valid for Cloud and Tube render types.

vector array

inheritFactor (inh)

Sets the (decimal) fraction of velocity an emitted particle object inherits from an emitter.

float

inputGeometrySpace (igs)

For a soft body, this sets the coordinate space Maya uses to position point data provided by the input geometry to the particle shape.

integer

isDynamic (isd)

Turns on or off dynamic animation of the object.

boolean

isFull (ifl)

Contains 1 if an emitted particle shape is full, or 0 if not full. An emitted particle shape is full when the number of emitted particles equals the maxCount. This is a read-only attribute.

boolean

lifespan*

Sets when all particles in the object die.

float

lifespanPP*

Sets when particles die on a per particle basis.

float array

levelOfDetail (lod)

Scales the number of particles that can be emitted into the emitted particle object.

float

lineWidth *

Sets the width of streaking particles. Valid for MultiStreak and Streak render types.

float

mass (mas)

Specifies the physical mass of particles. Mass values affect the results of dynamic calculations. By default, each particle of a particle object has a mass of 1.

float array

mass0 (mas0)

Initial state counterpart to mass.

float array

maxCount (mxc)

Sets a limit on the number of particles the emitted particle shape accepts from an emitter.

int

multiCount*

Sets number of points you want displayed for each particle in the object. Valid for MultiPoint and Points render types.

float

multiRadius*

Sets radius of spherical region in which particles are randomly distributed. Valid for MultiPoint and MultiStreak render types.

float

needParentUV*

Turns on or off the ability to read the parentU and parentV attributes. If you add a surface emitter to a NURBS or polygonal surface, parentU and parentV contain the UV coordinates where each particle was emitted. You can use these attributes in expressions and MEL scripts.

boolean

normalDir*

Sets direction of normal for particles. Use with useLighting. Valid for MultiPoint, MultiStreak, Points, and Streak render types.

integer (1-3)

opacity*

Sets amount of transparency for all particles in the object. Valid for all render types except Numeric and Tube.

float

opacityPP*

Sets amount of transparency on a per particle basis. Valid for all render types except Numeric, Tube, and Blobby Surface.

float array

particleId (id)

Contains the id number of each particle. Valid for Numeric render type. This is a read-only attribute.

float array

parentId*

If you emit from a particle object, this contains the id of all particles that emit the particles. You can use the id to query the emitting object’s attribute values, for example, acceleration, velocity, and lifespanPP. This is a read-only attribute.

Note that if you use the MEL emit command to create the particles that emit, the parentId attribute of those emitted particles is always 0.

float array

parentU, parentV*

If you add a surface emitter to a NURBS or polygonal surface, these attributes contain the UV coordinates where each particle was emitted. To use these read-only attributes, you must turn on Need Parent UV in the emitter. You can use these attributes in expressions and MEL scripts.

float array

particleRenderType*

Sets render display type of particles, for example, Streak.

integer

pointSize*

Sets how large particles are displayed. Valid for MultiPoint, Numeric, and Points render types.

float

position (pos)

Sets the object position in local space coordinates on a per particle basis.

vector array

position0 (pos0)

Initial state counterpart to position.

vector array

radius*

Sets radius size of all particles. Valid for Blobby Surface, Cloud, and Sphere render types.

float

radius0*

Sets starting point radius for Tube render type.

float

radius1*

Sets ending point radius for Tube render type.

float

radiusPP*

Sets radius size on a per particle basis. Valid for Blobby Surface, Cloud, and Sphere, render types.

float array

rampAcceleration (rac)

Controls acceleration with a ramp. Any other animation of acceleration is added to the ramp-controlled acceleration.

vector array

rampPosition (rps)

Controls position with a ramp. Any other animation of position is added to the ramp-controlled position.

vector array

rampVelocity (rvl)

Controls velocity with a ramp. Any other animation of velocity is added to the ramp-controlled velocity.

vector array

rgbPP*

Sets color on a per particle basis. Valid for MultiPoint, MultiStreak, Points, Spheres, Sprites, and Streak render types.

vector array

seed (sd)

Sets the id of the random number generator of the associated emitter. This attribute works on a per object basis.

float (multi)

sceneTimeStepSize (sts)

Contains the value of the time difference between the last displayed frame and current frame. This contains 1 if you’re simply playing the animation or clicking the frame forward or backward button. If you click widely separated frames in the Time Slider, the attribute contains the difference in time between the two frames. This is a read-only attribute.

time (in current units)

selectedOnly*

Turns on or off display of id numbers only for selected particles. Valid for Numeric render type.

boolean

spriteNum*

Sets the image number index for a Sprite image sequence.

integer

spriteNumPP*

Sets the image number index for a Sprite image sequence on a per particle basis.

integer array

spriteScaleX, spriteScaleY*

Sets the Sprite X- and Y-axis image scale.

float

spriteScaleXPP, spriteScaleYPP*

Sets the Sprite X- and Y-axis image scale on a per particle basis.

float array

spriteTwist*

Sets the Sprite image’s rotation angle.

float

spriteTwistPP*

Sets the Sprite image’s rotation angle on a per particle basis.

float array

startFrame (stf)

Sets the animation frame after which dynamics (including emission) are computed for the object.

float

surfaceShading*

Sets how sharply the spheres of Cloud render type are displayed. Use a value between 0 and 1. A value of 1 displays spheres more distinctly; a value of 0 creates a cloudier effect.

float

tailFade*

Sets the opacity of tail fade. Valid for MultiStreak and Streak render types.

float

tailSize*

Sets the length of the tails for MultiStreak, Streak, and Tube render types.

float

targetGeometrySpace (tgs)

For a soft body, sets the coordinate space Maya uses to position point data provided by the particle shape to the target geometry.

integer

threshold*

Controls surface blending between Cloud or Blobby surface spheres. This is a read-only attribute.

float

timeStepSize (tss)

Contains the animation frame increment in current units. For example, if your animation is set to Film (24 fps), timeStepSize has a value of 1 (frame).

Keying or otherwise setting the Current Time value alters the timeStepSize. For instance, with a frame rate of 24 frames per second, suppose you set the Current Time to 0 at frame 0, and to 100 at frame 50. Because you’re compressing twice as much time between frames 0 and 50, the timeStepSize is twice as large, in other words, 2. This is a read-only attribute.

time

totalEventCount (evc)

Contains total events that have occurred for all particles of the object. This is a read-only attribute.

integer

traceDepth (trd)

Sets the maximum number of collisions Maya can detect for the object in each animation time step.

integer

traceDepthPP*

Sets the trace depth on a per particle basis.

float array

UseCurrentUVSet

Selects the UV set on the poly emitter that is used for textured emission effects. The same UV set is used for all textures attached to all textured emission effects (color/opacity and emission rate). If the UseCurrentUVSet option is selected, then the active UV set on the surface emitter is used.

boolean

useLighting*

Turns on or off whether scene lighting lights up particles. Valid for MultiPoint, MultiStreak, Points, Sprites, and Streak render types.

boolean

userScalar1PP userScalar2PP userScalar3PP userScalar4PP userScalar5PP

Predefined outputs for user-defined attributes used in Particle Sampler Info node.

float array

userVector1PP userVector2PP userVector3PP userVector4PP userVector5PP

Predefined outputs for user-defined attributes used in Particle Sampler Info node.

vector array

velocity (vel)

Sets speed and direction on a per particle basis.

vector array

velocity0 (vel0)

Initial state counterpart to velocity

vector array

visibleInReflections (rrl)

Turns on or off whether the object is visible in reflections when software rendered. Valid for Cloud, Blobby Surface, and Tube render types.

boolean

visibleInRefractions (rrr)

Turns on or off whether the object is visible in refractions when software rendered. Valid for Cloud, Blobby Surface, and Tube render types

boolean

worldBirthPosition

Stores the position at which each particle was born in world space.

vector array

worldCentroidX, worldCentroidY, worldCentroidZ (wctx, wcty, wctz)

Contains the world space X, Y, and Z elements of the average position of its particles. These attributes are a read-only attributes.

float

worldPosition (wps)

Contains the world space counterpart to position. This is a read-only attribute.

vector array

worldVelocity (wvl)

Contains the world space counterpart to velocity. This is a read-only attribute.

vector array

worldVelocityInObjectSpace (wvo)

Contains the local space equivalent to the object’s world space velocity. This is a read-only attribute.

vector array