New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Max2Babylon: Meshes are 'optimized' even if 'Try to optimize vertices' is off #608
Comments
Interesting. I'm not sure off hand why this would happen, I'll have to debug through our mesh export process and see why we would be optimizing regardless of provided export setting after I take a look at #602 |
Can you help me reproduce this? All meshes have optimized toggle disabled, with the only difference between the left and right pairs are their starting scale of 0.001, which is changed to 1 at frame 11. The top and bottom pairs are optmized and unoptimized versions of the same initial mesh, the unoptimized mesh with a vertcount of 60588, and the optimized with a vert count of 21342. |
Thank you for looking into this. Do your meshes look fine in the resulting gltf? Also what unit settings are you using? |
I have no clue, what could be different on my side, that it just works for both of you. |
Thanks for the repro scene, this definitely helped me understand the root cause here: Exporters/3ds Max/Max2Babylon/Exporter/BabylonExporter.Mesh.cs Lines 739 to 751 in 992d3d5
We retrieve world space mesh vertex coordinates from max, then use the world-to-local matrix to get the mesh vertices with respect to the local (mesh parent) transform. This worked in my repro scene as I only scaled to 0.001 of the original scale, while you used a scale of 0.00001. I'm getting increasingly convinced that this causes us to lose precision in calculating the local-space coordinates of our vertex positions, which is why the meshes appear compressed. yikes. I'll try to see if we can work around this issue (Like why don't we transform from object-space vertex coordinates?) |
Oh yes you are definitely right. Doing a quick check by using object space. But of course it breaks rotations to change just these lines as can be seen by my flipped objects. :)
and |
It seems the BabylonJS Exporter does some sort of mesh optimization or compression when exporting and there seems to be no way to turn this off. Toggling 'Try to optimize vertices' does not have any effect on this.
The screenshot shows two objects which should look the same. But the one with the jagged edges is scale to 0.001 at the start of the animation and shows up with only half the vertices in the Babylon sandbox (7072 instead of its original 18852). Everything but the starting scale is the same between these to objects in
The text was updated successfully, but these errors were encountered: