Rig-based Animation Retargeting
Overview
Animations can be transformed between animation sets by configuring the same retarget Rig assets for different animation sets. The so-called Rig asset is a hierarchical object that contains a series of nodes. It acts as a "medium" to bind its own nodes to bones, so as to establish a mapping relationship between bones for different skeletons.
In a nutshell, Rig-based Animation Retargeting allows the animation created based on skeleton A to offline-generate an animation that can be played on skeleton B. The skeleton hierarchies, number of bones and bone naming of skeleton A and skeleton B can be inconsistent.
Workflow
The following is a workflow on how to retarget an animation from one Actor to the other so that it will play normally in the other Actor when two Actors are using different skeletons.
Prepare an Actor with the main skeleton SK_Avatar_tpose as the source Actor (containing supporting animation assets), and an Actor with the main skeleton SK_Human_tpose as the target Actor. The main skeleton hierarchies, the number of bones and the bone names of the two Actors should be different.
Source Actor:
Target Actor:
Retargeting Manager
Double-click the source Actor (SK_Avatar.actor) to open the Actor Editor, then double-click a skeleton asset in the Action List to open the Animation Editor and enter the edit window of the source animation.
In the Animation Editor, click Window -> Retargeting Manager to open the Retargeting Manager.
Name | Description |
---|---|
Clear | Used to quickly clear mapping relationships. |
Show Advanced Bones | Switch between displaying the main skeleton or the full Rig structure, or quickly configure to quickly check the transformation effect. |
Try To Map Bones | Auto map Rig nodes and bones quickly. |
Set Base Pose Path | Specify the retarget base pose. |
Clear Base Pose | Clear the currently specified retarget base pose. After cleared, the animation's original matching base pose will be used. |
Save Settings | Save the current retarget settings. |
Create/Update Rig Template | Create/Update the Rig template with the current Rig configuration. |
Delete Rig Template | Delete the currently applied Rig template. |
Select a Rig from the drop-down menu of the first row of the Retargeting Manager. You can select the Engine's built-in Rig humanoid or create your own Rig.
Creating Rig Assets
Create a Rig from the main skeleton of the target Actor. In the Animation Editor with the target Actor's animation asset open, click File (Menu Bar) -> Create Rig.
In the pop-up window, enter Rig Name, select Rig Path, and click the Create button to finish creating a Rig from the current main skeleton.
Setting Bone Mapping
Here use the Rig you created (SK_Human.rig) to map bones. Click the Try To Map Bones button and the mapping relationships between the Rig nodes and the character bones will be automatically configured.
If the auto-mapping is incorrect or not successful, you can modify the corresponding bone mapping manually.
Bone mapping completed:
Click the Save Settings button to save the edited settings.
Repeat the above steps to complete the Rig related configuration for the target Actor (SK_Human.actor) (The selected Rig asset is consistent with the one selected by the source Actor).
Retargeting Animations
After the Rig related configuration of the source Actor and target Actor is completed, in the Animation Editor with the target Actor's animation asset open, click File (Menu Bar) -> Create By Retargeting to create the animation asset.
Select the source Actor file in Source Actor File in the pop-up window.
If the Rig settings in the animation set match each other, then the Source Animation List will list all the XSKT original animations in the source Actor's animation set. Check the animations to be transformed, then click the OK button to start the transformation. At this time the selected animations will be added to the target Actor's animation set. If the Rig settings don't match, then the source Actor's animation will not appear in the list.
Improving Transformation Quality
By Runtime Animation Retargeting Feature
The transformed animation may not match the length of the target on several bones, which needs to be modified by the Runtime Animation Retargeting feature.
Some of the bones are not perfectly matched. This can be fixed by setting the corresponding bones to Skeleton retarget mode in the Skeleton Editor. For example, set all bones except Root and Pelvis to Skeleton retarget mode recursively, right-click the Root bone in the Skeletal Tree and select Skeleton (Recursive), and finally set the 3 bones Root, Bip01 and Bip01 Pelvis to Animation retarget mode.
After fixed:
By Setting Retarget Base Poses
For better transformation results, the base pose should be set as consistently as possible for both the source Actor and the target Actor. Improve the controllability and the quality of the transformation. This step can be added in the Retargeting Manager (before creating the retarget animation) if the reference skeletons of the animations differ significantly.
As shown in the image below, there are certain differences between the base poses of the target and the source, and the retarget base pose needs to be created.
Source base pose:
Target base pose:
Creating Retarget Base Poses
There are two ways to create a retarget base pose. One is by using a DCC tool like 3Ds Max or Maya to adjust resources based on the original ones and export them as Flexi animation assets (Make sure that frame 0 is the desired base pose). The other is by using the Animation Editor's built-in edit/export tools.
The advantage is that the control of the pose is more accurate. The disadvantage is that it is relatively cumbersome and requires certain abilities to use DCC tools and to switch original resources between the two tools. The advantage of the second way is that it is convenient and fast. While the disadvantage is that currently it is not that intuitive and controllable to modify poses in the Editor.
Steps for the second way:
If the base poses of the source and the target are very different, you can adjust the target base pose to be consistent with the source base pose, and set the target base pose to be the modified one in the Retargeting Manager. Or you can adjust the source base pose to be consistent with the target base pose, and set the source base pose to be the modified one. The following are steps to create and set a retarget base pose with the example of adjusting the target base pose to be consistent with the source base pose:
Edit the XSKT animation that the target uses for the skeleton. In the Actor Editor with the target open, double-click SK_Human_tpose under the Action List to enter the edit window of the animation.
Adjust the Append Transform of the corresponding bones in the Skeleton Editor to make the target base pose consistent with the source base pose as much as possible.
After adjusting, right-click the animation in the Asset Browser and select Export Skeleton to export the modified animation.
After exporting, you need to Reset the changes to the Append Transform values in the Details Panel of the animation. Remember to save it after editing.
Setting Retarget Base Poses
Set the retarget base pose for the target. In Set Base Pose Path of the Retargeting Manager, select the animation you just modified and exported, and the retarget tool will use frame 0 of the asset as the base pose.
If the base pose is no longer needed, you can click the Clear Base Pose button to clear it. If no retarget base pose is set, the program will use the original skeleton with which the animation is associated as the retarget base pose.
Final Result
The following is the target Actor reusing the source Actor's attack animation via the Rig-based Animation Retargeting feature.