Open sanjeetsuhag opened 3 years ago
Thanks for sharing @sanjeetsuhag
@bghgary is this potentially interesting to you as a progression of MSFT_lod?
Thanks for this proposal!
One of the lingering issues I have with KHR_materials_variants
is that we didn't fully address the concept of the "default" material that appears outside the extension. In the StainedGlassLamp model for example, there are two variants, "Lamp On" and "Lamp Off", and most software shows a third variant, typically with some incongruent name like "Default" or "None".
Invariably, "None" ends up being the same as one of the other selections from the list, although which one is not immediately apparent to the user. It's guaranteed to be the one shown by viewers that don't support variants, however.
Ideally, the extension's design would not allow for a third-wheel un-named option like this. Instead, it would ensure that one particular option was the default option, and exactly matched the selection shown by viewers that don't handle the extension.
In the template glTF shown above, it looks like this proposal doesn't offer a fallback path at all. There's no default node to show when the viewer doesn't process the extension. I would think that the pristine car might be the one to show by default. If that can be added without duplicating my main issue with material variants, that would be great.
One more thought: Is it easier for most engines to swap out part of the node tree? Or would it be simpler to swap out just the mesh attached to one node, allowing the node tree to remain static? Each node could have a standard mesh index and a list of variant mesh indices, perhaps.
Related: There was a similar proposal for mesh variants last year in #1790. It needs a bit of work given what we know now about material variants, but is similar in spirit.
Also somewhat related: KHR_nodes_disable extension proposal, #1760
When using glTF models in a simulation or even on a e-commerce website, it may be useful to provide geometric variations inside a model. The KHR_materials_variants extension enables using variants in materials; this issue is for discussion on how to enable node/mesh variants in glTF.
The example I'm working with is of a car (and its components) that can have "damage states". These damage states may be:
Let's look at what could actually change between damage states, in increasing order of flexibility:
KHR_material_variants
and morph targets/animation/skinning (essentially pre-baking static poses).variants
of amesh
in anode
.A node is switched
variants
of anode
.Here's a snippet of a glTF where we use "switch nodes" with variants - using a simple extension inspired by
KHR_material_variants
. A "switch node" cannot have amesh
and its children can only be other switch nodes. When a variant is not selected, the0
th variant is the default.Here is a graphic for the schema above:
This is just an initial design and example. We're hoping to get some more insight on how to best achieve the functionality described. Also, discussions on other use cases for such functionality are welcome.