View Full Version : nParticle and Mass possible bug?

01 January 2011, 04:41 PM
I'm trying to create a pretty simple effect but am encountering a ton of wankiness with the nParticle system and fields with per particle mass.

I have a simple plane emitting nParticles, which fall (under the nucleus gravity) onto a larger plane a few units below, which I converted to an nPassive. This obviously works fine - the nParticles land on the bottom plane.

Then I add an air field in the X direction - works just as you'd expect; all the particles move in the X direction, and I can control their speed with the magnitude of the air field.

However, when I randomize the mass of the nParticles to make it so that the smaller particles are more affected than the larger ones (randomize radius and map the mass slider to radius - using only the built-in ramps) I am able to get the desired effect but it seems to break the system. changing the magnitude of the air Field does nothing - even setting it to 0, the simulation runs exactly the same. Furthermore, it ignores any new field I try to attach to it. These are all things that worked before I touched the mass slider.

I also tried a new scene and got the same behavior. Anyone know what's going on?

01 January 2011, 06:41 PM
Alright, I've been able to replicate it consistently more than 3 times.

The key is to set radius to a random value (by using randomID as radius input, and using a diagonal ramp) and then using radius as the Mass input, with a diagonal ramp. This gives the behavior that smaller particles move faster, but locks that behavior in, so that no changes to the field do anything.

After more testing though, I feel kind of stupid that I didn't realize the air field doesn't care how big particles are, or how massive they are - it affects everything equally. I read some of the documentation and the only field that even mentions mass is the newton field; but that one is very limited in its flexibility, especially compared to a volume axis field, for example.

So with that in mind, a more general question: how would you create a system where a field affects smaller particles more than the larger ones? I assumed this would be trivial, but it is not turning out to be, as the only attribute affected by mass is the drag.

01 January 2011, 07:49 PM
Well nevermind, I found an article explaining per-particle fields, so I can do it with an expression. Sorry for the unnecessary thread (although I think there still is a bug there, it just can be bypassed)

01 January 2011, 09:15 PM
The nParticle drag is affected by the air density and speed on the the nucleus node and is proportionate to particle mass( but not size ). However one can easily make the mass vary based on particle size. This drag/air model is internal to the nucleus evaluation and currently not affected by fields. Basically the lower the mass the higher the effect of drag. (drag is proportional to the difference between the mass of the air and the particle) Mass affects relative collisions and the only effect outside of collisions is air drag, which is really just the relative collision with the air molecules. The motion imparted by gravity is uniform regardless of the mass(unless there is drag involved). One could have mass affect non-gravitational attractions. For example a magnet would accelerate a heavy mass more slowly. However the fields currently ignore mass.

To get around this you can set the attributes of individual fields per particle. Create a float array attribute on the particle shape with the naming "field_attribute", for example:
Then set the value of this to the desired strength per particle. (based on the mass)


01 January 2011, 09:28 PM
Thanks Duncan, I did find some information online about the per-particle field and that is working fine. I guess I was wearing a physics hat when I assumed I could use an air field to affect less massive particles more, right off the bat.

I was pleased to find out there was a method to differentiate the field's effect, and that it worked with 2009 :)

CGTalk Moderation
01 January 2011, 09:28 PM
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.