Page MenuHome

FBX: exported mesh/animation does not work properly in UE4 when exported using 1 metric unit scene scale
Open, NormalPublic

Description

System Information
Win8, GTX1070

Blender Version
Broken: e92f235283 along with newer (May 29) builds

Short description of error
This is the only thing I know of that's still an issue in the Blender - UE4 pipeline. The workaround was to set the scene unit scale to metric 0.01, but this causes a lot of issues in other parts of Blender as well as in addons. I think we should attempt to fix this issue once and for all.

I'm using the official UE4 fix for the extra root bone issue, by naming the rig object "armature" the extra bone gets removed on import.

What works (all exports and imports at 1 scale):
0.01 metric unit scene scale, mesh at 1 scale (dimensions about 2 meters) apply unit scale on or off either works (results in normal looking mesh, normal sized animation)
1 metric unit scene scale, rig/mesh scaled up 100 times, applied transforms so 1 scale on both rig and mesh (dimensions about 200 meters) apply unit scale off (results in normal looking mesh, normal sized animation)

What doesn't work:
1 metric unit scene scale, mesh scaled up 100 times, applied transforms so 1 scale (dimensions about 200 meters) apply unit scale on (results in 200m mesh in UE4, normal sized animation)
1 metric unit scene scale, mesh at 1 scale (dimensions about 2 meters) apply unit scale on (results in normal looking mesh, tiny animation)
1 metric unit scene scale, mesh at 1 scale (dimensions about 2 meters) apply unit scale off (results in tiny mesh, tiny animation)

When apply unit scale is on, in all cases but the 0.01 metric mesh, there's a warning on UE4 import saying "Imported bone transform is different from original. Please check Output log to see detail of error."
In the output log there's a bunch of messages saying

LogFbx:Warning: IMPORT TRANSFORM ERROR : Bone (foot_r:66) 
Source Global Transform (-17.131426,-8.075233,13.492712|-88.834320,-140.732407,-38.382278|100.000000,99.999962,100.000351), 
Converted Global Transform (-0.171314,-0.080752,0.134927|-88.835167,-140.732254,-38.383274|1.000000,1.000000,1.000003)
LogFbx:Warning: IMPORT TRANSFORM ERROR : Bone (ball_r:67) 
Source Global Transform (-17.473686,8.365830,2.830386|2.606994,-89.071144,-89.079277|99.999954,99.999992,100.000343), 
Converted Global Transform (-0.174737,0.083658,0.028304|2.607001,-89.071159,-89.079292|1.000000,1.000000,1.000003)

for every bone in the rig. When you check the skeleton in UE4 the root bone has 100 scale in XYZ. This means that every other bone inherited this scale, but the scale for the bones were reset to 1 in the animation. This is the reason you get a tiny animation in the case of the 1 metric unit scale 1 normal size mesh export.
With the same mesh/rig but with apply unit scale off you get a tiny mesh and a tiny animation, there's no warning on import and if you check the root it is at 1 scale in XYZ which is what you want. The mesh/skeleton are just too tiny to use, about 2cm.

So there are two options that work, 0.01 metric unit scene scale and a normal looking mesh. The disadvantage of this method is that lots of other parts in Blender (and addons) break when scene unit scale is not 1.
The other option is 1 metric unit scene scale with a character scaled up 100 times, so a huge mesh but it turns out normal in UE4. The disadvantage of this method is that it's just awkward to work with, the whole point of the metric units are that they should make sense to you, but with everything scaled up 100 times it gets very confusing.

I'm hoping this issue can be solved so the Blender - UE4 pipeline gets to a perfect state.

Exact steps for others to reproduce the error
Based on a (as simple as possible) attached .blend file with minimum amount of steps

a blend with a UE4 tools rig and a simple animation.
In the .blend the scene unit scale is 1 metric.

  1. Export the mesh and rig, only deform bones option ticked. Import into UE4 - this is broken (see above).
  1. Resize the rig and mesh 100 times and apply transforms. Export with only deform bones option ticked and apply unit scale not ticked. Import into UE4 - this should work (see above). Note that the animation will look wrong because of not scaling the animation, but if the animation was redone it would look okay again
  1. Open the original .blend again and change the scene units to metric 0.01 scale and resize the mesh so it looks normal again, then apply transforms. Export with only deform bones option ticked. Import into UE4 - this should work (see above).

