Retarget a Rokoko animation to a Custom Character in Unreal Engine 5

Who is this article relevant to?

This article is for anyone who wants to know how to retarget their exported Rokoko Studio animations to their custom characters in Unreal Engine 5

Which plans is this article relevant for?

Starter Plus Pro Enterprise

Important! For any workflow-related issues, please join our Discord server.

Requirements

  • A Rokoko Studio animation in FBX format
  • A custom character. You can find our own custom model for testing here.
    When importing your character make sure to NOT import other animations with it. You can check or uncheck this setting during the character import process in Unreal Engine
  • Unreal Engine 5 up until version 5.2

Video Tutorial - Retarget animations in Unreal Engine 5

Important

  • Both skeletons need to be in the same Rest Pose. They must both be in A-pose or T-pose. In the video tutorial, you will see that the custom character and the animation have different Rest poses. This is easily fixed inside Unreal Engine and we go through that in the video.
  • Rokoko Studio offers many export options for your animations. If you want to retarget an animation onto an Unreal Engine character or an A-pose character, we recommend the following export options using the Custom preset (premium setting)

    Capture.PNG

  • In this guide, however, we will use a custom character whose Rest pose is in a T-pose using the Mixamo preset (not the Custom one). Our Youtube video used the Custom Preset with Mixamo and T-pose options. These options are similar to what we are using so there will be no issue.

    Capture.PNG
  • Make sure you have Body Mesh selected before exporting. Failing to do so will make your animations fail to be imported into Unreal Engine

Process

In order to retarget an animation in Unreal Engine 5 we will need to create 2 IK rigs, one for the animation and one for the custom character. Then, we will need to create an IK Retargeter to retarget the 2 IK rigs.

 

Create the IK Rigs

  • Import your animation in Unreal Engine by going into the Content Drawer (Ctrl + Space) and clicking Import. Navigate to your FBX animation and import it with the following settings.

    1. Make sure the Skeleton is empty
    2. In the Advanced settings > Animation make sure the Import Animations option is selected

    Capture.PNG

 

  • To retarget an animation onto a character we will need to create 2 IK Rigs, one for the character and one for the animation. This way, the two Rigs will communicate and the retargeting will start.
  • To create an IK Rig for your mocap, right-click in the Content Drawer > Animation > IK Rig > IK Rig

    You can rename this IK Rig

    Capture.PNG
  • After you are done, double-click on it to edit it. Select the animation skeleton from the top-right menu.

    Capture.PNG
  • Next, go to the left Hierarchy panel, right-click on the Hip bone, and click Set Retarget Root

    Capture.PNG
  • Next, we go to the right side in the IK retargeting panel and we will start adding New Chains. We will do the same for the IK Rig of the custom character as well. This will allow Unreal Engine to match the respective chains (Head chain of the mocap rig with the Head chain of the character rig, etc) of the two IK Rigs so that it retargets the keyframes from each head, leg, arm, etc of the mocap to the ones on the custom character.
    It's important that each chain's name is the same between the two different IK Rigs (both of the head chains should be called Head, ArmL, etc, for example). If one chain is called head and the other one HeaD, this will cause issues.
  • We will only need to create a chain for the:
    1. Head
    2. Spine
    3. Left arm
    4. Left leg
    5. All the left hand fingers(if our mocap has finger animation)

    The retargeter will then allow us to duplicate the chains that have a right side and will automatically fill them.
  • Click +Add New Chain

    Capture.PNG
  • Type Head and click Add chain.

    Capture.PNG

  • Do the same and create a chain for the spine, left arm, left leg, and left hand fingers if you have finger mocap. We will fill them with the respective bones later.

    It should look like this:

    Capture.PNG
  • We will now go ahead and fill the Start and End bone fields. This depends on the skeleton naming and the quantity of the bones the skeleton has.

    It's almost mandatory that the animation skeleton and the character skeleton have the same number of bones. If one skeleton has 3 different spine bones called Spine1, Spine2 and Spine3, and the other skeleton has Spine1, Spine2, Spine3 and Spine4, it may cause issues.

    In these cases, it's recommended that one of the rigs is edited so that both have the same number of bones. Although it will not break the retargeting even if you include the whole row of bones in one chain, even if it will have 1 more bone that the other skeleton in that row.

    Since editing a rig is much work, you can also try just including the first bones. For example, we can have one Spine chain have Spine1, Spine2, and Spine3 (all of its bones), and the other Spine chain can have Spine1, Spine2, and Spine3 or Spine4 (3 out of the 4 total bones so it matches the other chain).

    The above is usual when it comes to finger bones as some skeletons can have different numbers of finger bones. In that case, we will include only the finger bones that are needed.

    After you are done with the assignment of the bones on each chain for the left side, it should look like this:

    Capture.PNG

  • We will then go to each Left chain, right-click in the space right next to it, and click Mirror Chain. We will then be asked to name it. For the arm, we will name it ArmR, etc. It should be automatically filled with the respective bones on the right side.

    Capture.PNG

    Final look:

    Capture.PNG
  • Hit Save and close this window.
  • We will do the exact same thing for the custom character.
  • Right-click in the Content Drawer > Animation > IK Rig > IK Rig

    You can rename this IK Rig

    Capture.PNG
  • After you are done, double-click on it to edit it. Select the custom character skeleton from the top-right menu.

    Capture.PNG

  • Next, go to the left Hierarchy panel, right-click on the Hip bone, and click Set Retarget Root

    Capture.PNG
  • Then we will start adding chains and assigning the Start and End bones. The final should look like this:

    Capture.PNG

 

Create the IK Retargeter

  • to create an IK Retargeter, right-click in the Content Drawer > Animation > IK Rig > IK Retargeter

    You can rename this IK Retargeter

    Capture.PNG
  • After you are done, double-click on it to open it. You will be asked to:
    1. First, select the source IK Rig, in other words, your mocap IK Rig
    2. Second, the target IK Rig, in other words, your character IK Rig

    Capture.PNG
    Capture.PNG

  • Given that both skeletons have the same Rest pose, we can simply go ahead and navigate to the Asset browser on the lower right side and double-click the animation sequence. This will result in the retargeting process

    Capture.PNG


    ezgif.com-crop.gif

 

Fix the Rest Pose

Retargeting a T-pose animation to an A-pose character will result in an offset retargeting.


1.PNG

 

Since both skeletons need to have the same Rest pose (both in T or A pose), we will need to fix one of the skeleton's Rest pose to match the other skeleton's. We can easily do this inside the retargeter

 

  • Activate Edit Mode

    Capture.PNG
  • Make the bones visible

    12.PNG
  • Rotate the shoulder bones so that they make the same T-pose as our animation has

    3232.PNG

  • Click Edit Mode to Exit Edit mode and Run Retargeter

    123.PNG
  • The retargeting is fixed now

    2222.PNG

Articles in this section

Knowledge base