-
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
Add KHR_mesh_variants #1790
base: main
Are you sure you want to change the base?
Add KHR_mesh_variants #1790
Conversation
We had to solve this problem (about 25years ago!) for our desktop software, STK. To make our solution compatible with glTF we added a vendor extension, AGI_articulations. Just to give a real world example of how we needed to control visibility of nodes in a model, consider a model of a launch vehicle. If this model were just taken as-is and loaded into an application, we would see flames shooting out of the boosters. When this model is loaded into our application, it will initially be placed on a launch pad and for that reason we want those flames to be hidden by default. Here's a little comparison of these two models in VSCode. On the right, I am viewing this model in Cesium, which is aware of the AGI_articulations extension and honors the default value of the scale articulation on the SRBFlames. Internally, an articulation is the definition of a constraint and default values. For the flames, this model defines a scale constraint that ranges from 0-1 with a default value of 0 (hidden). Articulations is a bit broader than what is proposed here, as an articulation also covers translation and rotation constraints. In our domain this information is used to say "this node that represents the panning of radar dish, can rotate about the y-axis between 30-130 degrees". We then use that constraint to limit transformations at runtime (e.g., the radar dish that is tracking an object cannot track beyond 130 horizontally). Obviously our vendor extension was not designed for 3D commerce, but maybe there are ideas here that can be applicable. |
@abwood Thanks for sharing this! |
In general, a glTF mesh will only have one primitive. There are exceptions to that, but many tools simply treat additional primitives as additional meshes. I would try to avoid associating too much meaning with distinct primitives in the same mesh. In many viewers, glTF files containing (a) a mesh with two primitives or (b) two meshes, would be indistinguishable after loading into the engine. Not sure whether that actually answers the question, but it may be relevant. 🙂
Perhaps something like KHR_material_variants, but at the node level:
In this case the node has no visible mesh by default, or when the
|
Don knows this already, but I feel the need to clarify for anyone else reading. One notable exception is that a single primitive may use only one glTF material. So, a mesh that uses multiple glTF materials will typically have one primitive per material. (And in a rasterizer, each primitive then roughly corresponds to one draw call, and each glTF material corresponds to one shader program associated with one stack of textures and settings). |
I'd strongly vote for For example, if you were selling different Atlas rocket configurations, you would want the ability to configure out some of the SRBs (the smaller tubes near the base) but not all of them. Multiple nodes there might reference the same SRB mesh. So you'd need the configuration on the node. Likewise, position, rotation, scale, animations, and articulations all target the node level, not meshes or primitives. |
@rsahlin I'm confused, didn't you advocate for this in #1681 (comment)? Looks like #1760 doesn't use the "variants" system that #1681 calls for. |
Well I guess that if the purpose of this extension is to allow toggling the visibility of geometry - then I think we should use the definition in #1760 - I think the behavior is clean and mimics what is used in for instance USD. Hope that clarifies your question @donmccurdy ? |
@rsahlin @emackey @donmccurdy Please see #1760 (comment)
|
Can we clarify why we're choosing to use this variants system over recommending node visibility toggling via animations? |
The animation spec does not currently support toggling visibility. |
Ok, my mistake. I thought we did support visibility. Suppose we instead implement node visibility animations; is there an inherent advantage of implementing this system instead of using animation? EDIT: |
This extension seems like it can be replaced with a combination of KHR_node_visibility and KHR_animation_pointer using animations to alter node visibility based on which animation is played, or a combination of KHR_node_visibility and KHR_interactivity using interactivity graphs to alter visibility depending on arbitrary conditions. |
This has been discussed in 3D Commerce Configurability TSG for a couple of months in relation to #1681 with general consensus that the core functionality of toggling visibility of meshes at runtime is needed. This PR attempts to communicate the needs and suggests one approach to cover not just the core needs but also more complex scenarios.
It is published at a raw state with hopes to gather feedback from a wider audience and also to ensure this extension does not require any changes to #1681 for both to be used together. Feedback is wanted.
A lot of implementation details are not yet clear. Help is wanted.