Last updated: September 04, 2017

As of Unreal Engine 4.16, this is no longer needed.

From the Unreal Engine 4.16 Release Notes :

  • New: The FBX importer updates:
    • Now imports collision models under the FBX LOD Group.
    • Now applies the transform from FBX options only one time for the whole import.
    • When importing an FBX file from Blender, the importer now removes the root node name “armature.”
    • No longer removes the socket created in UE4 Editor when using reimport. If affects only imported socket.

“The more things change, the more they stay the same.”
–Snake Plissken

Yeah, I know… some dead-French guy said it first, but I remember it from the end of Escape from L.A.
Get over it.

Blenders FBX exported has gotten a lot better… and yet, it still adds the extra root bone.

This tutorial will show you what to change in order to fix this.

Tools used:

Blender 2.78a.
Unreal Engine 4.13.
UE4 Tools Addon

The file we will be going to edit


C:\Program Files\Blender Foundation\Blender\2.78\scripts\addons\io_scene_fbx\export_fbx_bin.py

Before you begin:

  • Create a backup of the file.
  • Get a decent text editor.
    For Windows, I recommend Notepad++.
  • Run your text editor in admin mode.

Instructions:

  1. Find the following:
    
    
                elif ob_obj.type == 'EMPTY' or ob_obj.type == 'ARMATURE':
                    empty_key = data_empties[ob_obj]
                    connections.append((b"OO", get_fbx_uuid_from_key(empty_key), ob_obj.fbx_uuid, None))
    


    For me, it was around line 2465.

  2. Comment out these lines:
    
    
    #            elif ob_obj.type == 'EMPTY' or ob_obj.type == 'ARMATURE':
    #                empty_key = data_empties[ob_obj]
    #                connections.append((b"OO", get_fbx_uuid_from_key(empty_key), ob_obj.fbx_uuid, None))
    

  3. Save the file.
  4. Restart Blender.
  5. Export as usual.

Example:

I installed the UE4 Tools Addon by Luis Garcia and used the “Append Hero RIG!” button to add a UE4 Mannequin to the scene.

I then extruded two new bones – item_r & item_l – and added them to the EpicExtra bone group.

Result in blender:
ue4fixextraroot_inblender

After this, I selected everything and clicked the “Export Character” button and imported the result into UE4.

Result in editor:
ue4fixextraroot_ineditor

Enjoy!

8 thoughts on “Prevent Blender FBX Exporter adding extra root bone

    1. Sweet fix, except it doesn’t work when it comes to exporting skeleton and animations from Blender. This is what’s happening:

      Any idea how to fix exporter where Armature doesn’t get exported as root of the hierarchy and at the same time scale is maintained when anims are exported too ?

      Thanks beforehand

      1. I’ve had that issue before, but do not remember the exact cause or fix.
        Something to do with not applying the scale correctly.

      2. I had a similar issue, to fix, I just set the unit length in the scene tab to metric and unit scale to 0.01 then set the clip end in the “n” toolbar to 10km. Make sure all transforms are applied, and this should work as long as your root bone’s scale is 1 in pose mode, and edit mode just for safety.

      3. Also, to keep scale from before after changing the unit scale, just scale your object in object mode by 100 and reapply the transforms again.

      4. I think the reason for this is because 1 blender unit is 1 meter, and this is respected by UE4 for general object scale, but a scale of 1 on the root bone is seen as 1 centimeter, the UE4 standard, so all animations are scaled down by 100. The fix ought to be setting everything in blender to the 1 centimeter default.

  1. Yes, the problem is partly the scale difference but there has to be a bug here also, as you will see from what you have to do to make it work. For one, I have proven over many tests that you can work at normal scale in blender while you are getting your model ready. You can even parent the mesh to the armature without applying any scale, with a metric scale of 1.00, so that one blender unit is 1 metre. In fact you will save yourself a lot of trouble by making sure your startup file is set up that way before you start modelling anything. This is blender’s normal operating scale and will avoid and camera clipping or zoom issues. As long as you are modelling objects that range in scale from say a house brick to a house, you can work at that scale. Anything smaller than a brick or larger than a house and you should work at a different scale in blender. Also, as mentioned above, if you have got into the bad habit of changing location, scale and rotation in object mode rather than edit mode, you should always apply that transform using CTRL-A while still in object mode.

    However, in order to export an FBX that can work within UE4, especially with animation retargeting, you need to take the following steps:
    1) rename your armature to ‘armature’ in the outliner in blender. This stops a root bone being created for you automatically, which you do not want because the scale of the automatic root bone will be wrong and there is no way to fix (that I can find).
    2) if you do not already have one, add a root bone to your rig. If you are using the standard unreal skeleton, this root bone will be the parent of the pelvis bone. If you are adding the single bone separately, you should use CTRL-J to join it to your existing armature before attempting to parent it. To make it the parent click the pelvis bone, then SHIFT click the root bone and do CTRL-P > Keep offset. Make sure this isn’t a deform bone in the bone tab. Even if you are not going to use it, you need this bone. Without it the incorrect scale will be applied to the pelvis bone instead.
    3) save your blend file. This is your master file and any changes to your model will be done to this file. The steps after this would then be repeated for every change to the master file. Note that file does not contain your rigging because it is cleaner and recognises that fact that it is very common for someone else to do the rigging and animation of your mesh. I am not saying don’t save your rigging efforts, just don’t save them in your master file.
    4) if you have not already done so, join all your separate mesh pieces together and parent your mesh to the armature using CTRL-P and using whatever method you prefer for assigning the weights. Use automatic weights if you don’t know what I am talking about. Do not save this change in your master blend file.
    5) select the armature, go into edit mode, select A to select all bones and then deselect your root bone. Then scale all the other bones up by 100. Apply location, rotation and scale using CTRL-A. There is a bug that scales the root bone up by 100, so that is why we leave the bone unscaled. The bug will make it match the rest of your armature later. Do not save this change in your master blend file.
    6) go back into object mode, select your mesh and scale that up by 100 too. Apply location, rotation and scale using CTRL-A. Now you armature and mesh should be exactly the same size again but 100 times bigger than when you started. Do not save this change in your master blend file.
    7) You are now ready to export to UE4 using File > Export FBX. In the operator panel you can use your own operator preset but make sure that the Scale field on the Main tab is 1.00, that Only deform bones is unchecked and Add leaf bones is unchecked on the Armature tab. It is also a good idea to set smoothing to Face, which stops you getting the message from UE4 about smoothing groups.
    8) Import into UE4, you can use your usual options but in order to correctly reset everything to our initial scale, you need to set the Import uniform scale to 0.01 in the Transform section. If you have done everything correctly, you will not get errors about physics assets or smoothing groups. You can go into Persona, select your skeleton, then click on each of the bones, root, pelvis, spine_01 etc and see with your own eyes that they got the correct bone scale in the Details panel.

    Hope that helps. I know a lot of people have been having issues.

  2. The proposed changes will break the exporter in Blender 2.8+ and so far I’ve found no ‘clean’ way to fix these issues in the exporter – I can do it in the importer for my engine of choice, or I can remedy it at runtime, anyone else?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s