Collar rig with joints and cMuscleKeepOut nodes

Hi guys, almost a month ago I posted this rig test for a collsion setup I made for a character I was working on.

The rig is joints based, therefore would be suitable for game animations. I couldn't use the same asset but I created another one for the purposes of this tutorial. 

A basic knowledge of maya and rigging in is required. This is not a rigging and rigging practices tutorial, it is made specifically to cover the technique of using cMuscleKeepOut nodes in Maya. So feel free to take it and conform it to whatever practices and naming conventions you normally use in your rigging process.

I will break this post into 3 main sections. The curve setup, the collision setup and the joints setup. But before we proceed this is how the rig should look like in the end.


You can purchase the work files for $5 on Gumroad

 
 

Kiel Figgins kindly pointed out that the MayaMuscle plugin is not loaded by default in some cases so make sure you load the MayaMuscle.mll plugin in the Plug-in Manager.

Loading the MayaMuscle plugin.


The Curve Setup

1 - Create a nurbs circle with 8 spans and name it "collar_crv". 

Creating a nurbs Curve.

Nurbs Circle options

2 - Shape the curve along th einside o the collar. The curve vertices are the points of contact with our collision mesh so make sure they are placed where you would want the collision to happen.

Curve placement. The head is hidden for clarity purposes.

3 - Create a cluster for every vertix of the "collar_crv". In the riggging tab go to Deform>Cluster. 

Creating clusters

4 - We need an offset group for each cluster. Press CTRL+G the short cut for creating an empty group. Then select the group and the cluster and go to Modify>Match Transformations>Match All Transforms. Now the group is snapped to the cluster, you can parent the cluster to the group by selecting the clusterHandle and the group and press P or go to Edit>parent.


The Collision Setup

5 - Now we create our collision mesh. Most of the time I use Polygon primitives as collision shapes like a cylinder or a sphere, but in this case I will use a static duplicate of the head mesh and delete the faces I don't need to collide with the curve. Then parent the collision mesh to the neck driver. For demonstration I just parented it under the joint directly.

I chose in this case to use a duplicate of the head because his chin is quite prominant and it would be nice to have it collide against the collar.

6 - The last step for creatig our collision mesh is to selet the collision_head and go to Rigging>Deform>Muscle>Muscles/Bones>Convert Surface to Muscle/Bone.

7 - Select all the cluster handles groups and go to Rigging>Deform>Muscle>Self/Multi Collsion>Rig selection for KeepOut

8 - If you expand the cluster groups in the outliner you will see two transforms created on top of the cluster handles. The cMuscleKeepOut and the cMuscleKeepOutDriven groups. The cMuscleKeepOut node sets the local direction the cMuscleKeepOutDriven group moves when the collision happes. 

9 - Before we connect the collision mesh to the keep out nodes, lets set the In Direction values to avoid having our clusters jump to the wrong direction.
Select all the keep out nodes of the cluster handles on right side and set the In Direction X to -1 and the In Direction Y to -0.5. This way when the collision happens the cluster handle would move to the right twice as much as moving down.

10 - Select all the keep out nodes of the cluster handles on left side and set the In Direction X to 1 and the In Direction Y to -0.5.

11 - Select all the keep out node of the center cluster handle on the back of the collar and set the In Direction X to 0, In Direction Y to -0.5 and In Direction Z -1.

12 - To make the cMuscleKeepOut nodes collide with our collision head, select all the cluster handle groups and the collision head lastly and go to  Rigging>Deform>Muscle>Self/Multi Collsion>Connect Muscles to Keep Out.

13 - Now if you rotate the neck you should see the clusters moving the direction we set when colliding with the collision head.


The Joints Setup

Now we move to the final section of the rig which is adding the joints, attaching them to the collar curve and adding them to the jacket skin cluster. Depending on the mesh you have and your budget you can decide how many joints you can add. However, it is important to rmember this is not cloth simulation and there will be some areas in some animations that would require manual tweaking. Therefore we need to attach offset groups/ joints controllers to the curve instead of the joints themselves directly.

14 - Repeat the following steps the number of joints you would like to add to your setup. For this setup that will be 7 times:

  • Create a loctor at the origin and then group it.
  • Create a joint at the origin and then parent it to the locator.
  • Rename the joint to collar_01_jnt. Rename the locator to collar_01_loc and the group to collar_01_offest

PS: you can use any naming conventions you want, but for the sake of clarity I will refer to the locator group as the offset group.

This is the structure in the outliner:

15 -  In the NodeEditor create a pointOnCurveInfo node and check the Turn On Perecntage option in the attribute editor. Connect the collar curve shape worldSpace to the PointOnCurveInfo node inputCurve. Then connect the pointOnCurveInfo position to the locator offset group translate.

16 - Repeat the above step for every locator offset group.

17 - To place the locator offset groups and subsequently the joints we need to adjust the parameter value of every pointOnCurveInfo node we created. These are the values I used to place the offset groups like the following 0.00, 0.13, 0.3, 0.4, 0.6, 0.7, 0.87

18 - Finally, lets add the collar joints to the skin cluster by selecting all the collar joints and then the jacket mesh and go to Rigging>Skin>Edit Influences>Add Influence. Tweak the skinning so it is smooth but also test with animation to make sure the influences per joint is giving the desired result.


Final Result

If you rotate the neck joint/controller now you can see that the joints are following the curve and we still have the locator channels zeroed out for direct control over the joints. Happy Animating :)

Final notes: If you can only have very few joints lets say 4 or less, you can skip the whole curve setup and just rig the joints controllers as we did for the cluster groups insted.