Maya: Rigging for Unity 2019

This post is a collection of troubles, tips and tricks that I’ve learned while rigging characters in Maya for use in Unity. It serves as both a collection of “mini tutorials” and more generally what to do, and what not to do.

Tip 1: Keep the rig and skinned joints separate

Usually, I create a group in my rigs which only contains the geometry and the skinned joints. That’s all I want to export to Unity. Bake the joints before exporting, of course. The rig then controls the skinned joints with constraints, usually parent constraints.

The hierarchy usually looks something like this:

In the above I would only export the “unity” group.

Tip 2: Do not change rotation order of the skin joints

You can work around this limitation with empty groups and constraints. I’ve seen weird stuff happen, like arms suddenly going straight up into the air, and it all seemed to be because of a different rotation order.

So stick to the default XYZ!

Tip 3: Turn off “Segment Scale Compensate”

It will mess with you. Basically it means “whenever a parent joint is scaled up, the child joint is scaled equally down to maintain its scale”.

An easy way to do this is to select all your joints, open the “Attribute Spread Sheet” found in “Windows > General Editors”. Then do a search for “segment scale compensate” and turn it off for all at once!

Or you can run these three lines of code to do it for all joints in the scene:

import maya.cmds as cmds
for j in cmds.ls(type="joint"):
    cmds.setAttr(j + ".segmentScaleCompensate", 0)

Tip 4: Use multiple joints along places you want to twist

In Maya, we can use the fancy “dual quaternion” interpolation method when skinning, which would give us very nice deformation when twisting joints. But this is no good in Unity, here we have to stick to “classic linear”. This makes the mesh loose volume when twisting two joints.

To avoid this, we simply add more joints and distribute the twist between the main joints. By main joints I mean shoulder, elbow and wrist in an arm, for example. In this case I would probably add two additional joints between the shoulder and elbow, and elbow and wrist to distribute the twist.

Tip 5: Use blendshapes!

Though you may think blendshapes are a no-go, they can actually be quite useful and performant. Blendshapes are fast to evaluate in Unity, but does come at the expense of higher memory usage. Experiment and find the right balance for your project.

Tip 6: Max 4 influences when skinning

Currently, Unity does not support more than 4 influences when skinning. If you use skinning tools like ngSkinTools, also be sure to limit the maximum influences there, as it will otherwise smooth skinning between several joints. Simple, but very important.

Tip 7: Humanoids?! Follow the Mecanim guidelines

If you would like to use Mecanim to transition, blend or even retarget animations of humanoid characters, you must follow the guidelines: https://docs.unity3d.com/Manual/UsingHumanoidChars.html.

You can always add extra joints for stuff like hair, bagpacks etc. but the core hierarchy must follow those guidelines.

Unity advices that you model in a T-pose, though I would say “it depends”. Generally, if your character’s arms are down 99% of the time, then you would get far less distortion by modeling the arms more down. There is some interesting information from Naughty Dog on the subject: https://youtu.be/myZcUvU8YWc?list=PLwJXRjN89etsZG5GHDM5Ucako9BxCkhv7.

Write a comment