Gildor's Forums

Author Topic: Blenders glTF importer messes up skelmesh joint rotations when exporting to fbx  (Read 195 times)
Dreadfred
Sponsor
Jr. Member
*
Posts: 47


View Profile
Blenders glTF importer messes up skelmesh joint rotations when exporting to fbx
« on: July 10, 2023, 02:44 »

As title says Blenders gltf importer messes up skelmesh joint rotations when exporting to fbx.

https://github.com/KhronosGroup/glTF-Blender-IO/issues/1918

https://github.com/KhronosGroup/glTF-Blender-IO/issues/1662

If you export any skelmesh as gltf  with matching psk from any umodel and import both into same blender scene then scale gltf armature by 100 to match psk scale you will see they match one to one but if you export both to same fbx file  and then import back into blender the gltf no longer matches psk.

If your exporting a skelmesh with more than 5+ bone influences per vertex from custom Umodel you can copy skin weights from gltf to psk/pskx to keep correct bindpose/joint rotation and skin weights for use in UE.

to fix, I used matyalatte Blender addon https://github.com/matyalatte/blender3d_import_psk_psa to import PSK and export final fbx (Not merging of psk/GITF) its for ue4/5 also plays nice with Maya and 3dsMax.

Import glTF and PSK, Scale glTF armature 100 to match PSK.

Select Source (glTF) mesh, Ctrl-select Target (PSK) mesh so that both are selected and the Target (PSK) is the active object (ie. the object you selected last).

Go into weight paint mode and select weights/Transfer Weights (option box should pop up).

Data Type should be set to "Vertex Groups." Vertex Mapping should be set to "Nearest vertex." Source Layer Selection should be set to "By Name." Destination Layers Matching should be set to "All Layers." Mix Mode should be set to "Replace." Create Data should be checked. Object Transform should be checked. Nothing else should be checked.

Back into object mode, delete glTF armature and mesh, save blender scene and export to fbx using Blender addon from matyalatte. the end.

You can also export a glTF with animations from umodel, import it straight to UE5.2, import the fixed blender fbx to UE5.2, link it to the skeletal asset created when you imported glTF with animations from Umodel and everything should works with correct weights and animation scale (as long as animations are for that Skelmesh and not retargeted in Unreal from another one).


Maybe help somebody.

Edit, Setting Bone Dir to Blender (best for reimporting) and maybe untick Guess Original Bind Pose in glTF import popup window seems to fix issue in most cases. Copying weights is still good last resort.
« Last Edit: July 14, 2023, 05:08 by Dreadfred » Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS