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.52k stars 324 forks source link

Reimporting assets that use KHR_materials_variants breaks variants #2431

Closed The0Dev closed 1 week ago

The0Dev commented 1 month ago

Describe the bug When I export an asset that uses KHR_materials_variants and import it back it somehow ends up broken.

To Reproduce Steps to reproduce the behavior:

  1. Import suzanne_mv_test.glb (this asset passes validation without any errors and can be viewed in Babylon.js)
  2. See that variants are not displayed properly. Exporting this asset back produces a broken gltf file. image

Expected behavior It should be possible to export and reimport assets that use KHR_materials_variants and preserve their functionality.

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

Version

julienduroure commented 1 month ago

Confirmed. The root issue is not the import, neither re-exporting it. But the root cause is the initial export that creates the suzanne_mv_test.glb file, with extras. This extras (that store variant) info needs to be excluded from export. Because, when importing variants + extras, there are some conflict.

Tested with importing without any extras (in debug), and can see the variants, and re-export is OK (tested in babylonjs)