Retarget with Shogun Post
Shogun Post's full retargeting pipeline enables you to create and solve motion capture data onto any custom FBX/USD biped.
You can use the resulting VSR file in Shogun Live and stream it to a game engine, or solve and export from Shogun Post for use in a CG app.
You can use either Shogun Post or the Vicon Retarget app for retargeting:
- Use Shogun Post for retargeting instead of Vicon Retarget if you want script the process, need to align the source skeleton to the target skeleton or change the bone lengths of your target skeleton to better match the source.
- Use the Vicon Retarget app if you need Joint Symmetry or Target Symmetry.
The current retargeting implementation is Phase 1 of a longer planned roadmap. Use the retargeting workflow as a first step in the retargeting process, and as a quick and easy way to get your custom characters driven by Vicon mocap.
See also:
Vicon Shogun 1.3 Post Tutorial - Retargeting Setup
Vicon Shogun 1.3 Post Tutorial - Retargeting Test
Vicon Shogun 1.3 Post Tutorial - Streaming Retargets into Unreal
Set up a retarget
To set up a retarget in Shogun Post, see the following information.
Retargeting terms:
- Source skeleton: Solving skeleton
- Target skeleton: Retargeting skeleton (game skeleton)
- Map pose: The pose that is used for mapping (creating constraints between the source (solving) and target (retargeting) skeletons and setting the offsets). For more information, see Map pose and best rig practices in Getting more from Vicon Shogun.
- Base pose: The pose of the skeleton when all keys are deleted and the rotation channel for all bones is set to zeros. It's defined by the pre-rotation, which is known as ‘joint orient’ in Autodesk® Maya®.
Create an optimal target skeleton
The following tips help you to ensure that your FBX, USD or VSR file works well as a target.
- Use pre-rotation, not keys
- Pay attention to degrees of freedom (DoFs)
- Be aware of dummy bones
- Know what's above the root bone
- Know how to use scaling
Use pre-rotation, not keys
It's best to define the base pose of a skeleton using pre-rotation, not keys.
If keys put the skeleton into a T-pose, A-pose, or another suitable pose, and pre-rotations don't exist, you can still use the skeleton, but you'll need to know what the base pose looks like and use the map pose to both retain the pose used for mapping and to get best results. See About map mode and, if your skeleton uses keys rather than pre-rotations, see also Map pose and best rig practices in Getting more from Vicon Shogun.
Pay attention to degrees of freedom (DoFs)
Most skeletons have Degrees of Freedom (DoFs), and generally, skeletons work best when they have them.
- FBX files: After you import an FBX, check that the DoFs are set correctly before setting up retargeting.
- USD files: The USD format doesn't currently support DoFs. If you want to use DoFs with a USD skeleton, set them in Post after importing the USD skeleton.
Be aware of dummy bones
End joints that are dummy bones (bones with zero DoFs) are ignored by retargeting in that any keys they may have aren't retained and a map pose isn't stored for them.
- For extremities like the ends of hands, toes, and fingers, this is fine because the end bones must be zero DoF dummy bones with no keys.
- For parts of a skeleton that define things such as face, hair, and clothes, this can be problematic if these bones don't use pre-rotation to define their base pose. If you use keys to define a pose that is required for the skin to look right, note that these keys are not stored in the VSR/map pose because all of these bones are treated as dummy bones. If they aren't dummy bones already, change them to dummy bones because they have no data and setting them to dummy bones enables retargeting to ignore them and therefore to run faster.
To convert unused bones to dummy bones in Shogun Post, either:
- If your bones have pre-rotation values that you want to keep, note their values. In the Subject Setup panel, on the Retargeting tab, click the Prep Unused Bones button. This ensures all unused bones have zero DoFs and moves their rotations from channels to pre-rotations. You can enter the pre-rotation values that you noted to manually reset them.
or
- Manually set the DoFs to off. To do this, in the table on the Retargeting tab, select the bones you want to be dummy bones and clear the Active check box.
Know what's above the root bone
The following sections troubleshoot root bone issue on import and on export.
On import:
Sometimes, skeletons in CG apps like Autodesk® Maya® or Autodesk® MotionBuilder® contain one or many bones, locators, groups, etc, above the root. Generally Vicon Shogun doesn't support this. Aim to have no extra nodes between the Retargeting node and the root bone in Shogun Post. Dummy bones can exist above the root. These must have zero DoFs and the root must have six DoFs. If this isn't already the case on import, in the Target Root field, specify the correct root, which switches DoFs.
On export:
In Shogun Post, on the Retargeting tab, you can select or clear the Preserve dummies above root check box, which controls whether the dummy bones above the root are exported in the VSR.
If any objects above the root have non-zero transforms, they can be successfully imported in FBX format, but you'll probably need to modify the hierarchy in Post to set them aside during setup. If you need them to exist in the exported FBX because it will be merged into the original file, you must restore the hierarchy to its original form after you finish retargeting. You can create export scripts to do this via batching.
Know how to use scaling
Scale (values in the Scale channel) is not supported on bones or anything above them.
Retargeting enables you to scale each joint so that it better matches the source skeleton. You can revert this back to the original scale on export, if desired (see Export FBX).
Import the target skeleton into Shogun Post
You can import the target skeleton as an FBX or USD file, or VSR, if a setup already exists. Ideally the imported file will contain just the skeleton and skin and as little else as possible.
To import the target skeleton:
- In Post, open the relevant .MCP file and ensure that the required solving skeleton is selected in the Current Subject field.
To check that no target skeleton has been imported, open the Subject Management panel.The Retargeting column displays a red circle, indicating that no retargeting setup is present.
For more information on the Subject Management panel, watch Vicon Shogun 1.3 Post Tutorial - Subject Management on YouTube.
- Do either of the following:
- In the Subject Setup panel, select the Retargeting tab, click the Load button and select the required target.
Or - Drag the target skeleton file into the Shogun Post view pane.
When you are prompted, choose Skeleton.
- In the Subject Setup panel, select the Retargeting tab, click the Load button and select the required target.
The target skeleton is imported into the current subject hierarchy with the topmost bone of the target skeleton parented to a Retargeting node.
When you import an FBX, it sometimes isn't added under the Retargeting node. In this case, manually parent the skeleton to the node (select the required nodes and on the Objects menu, click Parent).
Prepare the skeleton before posing
- Hide any unnecessary joints. To do this, select the bone, and in the Attributes panel, clear the Showing box.
- On the Retargeting tab, click Map Mode (see About map mode) to enable this mode.
This creates a separate clip that you use to pose the target skeleton relative to the source skeleton. - In the Target Root field, specify which bone is the root. This ensures the root has six DoFs and any bones above it have zero DoFs.
- Confirm the target skeleton's DoFs were imported or set them as required.
- If the source and target skeletons don’t have roots in the same position or have differing orientation, on the Retargeting tab, click Align Skeletons.
Shogun Post tries to put the skeletons into the same positions and root pose.
You can more closely align the skeletons using the Translate and Rotate manipulators (not the Special manipulator).Be sure to move the root, not any dummy bones above it.
- If you need to globally scale the target skeleton to be the same size as the source skeleton, on the Retargeting tab, change the Target Scale value. Ensure that the ankles and clavicles in the target and source skeletons match.
About map mode
The process of creating the constraints between the source (solving) and target (retargeting) skeleton and setting the offsets is called mapping. Before mapping, both skeletons must be in the same pose. This involves posing the target skeleton to match the source (which is its base pose) and you do this in map mode. First you pose the target, then you create the constraints. At the time a constraint is created, its offset is calculated. The offset is the difference in pose between the source and target.
If you need to tweak the setup, or just check how it was set up, you can return to map mode. When making any adjustments, the target must be in the same pose it was when it was mapped. The map pose makes this possible. If constraints exist, implying a map pose is likely to exist, entering map mode automatically places the target skeleton in the map pose. If needed, you can also use the Go to Map Pose button (on the Retargeting tab of the Subject Setup panel) to set the retarget skeleton's pose to the map pose.
After you've finished posing, to define the map pose, click Set Map Pose.
In addition to restoring the pose you used for mapping, the map pose is also useful for retargeting. Retargeting is faster and easier if the map pose is set because it uses the map pose as a starting point instead of the base pose, which, for some skeletons, may differ widely from the map pose.
Pose the skeleton
- Make sure that the target skeleton is keyed in the same pose as the source skeleton.
- Start with the root. Make sure that you’ve selected the actual root and not any dummy bones above it. Using theTranslate and Rotate manipulators (not the Special manipulator), move it to the same place as the source skeleton.
- Use the Rotate manipulator (or enter values in the Channels panel) to rotate all the target bones to the same pose as the source skeleton.
Note you can also rotate the source skeleton to match the target skeleton or a mix of the two. - If you need to change bone length to make the target skeleton exactly the same proportion as the source (assuming your pipeline both allows this), use the Special manipulator. Note that you must remove the GlobalScale retargeting parameter. This removes the ability to perform global scaling and unscaling (using the Unscale button), so ensure you've scaled your target skeleton first.
- When you have finished posing the skeleton, in the Subject Setup panel, on the Retargeting tab, click the Set Map Pose button to store the matching pose. If you later modify the pose, remember to click this button again so that the map pose is updated.
Create constraints
- CTRL+T creates a retargeting constraint between the selected solving and retargeting bones, or a solving constraint between the selected solving bone and marker.
- CTRL+R creates a retargeting rotation constraint between the selected solving and retargeting bones.
- In the lists on the right of the Retargeting tab (or anywhere else in Shogun Post), select a matching source and target bone, then click Add Position or Add Rotation to create a constraint between them. The order of selection does not matter.
- As a starting point for the constraints, add a position on hands, feet and hips; and rotation on all joints.
If your target skeleton has more joints than the Vicon source skeleton, you can constrain multiple target joints to the same Vicon source joint.Tip: You can use HSL scripting to speed up creating constraints. For information and examples, see attach in HSL scripting with Vicon Shogun.
Another way to speed things up is to mirror the changes you make to one side of the source and target skeletons onto the other side. See Mirror constraints and Mirror joint manipulation. -
You can alter multiple constraint weights in the table on the Retargeting tab.
To enable you to immediately see the changes you're making, in the toolbar at the top, ensure the Enable interactive retargeting button is selected (green).
You can also select or clear Active to turn constraints on or off. - To check targets, ensure that the View Filters option for Constraints (for Retarget) is selected.
-
Set weights for all rotations. The recommended value for Rotation weights is 200. To set multiple rotations to 200, on the Retargeting tab, drag to select the required rows in the table and then in the Weight column, set the value of one of them to 200.
All the selected rotation weights are updated to 200.Tip: If you want to automatically copy your changes to weights from one side of the skeleton to the other, ensure the Mirror Weight Changes option is also selected (see Mirror weights).
- To add keys, select the relevant line(s), right-click and select Set Key.
To fine-tune keyframes, you can use the controls in the Graph view. For example, you can use the right-click (context) menu in the Graph view to to cut or insert sparse keys. You can also change the time of a key by clicking and dragging on the Graph view. - To save the VSR mapping file, at the top right of the Retargeting tab, click the Save button.
By default, VSR files are saved to C:\Users\Public\Documents\Vicon\Retargets.
For information on the relevant HSL commands, see the following commands in HSL Scripting with Vicon Shogun.
Mirror constraints
To make the creation of retargeting constraints faster and less error prone, you can choose to mirror the changes you make to one side of the source and target skeletons onto the other side.
The same option enables you to mirror edits to retargeting constraints.
To mirror retargeting constraints:
- In the Subject Setup panel, click the Regargeting tab.
- When you create or edit retargeting constraints, at the top of the Constraints section, ensure the Mirror Creation check box is selected (the default setting).
The constraints created between the source and target skeletons on one side are automatically mirrored on the opposite side.
Mirror joint manipulation
When posing a target or source skeleton during retarget setup, you often need to make the same adjustment to each side. To speed up pose adjustments, you can automatically mirror the change you've made to one side to the other side. You can use the same mirroring option when setting up a solve to mirror changes to the pose or bone length. A new button in the manipulator toolbar enables you to do this.
To mirror changes to the pose or bone length of a skeleton:
-
In the Manipulator toolbar on the left of the view pane, ensure the Mirror manipulation button
is selected (green).
When you create make changes to one side of the subject, they are automatically copied to the other side.
Mirror weights
When you're adding or editing weights, you can use the mirroring option, Mirror Weight Changes. to make the same changes on both sides of the skeleton simultaneously.
To mirror weight constraints:
- In the Subject Setup panel, click the Regargeting tab.
- At the top of the Constraints section, ensure the Mirror Weight Changes check box is selected (the default setting).
When you adjust the weight values between the source and target skeletons on one side, they are automatically mirrored on the opposite side, so that weight values adjusted between, for example, the left lower arm on the source and target skeletons, are mirrored on the right lower arm of the source and target skeletons.
Test the retarget setup
You can test the retarget setup in Shogun Post or in Shogun Live.
To test the retarget setup in Post:
- When you have finished setup, click Map Mode again to turn it off.
You are returned to the motion in the file, ideally a ROM. - In the Subject Setup toolbar, click the Retarget Play Range button.
- Review the retarget.
To test the retarget setup in Live:
- Load the VSR. To do this, on the Processing tab, in the Retarget section supply the required names:
- Filenames. Enter or browse to the required VSR files. You can select or enter multiple files, separated with a comma.
- Names Enter the subject name(s). You can enter multiple subject names, separated with a comma. Ensure that the order of multiple names matches that of the VSR file names.
- In the General section, ensure that the Processing Output Level is set to Retarget.
Your FBX is displayed and is driven by the source skeleton. The retarget skeleton is recorded as part of the MCP capture.
If after testing, you find that further changes are needed, return to map mode and modify the setup (see Modify a retarget).
Modify a retarget
To check and modify your retargeting:
- In Shogun Post, make sure you have turned off Map Mode and then run Retarget from the Processing menu.
- Assess the results.
When checking the solve, if you need to reduce arm pull, try adding position targets on the clavicles. If the hands need to match more closely, consider zeroing the hand position offsets.
To see any changes, re-run Retarget from the Processing menu. -
Pay particular attention to the finger solve. Make sure the hands look correct.
-
If necessary, update the joint placement to get a better fit.
For more information, see: Vicon Shogun 1.3 Post Tutorial - Finger Solve Adjustments on YouTube.
- When you have finished updating the joint placement, in the Subject Setup panel, on the Retargeting tab, click Update Offsets to use the new joint positions.
- Re-solve the range and check the updated target.
- Save the final VDF and export the updated VSR.
Interactive retargeting
If you want to perform a simple manipulation of a retargeting bone, you can save time and a lot of manual tweaking by using the interactive retargeting feature. This immediately updates the offsets for the constraints that drive the bone that you're adjusting as soon as you release the mouse button.
To manipulate a retargeting bone:
- Ensure you have loaded the subject, which must have a retargeted skeleton.
- In the Subject Setup panel, click the Retargeting tab and expand Constraints.
- In the 3D Scene, select the joint you want to rotate.
-
From the buttons on Subject Setup panel toolbar, select the Enable interactive retargeting button
.
At the top of the 3D Scene view, the text Interactive Retargeting is displayed. - Using the manipulator, rotate the subject's joint.
- When you're happy with the new position of the joint, release the mouse button.
The offsets for the constraints which drive the bone are updated.
You can follow a similar procedure to manipulate solving bones: see Interactive solving.
For information on the relevant HSL commands, see the following commands in HSL Scripting with Vicon Shogun.
Export the retarget setup
When you're happy with the setup, or if you'd like to see how it works on other motions, export the file, which contains the retarget skeleton, the retargeting constraints, and the map pose.
For more information, see:
Export VSR
When you export in VSR format, you can:
- Load the VSR into other takes that only have a solving skeleton and then run retargeting.
- Load the VSR into Shogun Live to use it in real time.
Export FBX
- To export in FBX format, select the Retargeting node, then right-click and click Select Branch.
This selects the target skeleton, so that you can choose to export Selected objects only in the next step. - To choose what is exported and whether to reset scaling on export, open the Preferences dialog box (on the General menu, click Preferences), click the File Export tab and in the File Format box, select FBX Motion.
- If you want to reset scaling on export, ensure that the Unscale retargeting skeletons option is selected.
See also Export from Shogun Post.
You can now test the exported FBX in your CG app.
Export retarget constraints to HSL
You can export your retargeting setup to an HSL file so that you can re-use it, using the Export Constraints feature (Shogun Post 1.6 and later). You do this in a similar way to the current process for exporting solving constraints.
To export retargeting constraints and weights:
- Load a trial with a fully processed subject (VSK and VSS), which has an associated target skeleton (FBX) with a full set of constraints and weights.
- In the Subject Setup panel, click the Retargeting tab and expand the Constraints section.
All the configured constraints and weights are listed. - To export constraints, click Export Constraints, which is on the right, underneath the list of constraints.
- In the dialog box, enter or browse to a location and name for the constraints HSL file, and then click Save to export the constraints.
- To export weights, click Export Weights, which is on the left, underneath the list of constraints.
- In the dialog box, enter or browse to a location and name for the weights HSL file, and then click Save to export the weights.
To import the exported constraints and weights:
-
Load the MCP file in which you want to use the exported constraints. Ensure that the source bone names that affect constraints and weights are the same as those used in the original MCP file.
The subject and its solving skeleton are displayed in the 3D Scene view.
-
Load the associated FBX file. Ensure that the target bone names that affect constraints and weights are the same as those used in the original FBX file.
The FBX target skeleton is displayed in the 3D Scene view.
Tip: To set the subject's view filter for retargeting, in the 3D Scene view, click View Filters and under Subjects, select Retarget.
-
To import the constraints from the HSL file that you exported earlier, in the Constraints section of the Retargeting tab, click Import Constraints, which is on the right, underneath the constraint list.
-
In the dialog box, enter or browse to the required location and select the constraints HSL file.
-
To import weights, click Import Weights, which ison the left, underneath the constraint list). Note that you must import the constraints first, before you import the weights.
-
In the dialog box, enter or browse to the required location and select the weights HSL file. Ensure the same target root bone is set, and a similar target scale is used as before.
The constraints and weights are listed in the Constraints section of the Retargeting tab. -
Run the usual retargeting process.