atteneder / glTFast

Efficient glTF 3D import / export package for Unity
Other
1.22k stars 249 forks source link

Draco exports have wrong mesh bounds at export #692

Closed anonymous2585 closed 3 days ago

anonymous2585 commented 4 months ago

Describe the bug When exporting a mesh using draco compression, the mesh bounds written in the file is inverted on the X axis.

File OffsetCube.zip

To Reproduce

See the object been culled by Unity even when still in view.

Expected behavior The bounding box is correct and user doesn't need to use Mesh.RecalculateBounds to fix the mesh bounds.

Proposed fix We fixed this issue locally by adding a - here: https://github.com/atteneder/glTFast/blob/ef121f3a88707d79c178f4d573620566b1ced6b9/Runtime/Scripts/Export/GltfWriter.cs#L1213 (changed to -center.x-extents.x,)

And here: https://github.com/atteneder/glTFast/blob/ef121f3a88707d79c178f4d573620566b1ced6b9/Runtime/Scripts/Export/GltfWriter.cs#L1219 (changed to -center.x+extents.x,)

If you look at the legacy export, there is the - sign on X axis: https://github.com/atteneder/glTFast/blob/ef121f3a88707d79c178f4d573620566b1ced6b9/Runtime/Scripts/Export/GltfWriter.cs#L1389 so we think it has been forgotten in the draco code.

Setup

anonymous2585 commented 2 months ago

@atteneder Can you please take a look at this issue? It affects people using draco exports, and the fix seems pretty easy.

atteneder commented 2 months ago

@anonymous2585 Great find and excellent report! The fix will land in one of the upcoming updates.

atteneder commented 3 days ago

The fix landed in 6.7.0.