Particle Systems Lecture Notes 4 (Per Particles)
syllabus | schedule | assignments | ARTC courses
Per Particle Attributes vs. Object Attributes
      Per Object - one value for all particles
      Per Particle - each particle has its own value

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

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

Altering Per particle Attributes:
      You cannot key PP Attributes
      Position, Velocity and Acceleration have their own separate Ramp attributes
      (only set Position, Velocity, or Accelation (if you set them all, you may have unpredicable behavior)
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
      Select Add Per Particle Attribute - click Add Attribute
      Right Mouse down on the rgbPP field and select Create Ramp
      Right Mouse down on arrayMapper1.outValue1PP -> Edit Ramp

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

Add an opacityPP to an emitter
      Under Add Dynamic Attributes click Opacity
      Select Add Per Particle Attribute - click Add Attribute
      Right Mouse down on the rgbPP field and select Create Ramp
      Right Mouse down on arrayMapper1.outValue1PP -> Edit Ramp

Only the left most pixel along the V direction is used      -      only the greyscale value is used

Add a radiusPP to a new emitter
      Under Add Dynamic Attributes click General
      Click the Particle tab
      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 RGB and change the R component (the G and B are ignored)

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

Attributes that only look at the R value are:
      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
Component Editor
Method 1:

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

Make an Emitter and add an rgbPP attribute to the particles
Select the Select by Component tool and Select a few particles
Window - General Editor - Component Editor
Deselect - Options - Hide Zero Columns
Alter the values

Method 2:

Right mouse button in the Per Particle (Array) Attribute columns
Select Component Editor
Select your particles - using the select by components icon then click the Particle tab
Deselect - Options - Hide Zero Columns

Can select a row or column and enter a value and hit return to change all values
This changes the value on the first frame - if nothing changes the value, it will stay the same.
Particle Expressions
      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.

      Create two directional emitters and adjust them so they emit upward

      In the Attribute Editor change them to spheres
      Make a Per Particle Attribute for the Color
      use Add Dynamic Attributes - it makes a rgbPP attribute

      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 number in there (3 numbers)
      the = is an assignment command - it puts a value from the right side into the left side
Other uses for rand:
      lifespanPP = rand(3, 9); pick a number between 3 and 9 (lifespan uses a float)

Select the second emitter and open the Attribute Editor
       Make them spheres
       Add a rgbPP attribute and Right mouse button on the attribute
             choose Runtime Expression
             rgbPP= <<0,0,rand(1)>>;
      Click Create

Change into shaded mode and play it back

Setting the render type to see the attributes:
      Select the particles and in the Attribute change the Render Type to Numeric

      Click the Add Attributes for
      Enter age in the box instead of particleID - Age goes from 0 to 1 (birth to death)
      Can use position, lifespan, mass, opacity, rgbPP, velocity (some attributes have to be added to work)

* Randomize the OpacityPP on two new emitters (use Creation on the first and Runtime on the second particles). Opacity only takes a single float value between 0 and 1.

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