Animator's Guide for Mapping Mocap to a Rig
Kiel Figgins - 3dFiggins.com
Table of Contents
Overview |
Process |
Advanced Pole Vector Setup
Tutorial - Mapping Mocap to a Rig from Kiel Figgins on Vimeo.
Overview
This tutorial covers the basics of mapping skeletal mocap to a rig that doesn't involve using an existing script, a secondary program like motion builder, or aimed at tech artists remapping a library. Before starting, it's important to have a clear mindset about transferring skeletal data to various rigs, mainly that it's not an exact science and that comprises and clean up will be necessary. Unless the skeleton your mapping to was created from the same rig, expect that the results won't be one to one. The main goal of mocap, to me at least, is feet plants and weight shifts, so this tutorial works with that in mind. The legs are mapped in IK while the upper body and arms are in FK. This works well unless you have specific two handed motions like holding a staff, but again that's one of the comprises. Another thing to realize is that once the mocap is mapped, the mocap skeleton is still in the scene to help you clean up and compare your results to the original.
This tutorial also covers a more advanced setup for finding the pole vectors so they're a bit more animation friendly. However, the setup is optional, as it is a bit more complex and a certain amount of rigging or scripting knowledge is assumed.
The two assets used in this tutorial are a free spiderman rig you can download at 3dFiggins.com/Store and a free motion capture clip from Mixamo.com
To help follow along, you can download the scene files (Maya 2014) Basic Setup, Advance Pole Setup, Mocap Clip
Process
1) Create a new scene
2) Reference in the character rig
3) Import the mocap file
4) Set timeline to length of mocap
5) Go one frame before the mocap starts
6) Turn on autokey
7) Select the root joint, highest in outliner or hierarchy of the mocap skeleton
Img 0 - Initial Scene Setup (click to enlarge)
8) Skeleton > Assume Preferred Angle, this will set the skeleton into a type of t pose
9) Orient and reposition the root joint so that the skeleton is oriented like the rigged character, make sure the centre line is accurate and the feet are standing on the same plane as the rig's feet
10) Orient the limb joints that may be skewed. Depending on how the skeleton was setup, they may be really misaligned
11) Adjust the scale of the mocap by grouping the skeleton, rename this group scale grp, scale this group to the size of the rig. Depending if the mocap has a mesh constrained to it, you may want to put the mesh under the scale group as well so it scales accordingly. If the mesh is skinned to the joints you shouldn't group it as it will inherit double transforms
12) To keep the outliner clean, group the scale grp and any remaining mocap elements, call this group, mocap_elements. If you have multiple mocap clips in your scene, it helps to add in a brief description in the name such as, mocap_punch_combo_elements
Img 1 - Initial Mocap Scale (click to enlarge)
13) Aligning the rig to the skeleton is a bit involved but once you do it a few times and see the end results you'll start to find your preference. You can align the skeleton to the control rig or vice versa. I typically adjust the rig to fit the skeleton since I'm more comfortable adjusting controls
Since the controls are going to be baked out, you can save a step by setting the desired limb spaces at this stage
If possible turn on the visibility of the rig joints to help align the rig more accurately. On the rigs found from 3dFiggins.com/Store, on the world control there's a channel called jointVis, set that to 1. Once the joints are visible, turning on Viewport > Shading > X-ray Joints can help see the joints and the mesh at the same time
14) Make sure the skeleton legs are straight with a slight bend in the knees and the feet are flat on the ground
15) Scale the scale_grp so the skeleton pelvis is positioned at the rigs pelvis while the feet stay on the ground. You may need to raise the rigs body control to get a similar knee bend angle. When in doubt it's better to have the rig legs longer than the mocap legs so they dont hyperextend when baked out.
16) Parent constrain (maintaining offset) the body control to the mocap pelvis joint.
17) With the leg ik controls, align them to the mocap legs. The ankle position may not line up, that's okay so long as the feet are flat on the same ground as the mocap
Img 2 - Lower body aligned (click to enlarge)
18) Parent constrain (maintain offset) the pole vector controls to the knee joint (translate only)
For a more animation friendly pole vector, try this Advanced Setup
Img 3 - Knee Pole Vector Constraint Settings (click to enlarge)
19) Parent constrain (maintain offset) the ik foot controls to the mocap ankle joints
20) Mapping the toe can be done a couple ways, again depending on preference
20A) Copying the rotation keys from the mocap toe joint to the rigs toe channel. Though you may need to invert the animation curve
20B) Orient constrain the toe flap control to the mocap toe joint. On rigs from 3dFiggins.com/Store, there are manual controls for the toe flap, select the Ankle Pinners and set the manualPivCtrlVis to 1
21) Now that the legs and pelvis are lined up, the torso and arms may no longer line up, that's okay.
Img 4 - Initial Torso Misaligned (click to enlarge)
22) Orient constrain (maintain offset) the chest control to the chest joint, if the control is pretty close to the joint, you can parent constraint to inherit a bit more information.
23) Orient constrain (maintain offset) the clavicle control to the clavicle joint. If the rig only has IK shoulder controls you'll have to point constrain to the shoulder joint. If you have to point constrain, depending on the scale difference, the motion may inherit too much causing undesired results
24) For the arms it depends on how close the limb lengths are and if the hands need to be exact, such holding a rifle or some specific motion like a hand stand. Again, clean up will likely be needed either way.
24A) You can align and constrain the arm ik controls like you did with the legs
24B) You can orient constrain the fk controls if the arm lengths are to different. It's important to match the rig arm angles to the mocap arm angles for a more accurate transfer
24C) You could even do both and compare the difference with the built in ikfk blending in the rig
25D) Lastly you could map to the fk or ik and use the rigs ik to fk baking tools, if applicable, to transfer it to the other setup. Such a tool exists for the rigs from my store 3dFiggins.com/Store for free
Img 5 - Arm FK controls aligned and constrained (click to enlarge)
26) Most mocap doesn't have finger animation, but if it does, align the rig fk finger controls and orient constrain them to the corresponding joints. These FK controls on 3dFiggins.com/Store rigs can be found on the CTRL_L__Fingers control, either as FKFingerVis or indiv channel vis, such as thumbVis
Img 6 - Finger FK controls aligned and constrained (click to enlarge)
27) The head and neck is similar to the arms. If the lengths/pivots are close, parent constraint (maintain offset) the head control to the head joint and orient constrain (maintain offset) the neck base control to the neck joint
27A) If the lengths/pivots are too different, you'd want to orient constrain (maintain offset) the neck base and the head control to the corresponding joints. This leaves out the translation which may cause unwanted results.
28) Now that your rig is constrained to the mocap, scrub the timeline and see how it syncs up and if any connections were missed. This is also a good time to adjust your mocap to fit your scene, if say you want it timed later, slowed down or repositioned
Img 7 - Scrubbing to see rig in motion (click to enlarge)
If you are mapping multiple clips of mocap to your rig, such as game cycles, you can create a quick select set of the controls that have been constrained so you don't need to remember what to select later. To create this set, select the controls you've constrained, Create > Sets > Quick Select Sets, name them mocapControlsToBake. Now since you're rig is constrained to the skeleton, you can transfer the other mocap clips onto the skeleton without having to recreate the constraint setup. Then to reselect the controls to bake out with the new animation, Edit > Quick Select Sets > mocapControlsToBake
29) When your ready to bake the control rig, select the controls that have been constrained or the quick select set you've created
30) Set your desired frame range to bake
31) Edit > Keys > Bake Simulation > Option box
32) In the Bake Simulations Window > Edit > Reset Settings
33) In the Bake Simulations Window > Select 'From Channelbox'
34) Select the translate and rotate channels in the Channelbox
Img 8 - Bake settings to put Mocap on to the rig (click to enlarge)
35) Click Bake
Now the rig should work independently from the mocap. Here are a few tips to wrap up the transfer:
It can be tempting to delete the mocap at this stage, but I like to keep it in the scene while doing the initial cleanup to compare the transfer quality and make sure I'm not losing all of the nuance of the performance. It is also handy if you want to manually redo the feet/toe with a toe roll channel instead
Depending on how the rig was constrained there may be controls that have 360 values that may cause issues with twist joints. You can adjust the curves manually in the graph editor to remove this offset or use an animation layer
Baking the constraints doesn't delete the constraints, but when you delete the mocap skeleton, the constraints will be automatically deleted
Use animation layers to globally offset the rig, such as the head angle, or to spot fix limb penetration in the body
Advanced Pole Vector Finder
This setup makes the output pole vector a bit nicer when the animator picks up the scene. Instead of being driven entirely on the knee/elbow bend, it tries to find a half way point and keep a consistant distance from the bend joint.
Process
1) Create a locator named L_Knee_Shin_Finder
2) Parent L_Knee_Shin_Finder under the left mocap knee joint
3) Set all the channels of L_Knee_Shin_Finder to 0,0,0
4) Position L_Knee_Shin_Finder a bit infront of the knee but only on 2 axis so it stays on the bend plane of the leg
Img 10 - Initial Position of Advance Pole Vector Finder (click to enlarge)
5) Unparent L_Knee_Shin_Finder
6) Duplicate L_Knee_Shin_Finder twice times, rename them to L_Knee_Thigh_Finder, L_Knee_Half
7) Point Constraint (maintain offset) L_Knee_Half between L_Knee_Shin_Finder and L_Knee_Thigh_Finder
8) Parent Constraint (maintain offset) L_Knee_Shin_Finder to the mocap knee joint
9) Parent Constraint (maintain offset) L_Knee_Thigh_Finder to the mocap thigh joint
10) Create a locator name L_Knee_Base_Finder
11) Duplicate L_Knee_Base_Finder, rename to L_Knee_Pole_Output
12) Parent L_Knee_Pole_Output under L_Knee_Base_Finder
13) Point Constraint L_Knee_Base_Finder to the left mocap knee joint
14) Aim Constraint L_Knee_Base_Finder to L_Knee_Half with the following settings: don't maintain offset, aim vector 001, up vector 010, world up type Object, world up object mixamorig:LeftUpLeg (the mocaps left thigh joint)
Img 11 - Advance Pole Vector Aim Constraint Settings (click to enlarge)
15) Translate L_Knee_Pole_Output along tz to line up with L_Knee_Half
16) Group the locators, name the group Mocap_L_Knee_Pole_Setup
17) Parent Mocap_L_Knee_Pole_Setup under your mocap_elements group
18) Point Constrain the rig's left leg pole vector control to L_Knee_Pole_Output
19) Repeat for right side
Img 12 - Advance Pole Vector Setup (click to enlarge)
Other Opinions, Further References, Typos, and Grammar Issues please contact KielFiggins22@gmail.com