Closed rarest closed 1 month ago
@zeux Could you give me some advice how to share the attributes data between different meshes?
gltfpack currently works with mesh attributes independently so the attribute data isn’t shared; doing that for an arbitrary example requires implementing deduplication on an attribute level.
Note that instances like this can be represented using KHR_materials_variants extension; if the input file contains it, gltfpack will correctly preserve it without geometry duplication. For this to work the application would need to use variant switching instead of scene switching as there’s no way to encode “active” variant per scene.
gltfpack currently works with mesh attributes independently so the attribute data isn’t shared; doing that for an arbitrary example requires implementing deduplication on an attribute level.
Note that instances like this can be represented using KHR_materials_variants extension; if the input file contains it, gltfpack will correctly preserve it without geometry duplication. For this to work the application would need to use variant switching instead of scene switching as there’s no way to encode “active” variant per scene.
Thanks for the valuable advice, I'll look into the KHR_materials_variants extension first。 By the way, is there any plan to support attribute data sharing?
By the way, is there any plan to support attribute data sharing?
Not in the short term but it can probably happen in the future.
As mentioned in 723, in the origin gltf model, mesh[0] and mesh[1] have the same attributes data(buffer index 1, 2, 4, 5) and the same indices data(buffer index 0, 3), only materials are different.
After 724 fix, the scenes informations of meshopt compress model are correct, but the meshes data are not reused, actually attributes and indices bin data of meshes[0] and meshes[1] in the compressed model are repeated. buffer index (0, 1, 2, 3, 4, 5) vs buffer index ( 6, 7, 8, 9, 10, 11) have the same data.
If vertex attributes and index data can be reused, the model size can be further reduced. Thanks!
origin.zip originMeshopt2.zip