nParticle rotation

573 views
Skip to first unread message

Gary Jaeger

unread,
Dec 4, 2013, 1:14:39 AM12/4/13
to maya...@googlegroups.com
I’m in the middle of trying to figure out how to channel nParticle rotation into krakatoa normals. But I realize I’m not exactly clear on nParticle rotation. Will nParticles rotate when affected by forces? Or do they need to collide before there will actually be rotation changes? 

Gary Jaeger // Core Studio
249 Princeton Avenue
Half Moon Bay, CA 94019
650 728 7060
http://corestudio.com

Duncan Brinsmead

unread,
Dec 4, 2013, 2:33:38 PM12/4/13
to maya...@googlegroups.com

The particle rotation is affected by collisions and self collisions. The force does not affect the rotation.  As well when not colliding particles will continue rotating based on the angularVelocityPP, which decays based on the rotationDamp. You can modify the angularVelocityPP to affect the particle rotations if desired, potentially by evaluating a field inside a particle expression, or a typical use would be to randomize in the creation expression.

 

For rotating smoke, as opposed to particle instancing, it can work to make the collide strength very low, and the particles large, overlapping and self colliding. This way the motion of nearby particles affects the rotation without being a hard collision, but instead a weak repulsion. We had also looked at implementing the rotation calculation for the liquid (sph) model, which is faster than self collisions and better for gaseous flows, but  I don’t think it currently affects the rotation( but I could be wrong).

 

Duncan

--
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maya_he3d+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Gary Jaeger

unread,
Dec 4, 2013, 4:41:53 PM12/4/13
to maya...@googlegroups.com
Great, thanks for that Duncan. It seems like the normalDirPP isn’t getting created by default for nParticles? we can create the attribute manually, but shouldn’t it be there by default? Krakatoa is looking for that attribute for it’s Normals. Thanks again.

On Dec 4, 2013, at 11:33 AM, Duncan Brinsmead <Duncan.B...@autodesk.com> wrote:

The particle rotation is affected by collisions and self collisions. The force does not affect the rotation.  As well when not colliding particles will continue rotating based on the angularVelocityPP, which decays based on the rotationDamp. You can modify the angularVelocityPP to affect the particle rotations if desired, potentially by evaluating a field inside a particle expression, or a typical use would be to randomize in the creation expression.
 
For rotating smoke, as opposed to particle instancing, it can work to make the collide strength very low, and the particles large, overlapping and self colliding. This way the motion of nearby particles affects the rotation without being a hard collision, but instead a weak repulsion. We had also looked at implementing the rotation calculation for the liquid (sph) model, which is faster than self collisions and better for gaseous flows, but  I don’t think it currently affects the rotation( but I could be wrong).
 
Duncan

Sent: Wednesday, December 04, 2013 1:15 AM
To: maya...@googlegroups.com
Subject: [maya_he3d] nParticle rotation
 
I’m in the middle of trying to figure out how to channel nParticle rotation into krakatoa normals. But I realize I’m not exactly clear on nParticle rotation. Will nParticles rotate when affected by forces? Or do they need to collide before there will actually be rotation changes? 
 
Gary Jaeger // Core Studio
249 Princeton Avenue
Half Moon Bay, CA 94019
650 728 7060
http://corestudio.com
 
-- 
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email tomaya_he3d+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email tomaya_he3d+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Duncan Brinsmead

unread,
Dec 4, 2013, 5:22:06 PM12/4/13
to maya...@googlegroups.com

NormalDirPP isn’t used by anything by default(if you are not using Krakatoa)… particles have no orientation unless one is doing stuff like instancing. And for that there are a variety of ways of defining orientation that don’t involve a normal. If one enables rotation it automatically adds rotationPP and angularVelocityPP. The simulation then updates these based on collision. One can then use the rotationPP to drive particle instancer rotation, if desired. I’m not familiar with the way the Krakatoa plugin works… if you are going from Maya to Krakatoa and want to pass the NormalDirPP you could create the attribute and set it in an particle expression based on the rotationPP(if you want to use the nParticle rotation feature to drive the rotation values). It’s a little math to get the normal from the rotation.

 

Duncan

Gary Jaeger

unread,
Dec 4, 2013, 5:39:01 PM12/4/13
to maya...@googlegroups.com
Thanks again, Duncan. I think the big thing for us is to get the particles rotating *without* collisions. So could we set an initial random spin to the particles? So then we could set the NormalDirPP to the rotationPP.
 
