-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Re-using materials on meshes with different attributes #2360
Comments
Inconsistent behavior for an explicitly invalid asset layout is a strong reason to not change the spec. Engines that do not crash on the example assets may do so with slightly different assets exhibiting similar layouts. A simple
to:
Such an extension would have to be present in the asset's |
Would you say the same applies for MaterialX/procedurals in the context of glTF? E.g., do I need many, many almost-exact copies of material graphs in the same file just because some meshes don't have specific UV coordinates? |
Since there is no ratified extension for using MaterialX graphs with glTF 2.0, little could be said about its limitations. At the very least, I'd expect some kind of instancing system as the same graph could be used with different inputs/outputs, regardless of UV sets. |
Related to
glTF is used more and more for interchange usecases. Even if glTF may not have been designed with that in mind, it is what it is.
Some of the spec make that hard, for example the requirement that all accessed attributes MUST exist on a primitive, or else the file is valid.
As an example, reusing a material that puts a texture in UV1 on a mesh that only has UV0 results in an invalid file. To make the file valid, the material must be duplicated, which increases the amount of data transmitted and reduces the usefulness for interchange. If the material is animated (e.g. with KHR_animation_pointer) then there is even more data to be duplicated to make sure the resulting file is still "validator valid".
Applications treat that differently right now. Because reusing materials in this fashion is very common, and nobody likes to suddenly have two materials instead of one to author, many applications seem to have opted for making it work nonetheless.
The attached file ✅ works / ❌ fails in
✅ Babylon
✅ Gestaltor
✅ Unity
✅ Unreal
✅ Khronos Sample Viewer
❌ three.js/model-viewer
❌ glTF Validator
UV missing in one object
UVMismatch_UV1.glb.zip
UV missing in all objects
UVMismatch_UV2.glb.zip
Personally I think it would be better if this was allowed, and there were clear rules what happens when accessing attributes that don't exist.
Behaviours found in the wild:
The text was updated successfully, but these errors were encountered: