Posts Tagged ‘ joint

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?

Auto Joint Orientations in Maya

I have this pet peeve:  Whenever I create joint hierarchies in Maya, it will automatically setup the joint orientation value for you (based on option set in the ‘Joint Tool’ tool settings).  That, is handy.  However, the last joint in the chain isn’t auto-oriented:   A joint’s auto-orientation is based on the vector between it, and its child.  So obviously, the last joint in the chain has no child, so it can’t use this system.  The result is, the last joint is always oriented to the worldspace global axis.  Which is almost exactly never what I want.

The workaround is easy, just make a little script to process all the joints in a selected hierarchy.  But it sure would be nice if they had an option to do this automatically in the UI….

"""
Eric Pavey - 2008-12-19
For the selected hierarchies, zero the joint orient values
on all leaf joints
"""
# Python code
import maya.cmds as mc

kids = mc.listRelatives(mc.ls(selection=True), children=True, type="joint", allDescendents=True)
for k in kids:
    if mc.listRelatives(k, children=True, type="joint") is None:
        for attr in [".jointOrientX", ".jointOrientY", ".jointOrientZ"]:
            mc.setAttr(k+attr, 0)
        print "Zeroed '" + k + ".jointOrient'"