KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.48k stars 317 forks source link

export with compress on cause uv error #2279

Open zhou1993yu opened 3 months ago

zhou1993yu commented 3 months ago

Describe the bug export with compress on cause uv error.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'file->export->gltf 2.0'
  2. with compress on and press export
  3. reimport the exported model
  4. See error below

Expected behavior

Screenshots 20240702104214 20240702104352

.blend file/ .gltf (mandatory) untitled.zip

Version

Additional context Add any other context about the problem here.

julienduroure commented 3 months ago

I can confirm. Bug is visible in online viewer like https://gltf-viewer.donmccurdy.com/, so problem comes from exporter

donmccurdy commented 2 months ago

If you zoom out considerably in the UV Editor view, on the uncompressed mesh, you'll see a small outlying UV island —

CleanShot 2024-07-26 at 21 51 15@2x

This will break quantization, which both Draco and Meshopt compression rely on — most of the available precision in the quantization grid is spent on empty space. I'm not sure how UVs end up there to begin with, but it's been a recurring issue in glTF Transform's compression as well:

I've been considering adding a step to compute a histogram for the UVs, and to show a warning if there are major outliers, or perhaps repacking the UVs, but these are potentially expensive operations for an exporter to spend time on...

julienduroure commented 1 month ago

Thanks @donmccurdy for the investigation!