Per-Particle Attributes Handling

As Golaem Crowd relies on Maya particles, it provides a lot of interfaces using Per-Particle Attributes (PPAttributes). A PPAttribute is a float/vector value which can be set on each particle of a particle system. When a particle system is created, each particle comes with a predefined set of PPAttributes (position, velocity, mass...) but it is also possible to add more and custom ones.

In Golaem Crowd, PPAttributes can be used to easily modify the behaviors, the triggers or the visual appearance (among other things) of one or several Entities.

Displaying the Value of a PPAttribute

With Golaem Crowd

Each Entity Type allows to previsualize Entities simulation in real-time in Maya's viewport. It also supports multiple PPAttributes display. In the Entity Surface Shape Attribute Editor / Display Per Particle Attributes panel, you can add the PPAttribute Names to display:

And in the viewport:

With Maya

Maya also offers a way to visualize particles as a Numeric Attribute. However, it only allows to display one PPAttribute in the viewport. In the particle system Attribute Editor / Render Attributes panel, switch the Particle Render Type to "Numeric", press the "Current Render Type" button and fill the Attribute Name field with the name of the PPAttribute to display:

And in the viewport:

Creating a PPAttribute

With Golaem Crowd

Using the Entity Type Attributes

Golaem Crowd allows you to attach Entity Type Attributes to Entity Types. Each Attribute has a name, a type (float or vector) and bounds to set its initialization value. Then, when a particle of an Entity Type is created with the Population Tool, for each Attribute of this EntityType, the Population Tool creates a PPAttribute respecting the parameters.

Example: Let's attach a new Attribute myAttr1 to entityType1 with the following parameters:


myAttr1 Attribute Editor

Now, each particle belonging to entityType1 and generated with the Population Tool will have a PPattribute named myAttr1 with an initial value picked randomly between 0. and 1.:

Notice that if you change a parameter of the Attribute, it is required to re-emit the particles using the Population Tool (you can use the replace checkbox to overwrite the existing particles).

With Maya

It is also possible to create a PPAttribute from Maya. In the particle system Attribute Editor / Add Dynamic Attributes panel / General:

It opens a new Window which lets you specify the name and the type (float or vector) of the PPAttribute. When creating a PPAttribute make sure you checked the "Per particle" radio button and the "Add initial state" checkbox:

By default, PPAttributes created with Maya have a value of 0.:

Setting the INITIAL Value of a PPAttribute

With Golaem Crowd

If your PPAttribute has been created with an Entity Type Attribute, refer to the Creating a PPAttribute with Golaem Crowd section above.

With Maya

There are two ways to set the initial value of a PPAttribute in Maya. One lets you gives a value manually for each particle (Component Editor), the other let you write a MEL expression to edit the particle procedurally.

With the Component Editor

See the Maya Documentation.

With a Creation Expression

It is also possible to write a MEL Expression to set the initial value of particles. In the particle system Attribute Editor / Right Click on the PPAttribute you'd like to edit / Creation Expression...:

It opens the Expression Editor in which you can write a MEL expression:

If your PPAttribute has been created with an Entity Type Attribute, its value is set when the particles are emitted. Thus, it is also possible to edit their initial value with Maya (either the Component Editor or the Expression Editor),

Changing the Value of a PPAttribute Dynamically

With Golaem Crowd

Golaem Crowd provides the ChannelOperator Behavior to easily handle and apply operations to PPAttributes during the simulation. In addition to be more efficient (in terms of performance) than MEL expressions, it can also be controlled with Triggers.

Example: Let's add an Attribute Behavior to entityType1 with the following parameters:

For each frame this behavior will be executed, it will increment the value of myAttr1 of 1. in the follwoing example, this behavior is started when the Entity in the orange zone (with the Zone Trigger) and stops when the Entity is out of the orange zone, we'll get the following simulation:

With Maya

It is also possible to write a MEL Expression to dynamically change the value of a PPAttribute. In the particle system Attribute Editor / Right Click on the PPAttribute you'd like to edit / Runtime Expression Before Dynamics... (or After Dynamics if you'd like your expression to be evaluated after the Maya fields):

It opens the Expression Editor in which you can write a MEL expression:

As the expression is in MEL code, notice that its evaluation for each particle may slow down your simulation