On Dec 4, 2013, at 2:22 PM, Duncan Brinsmead <Duncan.B...@autodesk.com> wrote:

NormalDirPP isn’t used by anything by default(if you are not using Krakatoa)… particles have no orientation unless one is doing stuff like instancing. And for that there are a variety of ways of defining orientation that don’t involve a normal. If one enables rotation it automatically adds rotationPP and angularVelocityPP. The simulation then updates these based on collision. One can then use the rotationPP to drive particle instancer rotation, if desired. I’m not familiar with the way the Krakatoa plugin works… if you are going from Maya to Krakatoa and want to pass the NormalDirPP you could create the attribute and set it in an particle expression based on the rotationPP(if you want to use the nParticle rotation feature to drive the rotation values). It’s a little math to get the normal from the rotation.
 
Duncan
 

Duncan Brinsmead

unread,
Dec 4, 2013, 7:47:22 PM12/4/13
to maya...@googlegroups.com

If you just want them to spin at fixed rates you could just drive the NormalDirPP directly with some expression. If you want to apply impulses to the angular momentum then using the nParticle generated rotationPP values could be useful, but the math to convert the rotation to a vector is a bit complicated. There might be an existing mel function to call that could do it, but I can’t remember.

 

Setting the angularVelocityPP to a random value inside a creation expression is easy:

 

float $rotSpeed = 2;

angularVelocityPP = <<rand($rotSpeed), rand($rotSpeed), rand($rotSpeed>>;

 

 

For a fixed rotation expression (not using the nParticle rotation feature) you could perhaps define create two per particle vector attributes, in addition to NormalDirPP:

upPP, and twistPP.

Then in a creation expression set them to be a randomized orthogonal pair… this creates a basis for your rotation:

 

Vector $v1 = <<(rand(2)-1),(rand(2)-2),(rand(2)-1)>>;

Vector $v2 = <<(rand(2)-1),(rand(2)-2),(rand(2)-1)>>;

$v1 = $v1/mag($v1);  // normalize

$v2 = $v2/mag($v2);  // normalize

upPP = $v1;

twistPP = $v1^$v2; // crossproduct vector is orthogonal to v1

 

Inside a runtime expression you could then just set your rotation vector using the age as follows:

float $rotSpeed = 2;

NormalDirPP = upPP *sin(age * $rotSpeed) + twistPP*cos(age*$rotSpeed);

Duncan Brinsmead

unread,
Dec 4, 2013, 7:48:30 PM12/4/13
to maya...@googlegroups.com

Note that I’ve not tested that expression… also “vector” should not be capitalized.

 

Duncan

 

From: Duncan Brinsmead
Sent: Wednesday, December 04, 2013 7:47 PM
To: maya...@googlegroups.com
Subject: RE: [maya_he3d] nParticle rotation

 

If you just want them to spin at fixed rates you could just drive the NormalDirPP directly with some expression. If you want to apply impulses to the angular momentum then using the nParticle generated rotationPP values could be useful, but the math to convert the rotation to a vector is a bit complicated. There might be an existing mel function to call that could do it, but I can’t remember.

 

Setting the angularVelocityPP to a random value inside a creation expression is easy:

 

float $rotSpeed = 2;

angularVelocityPP = <<rand($rotSpeed), rand($rotSpeed), rand($rotSpeed>>;

 

 

For a fixed rotation expression (not using the nParticle rotation feature) you could perhaps define create two per particle vector attributes, in addition to NormalDirPP:

upPP, and twistPP.

Then in a creation expression set them to be a randomized orthogonal pair… this creates a basis for your rotation:

 

Vector $v1 = <<(rand(2)-1),(rand(2)-2),(rand(2)-1)>>;

Vector $v2 = <<(rand(2)-1),(rand(2)-2),(rand(2)-1)>>;

$v1 = $v1/mag($v1);  // normalize

$v2 = $v2/mag($v2);  // normalize

upPP = $v1;

twistPP = $v1^$v2; // crossproduct vector is orthogonal to v1

 

Inside a runtime expression you could then just set your rotation vector using the age as follows:

float $rotSpeed = 2;

NormalDirPP = upPP *sin(age * $rotSpeed) + twistPP*cos(age*$rotSpeed);

 

Duncan

Reply all
Reply to author
Forward
0 new messages