Game Engine Export

_images/game_engine_header.jpg

Overview

3 type of rig can be exported: Generic, Humanoid, Universal.

Shape keys are exported, all types are supported in Unity and Unreal Engine, and probably other game engines supporting the Fbx format as well.


Export Requisites

Custom bones

To include new bones created in the rig, their name must starts with ‘cc_’ (stands for custom controller, e.g. ‘cc_sword’).


Stretch

Extra stretch/length of the arms and legs is not properly handled by the Fbx format, since the children bones always inherit the scale from their parent bones. Also, it can lead to incorrect bones rotations. For this reason, set to zero the “auto-stretch” and “stretch length” values of the arms and legs, and do not move the “c_stretch” controllers (elbows, knees).


Preserve Volume

In game engines, dual quaternions skinning is generally not supported, unlike Blender does with the “Preserve Volume” feature in the armature modifier. So make sure to uncheck Preserve Volume in the armature modifier in Blender to see the right deformations.

_images/preserve_volume_28.jpg

It may be best to use multiple twist bones for the arms and legs, see Arms Options


Shape Keys

Animations of shape keys are exported automatically. They are baked for each actions then injected in the Fbx file.


Root Motion

Exporting animations with or without root motion is easy in Unity: the root motion is automatically computed by Unity that is looking for the center of mass, regardless of the bone hierarchy/animated bones nodes. It’s a different matter with Unreal: to make it work, the Blender armature object itself must be animated. Auto-Rig Pro also includes an option to transfer the “c_traj” bone controller animation to the armature object at export time only, to avoid animating the armature object.

_images/root_motion_2_28.jpg _images/c_traj.png

By default, the IK feet and hips (“c_root_master.x”) controllers are parented to the “c_traj” bone. Animators may prefer to disable it, so that the “c_traj” controller does not influence other bones. To do that:

  • Select the IK feet bones (“c_foot_ik”) and set their Child Of constraint influence to 0

_images/constraints_feet_28.jpg
  • Select the “c_root_master.x” bone, enter Edit Mode (Tab key) and clear its parent bone

_images/parent_root_28.jpg

Animations Export

In Blender, animations are called “actions” and multiple actions can be created for a character. However, when exporting to Fbx, all actions contained in the file are exported by default, no matter if they’ve been created to animate the rig or other objects. Exporting actions that are not linked to the rig may potentially corrupt the character animation. To see why, open the Action window of Blender, and try to link other actions to the character. It may get distorted, scaled weirdly, depending on the keyframes stored in the action.

_images/assign_actions_28.jpg

To fix it, in the export options, you can click the eye button to display the exported actions. In the following example, only “soldier_rigAction” is the right action to export with the rig. So, it’s either possible to delete the other actions by clicking the X button, or check the the Only Containing option, and enter “soldier” in the text field to export only the soldier action.

_images/select_action_2_28.jpg

Export Types

Universal exports a simplified bone hierarchy for any creature: bipeds, quadrupeds, spiders, centaurs…

Humanoid is for bipeds only. It exports a simplified bones hierarchy like Universal, plus supports the Unreal Mannequin bones orientation as an option and humanoid naming convention. It’s useful for retargetting, root motion… The drawback of this type is the bone restriction: in Unity to setup more facial bones than the jaw and the eyes, extra steps are required.

Generic is a kind of “raw” export. It exports the deforming bones and the non-deforming bones if they’re parent of the deforming ones. The full facial rig is exported by default. It’s not possible to deal with retargetting, the bones hierarchy is not preserved.


  • Ensure the character is not too small, otherwise it may lead to issues, such as bad retargetting. Try to consider one meter = one grid unit, ideally it has to be approximately this big compared to the grid floor (see screenshot below). Scale the mesh and armature (S key otherwise).

_images/ge_scale_28.jpg
  • Once the character is rigged and skinned, select its armature and go to File > Export > Auto-Rig Pro FBX

_images/file_export_28.jpg
  • Choose the engine to export to (Unity, Unreal).


_images/universal_04_28.jpg

Universal

Rig:

  • By default, all skinned objects are exported. To export only the selected ones, click Selection Only.

  • Custom bones: if you added your own custom bones to the armature, make sure they are named with the ‘cc_’ prefix, thus they will be included in the export. If they are parented to an FK bone, they will be parented to the deforming bone automatically. E.g, if “cc_watch” is parented to “c_forearm_fk”, it will be parented to “forearm_stretch” which is the final deforming bone in the exported armature. If “cc_hat” is parented to “c_head.x”, it will be parented to “head.x”. Make sure to parent them directly to the “_stretch” bones when using an IK chain which has no direct controllers, such as “forearm_stretch”.

  • Check Advanced if you need to export the bend/secondary bones (especially useful for cartoon characters to curve the arms, legs).

Note

Arms and legs secondary controllers are automatically exported if they’re set to Twist (see Secondary Controllers)

