Closed opengenius closed 6 years ago
Hi,
ConvertMatrix is expected to convert from fbx scene axis / unit system, to ozz right handed / meter system. The scale of a matrix isn't supposed to be affected by this transformation. Rotation is affected by axis system change, translation is affected by both axis system and unit changes. So I'd say it behaves as expected.
Please give more details on your issue if this is not what you were asking.
Guillaume
The scale of a matrix is representing unit system, fbx scene has default cm units, and is supposed to be converted to meters. 1 meter cube is exported with scaled transform(100, 100, 100) in cm. After processing with ConvertMatrix it is supposed to be (1,1,1) in meter system, but it wont. You can try placing FbxSystemUnit::m.ConvertScene(scene_); into FbxSceneLoader::ImportScene, and look at the resulting scale values then.
Hi,
I understand scaling can be used to convert units. That's not the way I think it should be done though.
Think of a 1m cube, scaled with a factor 10 (for any artistic reason). Cube vertices positions might be expressed in inch, or cm in the fbx file, ozz will convert them to 1m. The scaling of the cube transformation graph remains the same though, with a 10x factor if that's what was decided in the DCC. If one wants to reuse the 1m cube, he'll be expecting it to have vertices at 1m from each other indeed, without having to bother about the scaling of its node graph hierarchy.
If fbx is modifying scaling when being saved, that I don't know and I can't rely on, because anyway I don't know what unit was used before converting/saving the scene to fbx.
It's the same with a skeleton: translations are converted, scale maintained.
That's ozz strategy, but that might be wrong. There are some unittests in ozz that mixes Collada/Fbx/meter/cm/inch that are working fine, but there might be a bug. So please send a repro; ideally modifying a sample in a fork and providing a fbx file.
Also, I don't rely on FbxSystemUnit::ConvertScene to do the right thing. This thread shows it's not working properly even with fbx sdk samples.
Cheers, Guillaume
Hey, I've got your point and definitely agree with you on the scaling strategy, I can't check autodesk DCCs right now, but I assume they all are using cm as default and don't touch the scale part, I was importing my test meshes from Blender and it is using the opposite strategy by default (proposed by fbx sdk with its ConvertScene) which is really weird for engine content when you have your scene scaled by 100 but in cm (and then these scales are passed everywhere and mesh must be downscaled by 100 to persist its desired size). I've found a simple solution for this inconvenient Blender behaviour though. Just one button performs export in meters and doesn't modify scale matrices. http://blog.mattnewport.com/fixing-scale-problems-exporting-fbx-files-from-blender-to-unity-5/
Good to hear. Thanks for sharing the tip!
Passing down scale matrix with 100 factor returns matrix with the same scaling (multiplying with inverseconvert scales back to 100).