plarson
I'd like to control nHair->pfx length based on bounding objects. Has anyone figured out a good way to do this? I have a series of hairs with pfx output.


Then what I'm doing is: follicles>transformsToArrays>pointCloudToMesh>attributeTransfer

Then pyExpression out float to the follicles.scaleZ

And with some code like this.
Quote:
import maya.cmds as mc

weight = mc.getAttr("attributeTransfer1.outWeightPP")

for i in range(len(OF)):

     OF[i] = weight[i]*1.5

 


But the pfx won't update, especially not while simulating the hairs, even tho the follicles seem to be getting scale values from the pyExp.

When I turn on the hairSystem's Dynamic Properties>No Stretch(clip post solve length) it seems to update correctly as long as their length doesn't extend beyond their length on frame 1. However No Stretch seems to be cutting off the tips of the hairs, resulting in some undesirable clipping when length is changing, which would not be good for animation.

Additionally, when I save the scene with No Stretch enabled, Maya crashes upon loading it.

Any ideas on updating the pfx(or whatever the issue is) without using No Stretch would be greatly appreciated. Or perhaps an alternative method?
Reply 0 0
pshipkov
Can you provide a scene ?
Reply 0 0
plarson
Sure, here's one.

Thanks.
Reply 0 0
pshipkov
sorry for the late response.

connectAttr attributeTransfer1.outGeometry pyExpression1.inMesh

that should do it.
Reply 0 0
plarson
No problem on the delay, and thanks for the reply.

With that connection, the pfx updates with changing weight values on frame 1. But over time with an animated bounding object, it isn't updating the pfx.

Something about how Maya averages the follicle scale values makes it so if you set the follicle scales X and Y to like 0.1 then it shows visually how scale Z is seemingly changing over time.
But not the pfxmesh.
Reply 0 0
pshipkov
Are you sure ?
I played the animation and then started moving the bounding object.
The PFX stroke reacted properly.
Reply 0 0
plarson
Hmm, yes. I've tried it a couple times, they only react to the hair dynamics, but length does not change. Strange. I must be doing something wrong.

When I connect attributeTransfer1.outGeometry to pyExpression1.inMesh directly I get a pyExp error about the object compatibility. With a meshShape node between I don't get the error. Should I do that some other way?
Reply 0 0
pshipkov
are you trying that on the same scene you posted here ?
i tried it there and it worked.
Reply 0 0
plarson

Yeah I actually went back and specifically tried that file, to make sure I hadn't done anything else to mess it up. When you animated the bounding object, the strands coil up short, or extend out based on the bounding falloff weight value? I only get that on frame 1, but not when keying+playing or interactive playback. Before the pyExp.inMesh connection I wasn't even getting any update on frame 1 tho.

I'm using the Nov 30 2012 build of SouP and a recent reinstall of pyExp. Could that be an issue? Thanks again.

EDIT: My post #11 below seems to have added some formatting to the thread that has screwed it up. But I can't seem to edit it out of the post. Could someone delete it and #12?

@noiz:

I've noticed that, but after playing with it for a while noticed some strange averaging that Maya is doing with those values. If you set Scale X/Y to 1 you can't see follicle scales change over time. If you set ScaleX/Y to like 0.1 you can. However for me, this length change doesn't seem to update the out curve/mesh without No Stretch being checked in the hair system.

Reply 0 0
noizfactory
Hey plars,

Even without the SOuP setup, if you try to keyframe the scale z of follicles, it doesn't update it on any frame besides the simulation start frame. So I think its a hair system limitation (I tried this in nHair too and seems to be the same).

-Sachin
Reply 0 0
plarson
glitched post
Reply 0 0
plarson
Edit
Reply 0 0
pshipkov
Weird - it does work here for sure.
What version of Maya do you use over there ?
Reply 0 0
plarson
I've been trying this on 2013.0 with nHair.

I just tried it in 2012 with non-Nucleus hair and it does work.
Reply 0 0
Reply