particle instance woes


#1

I’ve got a project where I need to fill chambers of a feather bed with feathers and down. I’ve created a particle system for each chamber, and got the particles to animate the way I want. Now I’m trying to instance the down objects and the feather objects to the particles. I’m having 2 problems.

First, I can’t get the particle system to assign a different object to each particle. The Maya Help documents say that “different object can be displayed at different particles”, but then offer no directions for accomplishing that. I’ve got all of the objects in the Instance Objects list. If I set the “cycle” attribute to “sequence”, then each particle cycles through different objects. I want each particle to be a different object, and then to remain that same object.

Second, I want each instance to be rotated differently. Here’s what the Help documents have to say:
“To rotate instanced geometry [ol]
[li]In the nParticleShape node Attribute Editor go to the Rotation section and turn on Compute Rotations. RotationPP is created on the nParticleShape node. [/li]
[li]Instance either a single object or sequence of objects as described in [Create animated instances](file:///Applications/Autodesk/maya2011/docs/Maya2011/en_US/files/Particles_Instance_geometry_to_particles_single_and_animated.htm#WS73099cc142f487553bd5b66812435c29801-5438).[/li][li]In the Particle Instancer Options window or the nParticle Attribute Editor, set the following: [/li][ul]
[li]Turn on Allow all data types. This lets you use scalar attributes, such as radiusPP, to set vector attributes such as Scale. [/li]
[li] In the Rotation Options section, select rotationPP from the Rotation list.[/li][li]In the General Options section, select radiusPP from the Scale list. Selecting this ensures that your instanced geometry will be appropriately scaled to nParticle Radius. See [Radius](file:///Applications/Autodesk/maya2011/docs/Maya2011/en_US/files/WS1a9193826455f5ff-2ade9d9118a20d4f81-d59.htm#WS1a9193826455f5ff-2ade9d9118a20d4f81-d56).”[/li]
[/ul]
[/ol]
Doesn’t work. I’ve done this exactly, to no effect. No matter what I do, all the instanced objects have exactly the same rotation.

Anybody have any suggestions. I’m up against a deadline (surprise, surprise) and am getting nowhere.


#2

In order to have a different instanced object per particle, you need to create a per-particle attribute on your particleShape, and then add this expression in the creation expression :


 particleShape1.attributeNamePP  = id % numberOfObjects;
 

Obviously with attributeNamePP replaced by the attribute name and the numberOfObjects replaced with the number of different object hooked up in you instancer node.

As for the rotations, the explanation provided by the help of maya should work, but if it doesn’t you can always create a rotPP attribute (a per-particle vector attribute) on you particles and enter this in the creation expression :


 particleShape1.rotPP = <<rand(360), rand(360), rand(360)>>;
 

And then hook that up to the rotation attribute in the instancer tab of your particleShape.

Hope that helps,
Baalz


#3

Baalz-

Thanks for the suggestions. Bit of a problem. I don’t know much (if anything) about expressions. Here’s what I did, perhaps you can explain why it didn’t work.

I created a new attribute by clicking on the “General” button under the “Add Dynamic Attributes” tab, and named it “GeoPP”. Data type was float and attribute type was Per Particle.

I then attempted to create an expression in the expression editor.  I put in

Code:
particleShape1.GeoPP = id % numberOfObjects;

When I hit create, I got the following error:

Error: Attribute not found or variable missing ‘$’: numberOfObjects

As for the second suggestions, regarding rotation, I created a new attribute called rotPP and created the creation expression just fine. But I couldn’t figure out how to hook it up to the rotation attribute in the instancer. The rotPP attribute didn’t show up in the pull-down menu. So I tried adding the same expression to the already existing rotationPP attribute. I then selected rotationPP in the pull-down menu under “rotation”, but when I ran it, all the feathers still had the same identical rotation.

Any idea what I’m doing wrong?


#4

OK, first off, I’m an idiot. Didn’t read the second part about replacing “numberOfObects” with the number of objects in the instancer. So, I did that, and created the expression just fine.

But again, when I ran it, nothing different happened. I still just have the first object in the list appearing, with no rotation.

If I set “Cycle” to “Sequential” in the instancer, I still get every particle cycling through the list on every frame.


#5

I’m sorry I forgot to say that you have to connect your attribute geoPP to the Object Index on your particle’s instancer tab in order to cycle between the objects of the instancer. (If you can’t see the geoPP in the list, make sure you have checked Allow All Data Types).

For the rotations, after creating the expression, make sure you hook it in the rotations attribute of the instancer tab and that you left the Rotation Type attribute to None.

Hope that helps,
Baalz


#6

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.