Per Particle Attributes

Per Particle - each particle has its own value

per particle

Static and Dynamic Attributes

- Static are there when you open the program
- Dynamic will need to be added - slows things down to have too many

Can add using the Add Dynamic Attribute button

dynamic attribute


Using Ramps:

Ramps are based on Lifespan of the particle - set your lifespan before beginning to use a ramp

Add a colorPP to a new emitter

Under Add Dynamic Attributes click Color

add color

Select Add Per Particle Attribute - click Add Attribute

per particle

Right Mouse down on the rgbPP field and select Create Ramp

create ramp

Right Mouse down on arrayMapper1.outValue1PP -> Edit Ramp

edit ramp

ramp attributes

The bottom of the ramp = birth - top = death of particle


Add an opacityPP to an emitter

Under Add Dynamic Attributes click Opacity

opacity

Select Add Per Particle Attribute - click Add Attribute

per particle

Right Mouse down on the opacityPP field and select Create Ramp

create ramp

Right Mouse down on arrayMapper1.outValue1PP -> Edit Ramp

edit ramp

Only the V value is used to determine the opacity - NOT hue or saturation

opacity ramp


Add a radiusPP to a Sphere Particle set

Create an emitter and change the Shading - Particle Render Type to Sphere

Under Add Dynamic Attributes click General

general attribute

Click the Particle tab

radius pp

Select RadiusPP and click OK

Right Mouse down on the radiusPP field and select Create Ramp
Right Mouse down on arrayMapper1.outValue1PP -> Edit Ramp

The ramp can be used to control the radius over time

The color is not important - the Value is



Black = 0, White = 1

Change Interpolation to Smooth

Can change other ramp Values to alter the distribution of values over time

To make the value greater than 1, select the color in the ramp and change the color mode to HSV and change the Value component (the H and S are ignored)

There are only 2 dynamic attributes that relate directly to the actual color - incandescence and color
All others look only at the value in the HSV (the V) or RGB box (the R) - not the actual color

Common attributes that only look at the V or R value are:

spriteScaleXPP
spriteScaleYPP
spriteTwistPP
mass
opacity
radius
lifespan - cannot control this with a ramp

To disconnect a ramp
To just disconnect it - Right mouse button on Attribute Array and Break Connection
To delete the ramp too - Right mouse button on Attribute Array and Delete Array Mapper

NOTE: Position, Velocity and Acceleration have their own separate Ramp attributes
(only set Position, Velocity, or Acceleration (if you set them all, you may have unpredicable behavior)


Component Editor:

Method 1:

Can be used to alter one or more attributes of a particle

1. Make an Emitter and add an RGB PP attribute to the particles

2. Right Mouse button click and hold on the particles and select Particle.

3. Drag to select some of the particles

***NOTE: Some particle attributes do not show up in Viewport 2.0. Try the legacy versions of the Viewport



4. In the Per Particle Array Attribute - RGB PP right mouse button and select - Component Editor...



5. Deselect - Options - Hide Zero Columns



6. Scroll to the right using the white ARROW to find the Particle tab and alter the values

7. To change all values of a parameter, click the header name and enter the new value and hit return

8. Change back to Object Mode when done - Right mouse button on the particles and select it


Particle Expressions

Definitions:

Scalar - A quantity with only one component; time and mass are scalar; ex. -3.5, 21
Vector - A quantity with three different values; color and position are vector; ex. <<10, 3, 55>>
Float - A number with a decimal point and something after it; ex. 13.643987542
Integer - A number with no decimal point; ex. 45
Boolean - A value that is TRUE or FALSE
Variable - A location in memory to store information. You define the name of it and can put things in it and get things out of it.

Creation Expression - When the particle is born (age=0), the expression is evaluated.

Runtime Expression - Evaluated each frame for each particle but not a birth.

Exercise PART 1:

1. Create two directional emitters and adjust them so they emit upward

2. Change them to spheres

3. Use Add Dynamic Attributes - Make a Per Particle Attribute for the Color

4. Hold the Right Mouse Button down on the rgbPP and select Creation Expression
This opens the Expression Editor

You write the expression in the bottom gray area.
type:

rgbPP = <<rand(1), 0, 0>>;


Click Create and close the expressions window

Quick tips:
- rand selects a number between 0 and the number you specify

- always end your statement with a semicolon ;

- the << >> means you will have a vector type value in there (3 values)

- the = is an assignment command - it puts a value from the right side into the left side

Other uses for rand:

opacityPP = rand(0.2, 0.8);

pick a number between 3.5 and 9 (opacity uses a float)

Exercise Part 2:

1. Select the second emitter and open the Attribute Editor

2. Make them spheres

3. Add a rgbPP attribute

4. Right mouse button on the attribute choose Runtime Expression

Type:

rgbPP= <<0.7, 0, rand(.35, 1.0)>>;

Click Create

Change into shaded mode and play it back


Exercise:

1. Randomize the OpacityPP on two new emitters (use Creation on the first and Runtime on the second particles).

NOTE: Opacity only takes a single float value between 0 and 1.

2. Change the radiusPP and lifespanPP using the previous technique. Each require float values.

Another script to change a parameter via expressions:

particleShape1.lineWidth= rand(1,1.3);

More scripts you may find useful: Writing Runtime Expressions

TUDelft Particle Expressions (its old but still useful):


To delete a dynamic attribute:
Select Particle
In the Per Particle (Array) Attribute, Right click and select Delete Attribute

delete attribute


Maya Expressions Sharing