Details

Type
Bug

Event Timeline

Bastien Montagne (mont29) triaged this task as Normal priority.

I would say this is an UE4 issue - for some reason, it wants to convert bones transformations such that scale ends up being unitary - but it cannot do that with animation it seems… Also probably related with T50159.

I think the main issue here is that there’s not two applications handling the 'general scale' settings of FBX the same way. So far I have been storing unit scaling factor as global FBX scaling (which should makes sense, since it allows to detect unit back when importing FBX in Blender)… think I'll add an option to systematically apply all scaling (the one set in FBX exporter and the one from units) directly to object transforms, and set file scaling to always 1.0, and we'll see if that works (together probably with an option to set all scalings in global FBX scaling, and non applied to object transforms). Then people can try the different options and pick the one working for their pipeline.

But really, that scaling issue is a pain :(

Yeah, it may be a UE4 issue for sure. In that case a fix may be made on the UE4 side like before with the extra root bone thing, however this is still a Blender-UE4 specific issue.

I made a forum thread on the UE4 forums as well (feedback section), no idea if the developers will respond but they will at least see the problem. The thread is here: https://forums.unrealengine.com/showthread.php?146940-Animations-from-Blender-using-default-settings-don-t-work-in-UE4-help-fix-the-Blender-FBX-exporter . You may need an account to see it.

It should also be possible to see exactly what's going on in the UE4 .fbx import process because the code is on github. Maybe some clues can be found there. https://github.com/EpicGames/Signup

So, can you please download https://git.blender.org/gitweb/gitweb.cgi/blender-addons.git/snapshot/be617f7a2c1ebbb41d9ac96b932b439d4a2d5dcd.tar.gz and replace your current FBX addon directory content by what's in that archive? it's an attempt to rework (yet again :/ ) scaling handling in the exporter, you know have fours choices to apply custom and unit scaling either fully locally, fully as an FBX scale, or mixes of both.

Let me know if any of those four options work as you'd expect.

I tested the new version. None of them gave the perfect result of normal looking mesh and normal looking animation. AllLocal and FBXCustomScale gave the result of a scaled mesh but tiny animation. The root bone has 100 scale in the skeleton but 1 scale in the animations. FBXAll and FBXUnitsScale gave the result of a tiny mesh and tiny animation. Basically what you would expect if you exported meters as centimeters, it seems like it wasn't scaled at all.

I did find out some interesting things however.

  1. When importing a 0.01 metric (working) scale mesh into UE4 and in the UE4 import settings selecting 10 import scale, the mesh is 10 times bigger than usual but animations still work. Checking the skeleton, the root bone is scaled 10/10/10. In the animation it's still 10/10/10. This means that scaling the root bone but not any other bones is the UE4 way of scaling a character.
  1. This means that when importing a character with AllLocal or FBXCustomScale the root scaling is 100/100/100, which is what you would expect in UE4 terms. However when you get the error "Imported bone transform is different from original. Please check Output log to see detail of error." from other bones having a scale other than 1 (in these cases all bones have 100 scale at import time), all bones in the animation have their scale reset to 1, including the root bone.

This should mean that if the root bone scale wasn't reset to 1 in the animation the animation would look like you would expect. This seems like a UE4 bug for now.

  1. Since FBXAll and FBXUnitsScale gave a tiny mesh/animation I tried scaling them 100 times in the UE4 import instead. It worked without any errors, the mesh and animation looked normal. However the physics asset (ragdoll version of the skeleton) was messed up, the physics bodies had too low of a mass, and when scaling them they would turn bigger and they were stuck that way, you couldn't make them smaller.

It seems like the physics asset is created without taking scaling into account which seems like another UE4 bug.

I will report these bugs for now. I think that if you could scale only the root bone and leave the rest of the bones at 1 scale in the FBX export things would work fine.

Committed to master addons as rBA8b2a241baca09c9ae, will keep the report open for a bit in case there’s some news here.