-
Notifications
You must be signed in to change notification settings - Fork 510
Deduplicate Meshes does not preserve Materials of Mesh Instances with differing Materials #836
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
Comments
Hm, I'm not sure if I can follow the Blender explanation. When using "duplicate linked" and then assigning materials via Object overrides, the resulting GLB looks completely correct to me – it has 1 (shared) mesh and 3 materials, in this case: ![]() But I can confirm that it behaves incorrectly on import in UnityGLTF – it creates 3 meshes with deduplication set to "None" (it should only create one) and the materials get messed up with "Deduplicate: Meshes". Thanks for the report! This is unexpected – those code paths are quite well tested – so it's likely a regression. Test file: InstancedMeshes.glb.zip |
Hey, thanks. Its not a bug in the Blender exporter then. I did not find any other tool to confirm, that the duplication is in the exported glTF. The only Bug is the one in the UnityGLTF Importer. Which tool did you use to inspect your .glb? I would like to check mine. |
Hi again, the tool I used here is https://viewer.needle.tools. Clicking on "File Info" will show meshes and materials in the file. If you need even more low-level data, you can click on "JSON" to see the actual glTF JSON from the file, and can navigate into meshes, materials and so on. Would you mind checking if the referenced PR fixes your issue? |
Hey. Thanks for the update. The PR does fix the deduplication issue. Good job. I think this issue should probably remain open until the initial duplication of the meshes in the importer is also fixed. Go ahead and close it if you prefer to make a separate issue out of that. |
Describe the bug 💬
When exporting a .glb from Blender that has several instanced cubes with different materials (the materials are assigned to the objects, not the object data), we produce a .glb with duplicated meshes that could be deduplicated. Essentially we are not using instances anymore. We could use the "Deduplicate Resources: Meshes" feature to get rid of these duplicates, but unfortunately when doing that, the material assignments are lost. Read through the steps to reproduce below, to better understand what I mean.
Does the .glTF Format allow for instances with different materials? If yes, than this would be a bug in the Blender exporter, correct?
I am aware of the material variants extension.
In any case, this report is about the "Deduplicate" feature messing up the material assignments.
Steps to reproduce 🔢
How to creata .glb that has this issue with Blender:
How to reproduce the Problem in Unity:
The material Assignments should be retained.
Files to reproduce the issue ♻
No response
Editor Version 🎲
6000.0
Render Pipeline and version
17.0.4
UnityGLTF Version
2.16.0-pre.2
Operating System 👩💻
Windows
When does this problem happen?
Additional Info 📜
No response
Validations 🩹
The text was updated successfully, but these errors were encountered: