diff --git a/src/Fbx2Raw.cpp b/src/Fbx2Raw.cpp index cd1d0be..44c338f 100644 --- a/src/Fbx2Raw.cpp +++ b/src/Fbx2Raw.cpp @@ -1422,9 +1422,17 @@ bool LoadFBXFile(RawModel &raw, const char *fbxFileName, const char *textureExte // Use Y up for glTF FbxAxisSystem::MayaYUp.ConvertScene(pScene); - // Use meters as the default unit for glTF + // FBX's internal unscaled unit is centimetres, and if you choose not to work in that unit, + // you will find scaling transfgrms on all the children of the root node. Those transforms are + // superfluous and cause a lot of people a lot of trouble. Luckily we can get rid of them by + // converting to CM here (which just gets rid of the scaling), and then we pre-multiply the + // scale factor into every vertex position (and related attributes) instead. FbxSystemUnit sceneSystemUnit = pScene->GetGlobalSettings().GetSystemUnit(); - scaleFactor = FbxSystemUnit::m.GetConversionFactorFrom(sceneSystemUnit); + if (sceneSystemUnit != FbxSystemUnit::cm) { + FbxSystemUnit::cm.ConvertScene(pScene); + } + // this is always 0.01, but let's opt for clarity. + scaleFactor = FbxSystemUnit::m.GetConversionFactorFrom(FbxSystemUnit::cm); ReadNodeHierarchy(raw, pScene, pScene->GetRootNode(), 0, ""); ReadNodeAttributes(raw, pScene, pScene->GetRootNode(), textureLocations);