_images/cardman_noodles.gif
  • Check Push Additive if secondary controllers are set in Additive mode, to compensate the weight loss of the additive bend bones, since the additive armature is not exported.

  • Check Export Twist to export the twist bone. When checked, a percentage can be defined to set the amount of twist. Generally 0.5 gives best results.

    1.0

    _images/twist_inf_100.jpg

    0.5

    _images/twist_inf_50.jpg

Note

Twist bones are automatically exported if there’s more than one twist bone per limb (see Arms Options, Legs Options)

  • Enable No Parents to support stretchy animated bones. Caution though: to achieve this, the bones are unparented, the rig hierarchy will be exported broken.

_images/allow_stretch.gif
  • Enable Units x100 to export internally with 0.01 unit scale. This allows retargetting in Unreal and initialized scale transform in Unity as well (1.0).

Animations:

  • Bake Actions to export the actions (animations)

  • Export Baked Actions Only to export only the baked actions.

  • Check Only Containing and enter a word on the right to export only the actions including this word in their name. E.g. setting “soldier” will export the action “soldier_walk” but won’t export “john_walk”. Useful when dealing with multiple actions in the scene.

  • A Simplification Factor can be adjusted to lower the file size at the expense of the quality. Lower values are recommended to fix “floating” feet effects when exporting.

Misc:

  • A Global Scale can be applied, but this is generally not recommended. Better scale the armature and meshes before exporting.

  • The Fix Bones Rotation and Fix Bones Matrix feature should get rid of animation issues when exporting (bones weirdly rotated at some frame)

  • Enable Initialize Fbx Armature Rotation to export the rig with rotation values set to 0 (warning, it’s experimental, does not work with root motion yet)

  • The bones axes can be changed using the Primary and Secondary parameters


Humanoid type

Humanoid covers the same features as Universal plus the following ones. Note that Unity internally handles the wrist twist, so twist bones are not allowed there.

_images/humanoid_unreal6_28.jpg
  • Full Facial exports all facial bones, otherwise only the main ones are exported (jaw, eyes…)

  • [Unreal Only] Check Rename for UE to rename the bones according to the Unreal Engine’s humanoid naming. Unity will handle the default names properly so this checkbox is not visible when Unity is chosen.

  • [Unreal Only] Check Mannequin Axes to match the bones orientations with the Unreal Mannequin. This allows to directly import the skeleton as the Mannequin skeleton in Unreal. It requires 4 spine bones. It’s also best to export the character in A-Pose when exporting to UE, see Changing the Rest Pose.

_images/skeleton_mannequin_ue.jpg
  • [Unreal Only] Check Root Motion to transfer the “c_traj” bone animation to the armature object animation when exporting, to support root motion in UE

  • [Unreal Only] Check Add IK Bones to add the Unreal Mannequin IK bones: “ik_foot_root”, “ik_foot_l”,…


Generic type

Generic covers the same feature as Universal. The twist bones are automatically exported.


Export by Script

  • Here is a little code snippet as example to export a character by script:

    import bpy
    import os
    
    # set the file path output here
    file_output = "C:\\MyExportFbx.fbx"
    
    # set some settings...
    bpy.context.scene.arp_export_rig_type = 'humanoid'
    bpy.context.scene.arp_engine_type = 'unreal'
    
    # export it
    bpy.ops.id.arp_export_panel(filepath= file_output)
    

Unity Tips

Performance

For Generic rigs, in Unity, Rig import setting of the Inspector, check Optimize Game Object for a performance boost.

_images/unity.jpg

Unreal Engine Tips

Import specifications

If the mesh have shape keys, importing with Use TOAs Ref Pose enabled may lead to incorrect blend shapes in Unreal. If this happens, make sure to turn it off.

_images/unreal_import_toa.png

Retargetting

  • The Unreal humanoid rig features 4 spine bones (root + 3 spine bones). So it’s possible to set the Auto-Rig Pro spine count to 4 too in the Rig tab of the Auto-Rig Pro panel. Otherwise, when assigning the regtargetted bones, just map the spine_03 slot to the spine_02.

_images/ue_retarget_spine.jpg
  • Make sure the ‘advanced’ bones are properly mapped (click Show Advanced to display the facial and fingers bones). If you don’t use them, click the X button to unassign.

  • For better results, pose your character as the target rig rest pose

_images/base_pose.jpg
  • To avoid strange arm/legs rotations after retargetting, set their translation type to Skeleton. Display the retargetting options by clicking this in the bones tree:

_images/ue_retarget_options.jpg

Then set to Skeleton this property:

_images/ue_retarget_skeleton.jpg

Rotation Offsets

Sometime, because of differences in the rest position of the source and target rig, or because the animation itself contains artefacts, it’s necessary to apply rotation offset over the retargetted animation for better results.

It’s especially true for the fingers. Here is how to fix wrong fingers rotations of the ThirdPersonRun included in UE:

  • Select and rotate the bones in the 3d viewport (animation window)

_images/ue_fingers_offset_01.jpg _images/ue_fingers_offset_02.jpg
  • Select all the bones you’ve modified in the Skeleton Tree:

_images/ue_fingers_offset_03.jpg
  • Click the Key cross button then the Apply button.

_images/ue_fingers_offset_04.jpg
  • Save your asset and you’re done!