Rigging shortcuts

While rigging, I have come up with a few little shortcuts I would like to share. In this blog I want to demonstrate three small techniques for building the result armature for your rig.

HumanIK for faster result armature

Maya 2018 came with more of a focus on the HumanIK feature for quickly building humanoid rigs. I instantly hated it.

It has a confusing UI, it creates rigs that are hard to analyse and customise and at first it seems like you have very limited control over the way the rig ends up.

I have since learned more about the system and it doesn’t seem so bad. For example, it is great for retargeting and mocap, as you can quickly create homogeneous rigs for many characters, even with different proportions and body types. The automatic tools are great (if used correctly). Nevertheless it is still not appropriate for every pipeline.

That doesn’t mean it is useless for those pipelines. I might even go so far as to say that every humanoid character should be created with HumanIK in part of the development. This is because of the Quick Rig tool.

The Quick Rig tool can automatically build a humanoid result armature in a single click (or a few more clicks if you want to perfect it). This analyses the shape of your model and intelligently places the joints. This results in correctly oriented and positioned joints for your character model. It doesn’t create small joints like fingers, jaws, toes, eyes etc, but it saves a lot of time on positioning and orienting your spine, head, arms and legs.

Quickrigging a character with one button.
HumanIK Quick Rig results (ignore the broken left arm, we won’t use it anyway since we will be mirroring them.)

Now this is great and all if you are using a HumanIK pipeline, but what if you aren’t? How can this benefit you?

Well this is where a script I wrote as a small side project comes in. It takes a selection of HumanIK joints, and uses them as a template to create regular old Maya joints, preserving default positions, orients etc. for super quick joint setup.

Here is the code, feel free to copy it and use it yourself:

convert_humanik (chik)
@author: Michael Stickler

select all of the joints in a humanIK rig, 
such as those created by the Quick Rig tool, 
then run the following code:

import pymel.core as pm
import convert_humanik as chik

import pymel.core as pm
def convert(selection):
    parents = {}
    copies = {}
    for joint in selection:
        name = joint.nodeName()
        parents[joint] = pm.listRelatives(joint, parent=True)[0]
        newjnt = pm.joint()
        pm.rename(newjnt, name)
        copies[joint] = newjnt

        snap_to(newjnt, joint)

    originals = {c: o for o, c in copies.iteritems()}
    for newjnt in originals:
            joint = originals[newjnt]
            pjoint = parents[joint]
            newparent = copies[pjoint]
            pm.parent(newjnt, newparent)
            print("{} has not got a parent in selection".format(joint.nodeName()))
            pm.makeIdentity(newjnt, apply=True)
def snap_to(obj, target, **kwargs):
    snap the first object to the target, can specify to limit to just translate or rotate
    translate = kwargs.setdefault("translate", True)
    rotate = kwargs.setdefault("rotate", True)

    if translate:
        point = pm.pointConstraint(target, obj)

    if rotate:
        orient = pm.orientConstraint(target, obj)

Using IK systems to fix IK system alignment

The polevector (green) is not co-planar (in line with) the joints (navy) that it will be connected to

While working on my rigging tools, I came up with a way to tweak the position of polevectors (PVs) in IK systems so they are perfectly co-planar with their joints. If the PV is not co-planar to the joints, they snap from their default positions when the polevector constraint is applied. I could have written an algorithm to calculate the coordinates of the closest point normal to the plane described by the 3 joint origins used in a simple IK system, however I realised that an IK system already does this.

What I decided to do was to create a temporary IK system, where the middle joint and the PV swap positions. Now they are perfectly co-planar, so we just need to delete the constraint and swap their positions again.

Now all that needs to be done is to delete the temporary IK joints and PV, and freeze the PV into its new position.

Here is a python script to automate this:

@author: Michael Stickler
repositions the polevector to be co-planar to the IK joints
select the joints, top, middle then end, then select the polevector
then run the following code:

import pymel.core as pm
import correct_pv

import pymel.core as pm

def correct(joint1, joint2, joint3, polevector):
    '''move the polevector to be coplanar with the IK joints.'''
    # new 3 joints
    sel = pm.selected()
    new1 = pm.joint()
    new2 = pm.joint()
    new3 = pm.joint()

    # snap n1 to j1, n2 to polevector, n3 to j3
    snap_to(new1, joint1, rotate=False)
    snap_to(new2, polevector, rotate=False)
    snap_to(new3, joint3, rotate=False)

    # snap polevector to joint2
    snap_to(polevector, joint2, rotate=False)

    # ik rp on n1-n3
    temp_ik = pm.ikHandle(sj=new1, ee=new3, sol="ikRPsolver")

    # polevector new hdl to polevector
    pm.poleVectorConstraint(polevector, temp_ik[0])

    # delete new eff, and hdl


    # snap polevector to n2
    snap_to(polevector, new2, rotate=False)

    # delete n1-n3
    pm.delete(new1, new2, new3)

    # reselect

Using IK systems to place finger joints

I have always found placing finger joints to be a minor annoyance in rigging. There are 20 joints on each side, each often needs to be scaled slightly different and positioned at slightly different angles, so isn’t easy to automate, or do quickly.

I was inspired by the previous shortcut and found a better way to position finger joints with less hassle.

Finger joints (we don’t care about scale)

First we need some joints, enough to build a finger (in most rigs this will be four joints including an end joint for the three sections of the finger below the metacarpals).

Now we can apply a temporary IK system with a polevector constraint to a locator. This gives us 3 points we need to think about. The proximal knuckle, the fingertip and a polevector to angle the finger correctly.

Then we can begin shifting the local x coordinates of the joints, starting with the finger tip to correct the scale of the individual phalanges (lovely word that) until we get a perfect finger. Keep in mind that adjusting each joint will affect the position of the others, so using the up and down arrow keys to pickwalk about the finger and making little tweaks is recommended.

Duplicate and repeat for the other fingers (which will need less adjustment since the scale will be closer.) Finally we just delete the constraints and freeze the new positions.

This method has the advantage that all of the joints will stay co-planar and knuckles will stay pointed in the correct direction, since we used the polevector. Another big bonus is that it doesn’t break joint orients which happens with other methods.

Thanks for reading, I hope this makes rigging less of a dreaded task for those of you who don’t like it, and for those of us weird enough to enjoy the process, please feel free to share your own tips and feedback.

Leave a Reply

Your email address will not be published. Required fields are marked *