Posts Tagged ‘ rigging

Joint scaling in Maya

I’ve made my fair share of rigs.  But being on the runtime side of CG development for the past seven years (previous to that I did a lot of game cinematics), I’ve been limited by the runtime engine tech available to me.  And mainly, the only thing the game engine respects are joints, and smooth bound mesh.  Occasionally you’ll get blendshapes, and if you’re lucky, joint scaling.  Only recently have I been able to start using joint scaling in my rigs (and thus have the non-proportional scaling of mesh be supported at runtime).  It would seem like a simple thing to implement.  But like most things I’ve discovered, it was a bit more complex than expected…

I understand there are many ways to approach a subject, so the below example is just the one I tried given the time I had.  I’d be interested to know how others have dealt with this:

Simple requirement:  Tentacle, say, 5 joints down its length.  You have a corresponding set of animation controllers (lets pretend they’re easily-pickable NURBS curves) that have a 1:1 relationship with the joints.  You have the animation controllers setup so that each child controller will follow along with it’s parents transformations (via a parent constraint), aside from scale (scaling a controller will ‘move’ the children, but won’t scale them).  This gives you the effect of localized scale for each controller, and each joint.  You have your joints parent and scale constrained back to each animation controller.  And you start testing:

So here’s our scene:

Our initial Maya Scene

Our initial Maya Scene

You can see we have five polygonal spheres, and they are smooth bound to each of the five joints.  There are five NURBS circles (the animation controllers), each of which has a parental group, both of which pivots live at the respective joint location.  The parental group of each curve is parent constrained to the previous controller, giving us a simple FK system for the animation controllers.  And finally, each joint is both parent and scale constrainted to their respective animation controller.

Let’s non-proportional scale an animation controller!

non-proportional fail

Huh?!?!  Every other sphere has some crazy deformations applied to it.

Ok, let’s turn off each joints “.segmentScaleCompensate” attr, and try non-proportional scaling it again:

.segmentScaleCompensate fail

Nooo…. no good at all.  Ok, let’s try unparenting all the joints from one another, and giving that a shot:

Success!

Hey, NOW we’re getting somewhere…

So it seems, at least with this method, you can’t have you joints parented to each other, and expect non-proportional scale to work.  I briefly tried some direct-connection methods with teh scale attrs, but didn’t get any better results.  Anyone else have a slick soluition, that lets you keep your joints parented?

Centering joints in edge loops

When I’m rigging, I will often create an initial ‘rig-skeleton’ that fits inside the mesh to be deformed. To speed things along, I first just rough in the joint positions by snapping them to verts.   But later I like to get them centered into a selection of verts, and usually that selection is some form of edge loop.

I wrote some mel that does this:

  • You pick a joint, and an edge on a mesh
  • The code detects the joint, and the edge
  • Based on the edge, find the edge loop
  • Convert the edge loop into a selection of verts
  • Find the average position of all the verts
  • Move the joint pivots to this new position
  • Reselect the joint, and the new vert selection.

You can find the mel code over on my Mel Wiki.