Particle Extras

To attach geometry to particles:

1. Create an Emitter and set the Gravity and Air Density to 0 in the Nucleus

2. Create a small piece of geometry (or it can be a group) and the geometry can be animated or not

3. Select the geometry then the SHIFT click particles last then nParticles menu - Instancer Options

The Particles menu - Instancer Options look like this:


Name the instancer

Make sure the correct particles are selected in the Particle object to instance:

We will change any other settings in the Attribute Editor later

click CREATE

To apply rotation and other attributes to the geometry dynamically:

You must first write expressions to tell the geometry what to do:

First we need to add a Dynamic Attribute

Click General

Go to the New tab

Enter a variable name RotateMe in Attribute Name
select Vector
select Per Particle (Array)
click Add button

CLOSE the window

In the nParticle's Attribute Editor - Per Particle (Array) you will see your new attributes (note it is smart enough to make words out of your variable name. This because of the use of capital letters.

Right mouse button over the RotateMe and select Creation Expression


float $rotRand=rand(180);

select CREATE

Click Runtime before dynamics

Type: nParticleShape1.RotateMe +=5;

select EDIT or CREATE

Now we need to set up the Instancer to realize those settings are out there and to use them:

Open the Instancer (Geometry Replacement) from the Particles Attribute Editor - Instancer Nodes will be named the Name you gave it earlier.

In Rotation pull down and select RotateMe (not the Rotation Type) - look way down at the bottom.

TRY the Animation

Notice that the original piece of geometry is sitting still. Select it and change its visibility to Off in the channel box.



float $rotRand=rand(180);

Upon birth (creation) the variable $rotRand will get a random number between 0 and 180.
The new attribute called RotateMe is a vector (3 values) and will have the random number for each value.

nParticleShape1.RotateMe +=5;

At runtime (each frame) the value of RotateMe will increase by 5 (it takes the existing value and adds 5)

Exercise 2:

You can instance more than one piece of geometry to the same particles.

1. Create 4 pieces of geometry

2. Create an emitter and turn Gravity and Air Density to 0

3. Select geometry then the particles last

2. Select nParticles menu - Create - Instancer (no options necessary)

Add a Dynamic Attribute: General

New tab:

Data Type = float
select Per Particle (Array)

Name it GeometryIndex

Geometry Index


In the Per Particle Array of the Particle Attribute Editor, Right Mouse Button and add a Creation expression on Geometry Index

Type: GeometryIndex = id%4;


In the Instancer section, change Object Index to be GeometryIndex

Explanation: The modulus gives the remainder only from the division. This will result in 0, 1, 2, or 3. Each piece of geometry selected when you instance it to the particles gets an index number. The first will be 0. If you created 4 pieces of geometry, then the last will be 3. Each time you run the animation, on creation it will choose a piece of geometry to attach to the particle based on the modulus results.

Exercise 3:

Animation and Particle Instancing:

1. Create a simple fly (the annoying bug) using primitives. Use a sphere and two cubes.


2. Set the pivot points of the wings in the center of the body of the fly.
***HOLD the "d" key on a Mac when you move the pivot

3. Name the wings: leftWing and rightWing

4. Change your timeline to only show 5 frames

5. Select leftWing and shift click rightWing in the Outliner

6. Use Shift E to keyframe only the rotation of the wings at the following frames:
Tip: Use Middle Mouse button to go to a new frame without updating the animation

Frame 2 and 4 - wings straight
Frame 1 and 5 - rotate wings down
Frame 3 - wings up

7. With the wings both selected:

Go into the Graph Editor and View menu - Frame All (or hit f )

8. Select (in the Graph editor menu ) Curves - Post Infinity - Cycle

9. Close the Graph Editor

10. Change your timeline to 600 frames and try the animation

11. Make a grid of particles (nParticle Tool)

    Particle spacing = 12

    Placement: with text fields

    Min corner = -25, 0, -25
    Max corner = 25, 0, 25

12. Click your Cursor in the grey area at the top of the Persp Window - hit Enter

YOU MUST: Go to the Attribute Editor and Dynamic Properties
Click on: Ignore Solver Wind and Ignore Solver Gravity

13. Add Creation Expression to Position of the particles

    float $randY = rand(-3,3);
    float $randXZ = rand(-1,1);
    vector $offset = <<$randXZ, $randY, $randXZ>>;
    position = position + $offset;

14. Hit Create

15. Rewind the animation to the start over and over until you get enough dispersion

16. Fields/Solver - Initial State - Set for Selected

17. Delete the Expression & press Edit

18. Group all the fly parts and name the group (Edit menu - Hierarchy - Group) and name it "fly"

19. Select the fly group and then the particles in the Outliner - nParticles - Instancer - Options

20. nParticle Instancer Name = flyInstanced


21. Select the original dragonfly and Display - Hide - Hide Selection

Resizing the fly:

22. In the attribute for the Particles: (near the bottom)
Add Dynamic Attribute - General

    New: Attribute Name: bugScaler
    Data Type: Vector
    Attribute Type: Per particle (array)
    Add Initial State Attribute: ON


23. Make a Creation Expression for this new bugScaler attribute:

vector $scale = rand(1);
bugScaler = $scale;

Create or Edit

24. Open the Particles Tab in the Attribute Editor then find the nParticle Instancer section

25. Select General Options: Scale = bugScaler

26. Rewind or click Edit in the Expressions Editor till you like the sizes then :

Select the particles - Solvers menu- Initial State - Set for Selected

27. Comment out the code by putting a // in front of the lines (we do not need this any more)

28. Apply some fields to the particles

29. Play the animation - or playblast it.