The IK Rig defines the character, while the IK Retargeter defines the mapping for the animation. The process of creating an IK Rig asset is known as Characterization. This means that the skeletal mesh is defined into limbs and contact points, ensuring that the animation fits the skeleton of the receiving asset.
Using these tools, you can easily transfer an animation from one skeletal mesh to another. IK Rig provides a way to target the bone groups of a source skeletal mesh and graph the animation of that mesh onto an IK Retargeter asset.
The transfer process begins with creating a new IK Rig asset because this asset is used to define the bones for the movement. After the bones are defined, you can map the movement for a new animation asset.
This process creates new animation assets for your target character from the source. You cannot assign animations that are on your source character to your target character without following this process.
As you go through this tutorial, you will practice the retargeting workflows with a Fortnite character using the FN_Mannequin asset inside the Animation Starter template in Unreal Editor for Fortnite (UEFN).
Open UEFN and create a new project, making sure to select the Animation Starter template from Feature Examples.
Click image to enlarge.
For the process to work smoothly, you must ensure that:
-
The IK Rig target asset is roughly the same size as the source skeletal mesh.
-
When beginning the process, you use the same pose for the target asset and the source asset.
-
Playtest the animation on the target asset to ensure the animation plays smoothly and doesn’t require further editing.
Create a folder in the Content Browser to hold your animation assets. Once you’ve created the folder, you can import your custom animations.
To learn more about IK Rig and IK Retargeting refer to the IK Rig document in Unreal Engine.
Create an IK Rig Asset
Open the folder you created in the Content Browser, then import your animation by clicking Import from the Content Browser navigation bar. Select the animation from your files and click Open > Import All.
Click image to enlarge.
All of the files associated with your animation will import into the folder:
-
Skeletal Mesh
-
Animation
Use the IK Rig to select the bones of the source skeletal mesh to create a Retarget Chain and a new, selectable IK Rig asset. Once you’ve created an IK Rig asset, you can graph the animation onto the IK Rig Retarget asset and use the custom animation in Sequencer.
-
Right-click in the Content Browser and select Animation > Retargeting > IK Rig. This creates a thumbnail for the IK Rig asset and Retarget Chain. Or you can right-click on the imported skeletal mesh thumbnail to create the IK Rig.
-
Rename the thumbnail.
-
Double-click the thumbnail to open the IK Rig Editor.
-
Search for your imported skeletal mesh in the Preview Skeletal Mesh dropdown menu to add the skeleton to the editor.
-
Select the Hips or Pelvis Bone from the Rig Element list, then right-click and select Set Retarget Root. This bone holds the main character's motions.
-
Select bones in the Rig Element list, then right-click and select New Retarget Chain and rename the bone group if you need to in the pop-up.
Select multiple bones at once to target a group rather than individual bones. Group your bones by the branch in the Rig Element list. For arms, you only have to grab the bones from the shoulder to the thumb to grab the whole arm.
The bone groups for bipedal meshes should be created in the following Order:
-
Retarget Root - Hips and pelvis area
-
Spine
-
Neck and Head
-
Right Clavicle
-
Left Clavicle
-
Arms and Hands (right and left)
-
Legs and Feet (right and left)
-
-
Select ADD CHAIN to add your bone group to the IK Retargeting chain list. You should have a retargeting list that looks like the image below.
-
Click Save once all the bones have been added to the IK Retargeting chain list.
Now you need to graph the animation onto the IK Retarget asset to be able to use the custom animation on another skeletal mesh.
Create an IK Retargeter Asset
An IK Retargeter asset is an asset where you create a new animation by graphing the custom animation onto a target mesh. This new asset can be used with the following:
-
Sequencer - Use this asset to record an animation.
-
Animated Mesh device - Create an animation sequence that you can trigger.
Use the IK Retargeting workflow to create a new animation asset.
-
Right-click in the Content Browser and select Animation > Retargeting > IK Retargeter. This creates a thumbnail for the IK Rig Retargeter asset. Or you can right-click the imported skeletal mesh thumbnail to create the IK Retargeter thumbnail.
-
Rename the thumbnail.
-
Double-click the thumbnail to open the IK Retargeter Editor.
-
Select the IK Rig asset you created from the Source IK Rig Asset dropdown menu. UEFN automatically adds the source asset to the Source Preview Mesh field and to the viewport.
-
Select the IK_FN_Mannequin from the Target IK Rig Asset dropdown menu. UEFN automatically adds the FN_Mannequin asset to the Target Preview Mesh field and to the viewport.
-
Translate the FN_Mannequin asset beside the IK Rig asset you created by dragging to the right inside the Target Mesh Offset field. You’ll notice that the pose of the source asset and the target asset are slightly off. An extra bone may have been added to the clavicle area that wasn’t there before.
-
Select Clear Mapping > Map All (Exact) from the Auto-Map Chains dropdown menu under the Chain Mapping panel. This removes the extra bones from the target mesh.
-
Select Asset browser panel > your imported animation to see the target asset play the animation.
At this point, the animation might play well on the target mesh. If it does, save and export the animation. If the animation is still not quite right, you might need to adjust the retarget pose of the target mesh to match the source mesh before successfully graphing the animation onto your target mesh.
Change the Mesh Pose
Matching the source pose means your target mesh is more likely to effectively graph the animation onto its skeleton.
To change the target mesh pose, download a pose that matches the source asset default pose. Without it, you will have to create your own default pose animation to match the source asset.
If you have your pose ready, you can continue to change the mesh pose on your target asset.
-
Select Showing Retarget Pose from the Show Retarget Pose menu. This puts both meshes back into their default poses.
-
Select Create > Import From an Animation Sequence and select FN_Mannequin _TPose from the dropdown menu. The FN_Mannequin asset is only available from the Animation Starter Template.
-
Rename the pose to Tpose and select 0 for Sequence Frame.
-
Select Import As Retarget Pose. The FN_Mannequin now stands in a Tpose next to your source mesh.
-
Play the retargeted animation again on the newly posed target asset. It should play fluidly.
-
Select Export Selected Animations to export the animation. This opens the Batch Export Retargeted Animations window.
-
Fill in the new name of the retargeted animation in the Add Prefix field and select Export. You can fill in the other fields if you want, but they are unnecessary.
The animation exports into the selected folder. You can now use this animation with the Animated Mesh device and in Sequencer.