Skip to main content

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:

image-20230621150414434

Target Actor:

image-20230621152253839

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.

image-20230620133551891

In the Animation Editor, click Window -> Retargeting Manager to open the Retargeting Manager.

image-20230620133723427

image-20230620134217287

NameDescription
ClearUsed to quickly clear mapping relationships.
Show Advanced BonesSwitch between displaying the main skeleton or the full Rig structure, or quickly configure to quickly check the transformation effect.
Try To Map BonesAuto map Rig nodes and bones quickly.
Set Base Pose PathSpecify the retarget base pose.
Clear Base PoseClear the currently specified retarget base pose. After cleared, the animation's original matching base pose will be used.
Save SettingsSave the current retarget settings.
Create/Update Rig TemplateCreate/Update the Rig template with the current Rig configuration.
Delete Rig TemplateDelete 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.

image-20230620135342398

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.

image-20230620135459029

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.

image-20230620140058970

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.

image-20230620162057811

If the auto-mapping is incorrect or not successful, you can modify the corresponding bone mapping manually.

AddMapping

Bone mapping completed:

image-20230620171751151

Click the Save Settings button to save the edited settings.

image-20230620164117162

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).

image-20230620172032447

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.

image-20230625095055539

Select the source Actor file in Source Actor File in the pop-up window.

image-20230620172314228

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.

image-20230620173116787

image-20230621102435556

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.

image-20230620174245551

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.

image-20220909145443262

image-20220909145552068

After fixed:

image-20230620174523319

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:

image-20230621175536941

Target base pose:

image-20230621175651921

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.

image-20230130164425204

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.

image-20230621094210351

After adjusting, right-click the animation in the Asset Browser and select Export Skeleton to export the modified animation.

image-20230328104931820

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.

image-20230625095716520

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.

image-20230620175458560

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.

image-20230130165308143

Final Result

The following is the target Actor reusing the source Actor's attack animation via the Rig-based Animation Retargeting feature.

Preview