Complex UV Layout in Maya
Over the last couple of years UV layout in Maya has changed for the better. In this course we're going to be taking a look at some of those changes as we UV map an entire character
# 1 07-10-2015 , 02:24 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374

NURBS reversing direction when transformed

I've got a NURBS surface direction/normals question. I'm using the surfaces > extrude operation, style: tube, result position: At path. Pretty standard to get a circular profile extruded along a path.
Sometimes this comes in reversed, so that's fine I can just reverse it. But what I've noticed is that if the curve is moved or rotated in certain ways, the normals/surface direction will get flipped (see pics below).

I need the direction and normals to be constant, not flipping around as the curve is moved. I'm creating a simulation where the curve needs to be moving, I can't just delete history on the geo and move that.

Any ideas why this might be? It should be easy to replicate, just extrude a NURBS circle along a CV curve and then rotate the curve around. I'm surprised I haven't found any other references to this in my searching, though that could be my bad searching.

Attached Thumbnails
# 2 07-10-2015 , 03:02 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
I also notice that the vertex order is changing if it is a polygon mesh output, which I suppose makes sense, but that's the real problem-causer for what I'm trying to do.

# 3 07-10-2015 , 07:18 PM
PixalZA's Avatar
Lifetime Member
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
Interesting. I recreated the scenario and I kind of figured out when the surface direction flips. Imagine a plane parallel to the nurbs circle anchored at the first control point of the curve. The moment the second control point moves to the "other" side of the plane the surface direction flips.
Will it help to parent the circle to the curve?

Attached Thumbnails

Earth: The crazy asylum of the universe.
# 4 07-10-2015 , 07:42 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Thanks for verifying this. Unfortunately connecting the circle to the curve creates double transforms. I've tried selecting them both and rotating them together, but that didn't work.
Interestingly though, on a whim I put an orient constraint from the curve to the circle and that does seem to keep it in check. Not sure what the difference is.

However, I'm still not sure if that will work for me, as I'm basically simulating a dynamic curve, so the orient constraint won't be updating any rotation values.

I wonder if I can somehow query the relative rotation of the first two CVs? I'm trying to remember if there is a way to constrain a transform (like a locator) to a CV? The opposite of a cluster deformer.

# 5 08-10-2015 , 06:41 PM
PixalZA's Avatar
Lifetime Member
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
If one has the coordinates of the first two control points, is there some math function that one can apply to convert that into a "normal" that can hook feed into the circle normal?


Earth: The crazy asylum of the universe.
# 6 09-10-2015 , 06:11 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
I've made some progress on this. I've written an expression that gets the positions of the two cvs and controls the rotation of the nurbs circle.

Code:
//get world space positions of the CVs
vector $pos1 = `xform -q -t -ws curve1.cv[0]`;
vector $pos2 = `xform -q -t -ws curve1.cv[1]`;
vector $newVec = $pos2 - $pos1;

//calculate rotation
$rotation = `angleBetween -euler -v1 0.0 1.0 0.0 -v2 ($newVec.x) ($newVec.y) ($newVec.z)`;

//set rotation of nurbs circle
nurbsCircle1.rotateX = $rotation[0];
nurbsCircle1.rotateY = $rotation[1];
nurbsCircle1.rotateZ = $rotation[2];
It seems to work okay, aside from a weird error
Code:
Error: line 1: No object matches name: curve1.cv[0]
It's weird because the expression works. If I put a cluster deformer on the CV and animate its position, the nurbs circle will rotate. So far this only works with the circle lying flat (facing the y axis). I'm sure it could be made more robust. Now to see if it keeps the normals facing the right way!

# 7 09-10-2015 , 06:29 PM
EduSciVis-er
Join Date: Dec 2005
Location: Toronto
Posts: 3,374
Hmmm... I'm not sure this is going to work. It does fix the normals flipping, but as the profile rotates, so does the extruded shape and the rotation can get pretty extreme, so it creates some weird shakiness to the motion. I played briefly with parenting the profile to another control curve, which takes the expression, freeing the profile itself to be rotated just in the y axis to counteract this rotation, but I don't know how to compute what that counter-rotation might be.

I might have to look at something completely outside the extrude function.

Posting Rules Forum Rules
You may not post new threads | You may not post replies | You may not post attachments | You may not edit your posts | BB code is On | Smilies are On | [IMG] code is On | HTML code is Off

Similar Threads