Gildor's Forums

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


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/joint 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 use Floaxys version of Bez's Blender addon To import umodel psk with vertex normals (from spiritvod's umodel builds) https://github.com/floxay/blender3d_import_psk_psa and matyalatte Blender addon https://github.com/matyalatte/blender3d_import_psk_psa to export final fbx (Not merging of psk/GITF) its for ue4/5 also plays nice with Maya and 3dsMax.

Import glTF and PSK, (Choose not to scale down psk in import options) 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", Destination Layers Matching should be set to "All Layers", Source Layer Selection should be set to "By Name", 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.

(video using LeftRight from AtomicHeart to show max bone influence per vertex =12)

Another problem with glTF is scale, imported model, morph targets and animation come in to small. you also can't use glTF to copy morph targets to psk as the point/vertex order will not match but you can fix glTF model and morph targets with correct scale using similar process as above, uses the psk Armature so you can use psa for animation import.

Start to finish overview using UE Viewer and Blender to import into UE4/5 with correct skin weights, morph targets, scale and vertex normals


https://www.youtube.com/playlist?list=PLlI8O56HHToDmH9OW7epgD55U3iusnjLv


Maybe useful to somebody.


« Last Edit: June 14, 2024, 03:45 by Dreadfred » Logged
Jump to:  

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