I am trying to bake transformations of each mesh of an imported model and some meshes are distorted in the output. I figured that it is about transformations (mostly quaternions) and mesh hierarchy.
This is the PG link: https://www.babylonjs-playground.com/#B0LTE1#1
I have given some instructions as comments to try some combinations. Let me also state that I tried commenting out “boxQuat2” and give only Euler rotation to “boxQuat” with the same values, and problem continues.
The reason was to serialize the meshes for conversion and the output was distorted. I tried baking at that point and the distortion happened already before serialization. If I freeze mesh transformations in the 3D modeling software and get rid of quaternions and baking together, serialization output was successful. However, this requires me to modify all my models and do not use quaternions in my project, which is a big problem for my case.
I will be glad to receive any help. Thank you very much!!!
Is that okay if the PG link results the same?
In my local project I removed babylonjs from node_modules and ran npm install but the problem continues. Or am I missing something taking changes in?
The changes are not merged yet. They will be available in the preview CDN in one or two days, and in NPM packages in one or two weeks (it depends on when the NPM packages are rebuilt).
I am really shy to ping you this much, is it done or am I doing something wrong? (Uninstalling node_modules and reinstalling, packages:
“babylonjs”: “^4.2.0”,
“babylonjs-gui”: “4.2.0”,
“babylonjs-loaders”: “4.2.0”,
“babylonjs-serializers”: “^4.2.0”
)
The model is just a dummy one, the output is somehow translated and scaled, but a complex model I am dealing with have some meshes disappear, make some flipped etc. after baking. Sorry that I am not able to share that one.
You should unparent the root of your hierarchy (pCube1), else it will inherit its parent transformations. As they are already baked into the vertices (by the bakeCurrentTransformIntoVertices call), it means it will be applied twice: