Delanimation

Delano Athias - Animator

Retargeting Mocap to Custom Rigs in Maya

Here's a tutorial on retargeting mocap to a custom rig!

We also build a simple Python script to quickly create skeletons for retargeting.

Keep in mind that, even though Mixamo is used in this tutorial, the workflow is the same for other mocap solutions, i.e., Xsens, Rokoko, MoveAI, etc. This process can also be used for quadrupeds and other creatures!

from maya import cmds
'''
Create Joint Chain from Selected Transforms
Instructions: select transforms in order and run tool.
'''
#Variable to globally change radius in the code
rad = 2
#Create list to add a string to our new joints
jt_id = ['_tgt_jnt', '_src_tgt']
#Store selected transforms in variable "sel"
sel = cmds.ls(sl=True, type='transform')
print(sel)
#Create empty list
jnts = []
#For loop that iterates through items stored in "sel" list
for each in sel:
    #Create Joint at Origin
    cmds.select(cl=True)
    jt = cmds.joint(n=each + jt_id[1], radius=rad)
    #Add new joints to "jnts" list
    jnts.append(jt)
    #Align new joints to selection
    cmds.matchTransform(jt, each, pos=True, rot=True)
    #Clean up transforms on new joints
    cmds.makeIdentity(jt, apply=True, t=True, r=True, s=True, pn=True)
#Store the amount of new joints in a variable
jt_len = len(jnts)
print(jt_len)
#Parent new joints to create chain...
for i in range(1, jt_len):
    cmds.parent(jnts[i], jnts[i-1])