-
-
Notifications
You must be signed in to change notification settings - Fork 18.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UFBX Imports Empties with 100x Scale & Wrong Rotation #90314
Comments
@bqqbarbhg Any ideas? |
Blender stores by default all objects at 100x scale, using 1cm units, in Godot we use godot/modules/fbx/fbx_document.cpp Line 1956 in e5b4ef8
Using Fortunately, Blender allows exporting with the setting "Apply Scalings" set to "FBX Units Scale", which will export the file as 1m units, removing any funky transforms that appear. Anyways, I'll take a peek at what FBX2glTF does here and see if there's some clean solution, but I don't know if there is one. |
Looks like FBX2gLTF behaves exactly the same way here, so I'd say ufbx does the "correct" thing here. Exposing the But as I said for Blender this can also be avoided on the export side by using "FBX Units Scale". |
Just to confirm - I tested exporting the fbx with that "apply transform" option checked and it indeed fixed both the scaling and rotation issues for the generated nodes after reimporting and creating a new inherited scene. So one option would be to treat this as a documentation issue and make sure this edge case and its solution shows up in the documentation. It wouldn't be wise to recommend using that option outside of this use case though, since applying transforms can screw up armatures and animations from what I recall. But still, I can't see really any use cases that would need both empties and armatures in the same FBX, but you never know. |
instance-test.zip |
This is not very visible, but we placed the documentation here. https://docs.godotengine.org/en/latest/classes/class_fbxdocument.html#description |
The setting is in the "Apply Scalings" dropdown as I mentioned in my first reply:
Using this is also fully safe (as far as ufbx is concerned), as the only thing it does is to set the file unit scale to be meters, and skips scaling all the nodes by 100. I think the default is what it is for broken importers that ignore the FBX file units, as centimeters are the de-facto standard unit for FBX. |
Where is that drop down located? Is it part of the exporter? Or something that needs to be done in another part of Blender before using the exporter? |
I have no idea how I wasn't seeing that, lol. |
Oh also of note, using that will not remove the 90 degree rotation from the nodes, as that's needed to convert the scene from Blender's Z-up to Godot's Y-up. "Apply Transform" will probably get rid of that at the cost of messing up armatures. |
Ya, just noticed that. Though the weird part about that is that the Blender FBX exporter defaults to -z-forward and y-up. As can be seen in both of our screenshots. |
Yeah if you export with Y-up in Blender, Blender itself will add the 90 degree rotation to nodes. If you export Z-up the file metadata will contain the information that it is Z-up, but nodes will have no extra transforms. Unfortunately, when loading, ufbx will add the transforms back to make the file look correct :D So in essence, changing the export space just changes where the conversion is done. |
Ya, so after trying a ton of different combos, it seems the "apply transform" is the only one that fixes the rotation issue. It also technically can fix the scale issue as well, since as long as that is checked it doesn't seem to matter what the "Apply Scalings" is set to. Though the FBX Units Scale seems like a sensible default none the less for that option. |
As far as I know, this is an intentional preference compared to the Blender export of fbx, not sure if we can do anything about it. As far as I know there is no visual difference. How can we best resolve this? |
Tested versions
v4.3.dev4.official [df78c06]
System information
Godot v4.3.dev4 - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Thu Apr 4 20:32:38 UTC 2024 - X11 - GLES3 (Compatibility) - AMD Radeon RX 570 Series (radeonsi, polaris10, LLVM 16.0.6, DRM 3.54, 6.6.25-1-MANJARO) () - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)
Issue description
Importing FBX files that contain empties with the new UFBX feature results in empties that are 100x bigger than they should be and with the wrong rotation.
I was testing to see if I could set up scenes in Blender that used empties as instance placeholders that retain their transformations upon import in Godot as node3d nodes that I can parent my instances to. It works fine with gltf, but fbx has the above mentioned issues.
I exported the instance_test scene as both file types with default export settings in Blender and created a new inherited scene for each, then instanced the instance_marker scene into each empty on each version of the scene for the MRP below. So the gltf.tscn shows the expected results while the ufbx.tscn shows the issues being experienced.
Steps to reproduce
Drop an fbx containing empties into a project and inspect the transforms on the resulting node3d.
Minimal reproduction project (MRP)
ufbx_test.zip
The text was updated successfully, but these errors were encountered: