-
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
KHR_nodes_disable extension #1760
Conversation
In general, all nodes with its child nodes are traversed and the meshes are rendered every frame. However, there are use cases, where specific meshes should be visible and some should be hidden. During runtime, these nodes are shown or others are hidden. A sample use case are products having specific attachments. | ||
Goal is to have all meshes in the glTF and to show/hide specific meshes depending on the product situation. | ||
|
||
If the visible property is `false`, the contents of the node are not visible or used. Main use case is not to render the mesh. By default, the change affects only the specified node. However, if the `recursive` property is set to `true`, all child nodes are affected as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest to use a direct hiearachy approach and mandate that if a node (parent) is disabled then all children are disabled.
Ie, render traversal stops at the first Node that is disabled.
If this is not the intended behavior I suggest to add a disable property to the Mesh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
USD has a similar solution for pruning of visible primitives (geometry)
A node will either have the value inherited or invisible.
Where invisible is always invisible and inherited will compute the visibility value for the parent.
In effect this will turn off all children when a node is hidden (by calling MakeInvisible)
The value is also animatable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think we should just make it the same behaviour.
Hi @UX3D-nopper and thanks for creating the PR I have a feeling that this is more of a runtime property than transmission property. I see the data needed to toggle nodes as configuration data and not part of glTF. The glTF usecase I see for toggling visibility would be to add support for an animation that affects node visibility (disable/enable flag) |
To share context with people outside the 3D Commerce working group, here is what I said in the email thread: I fully support the need to solve visibility that Norbert is tackling. I also agree that nodes seem to be the best target for that. I also believe this can be useful beyond Configurability as a means to hand over assets between artists without needing to show everything. But I believe that to make this relevant for Configurability this extension needs to have a dynamic nature beyond just specifying the visibility value at authoring time. I fully support Paul's comment on enabled/disabled. In our configurators using Babylonjs we use On top of that I want to make sure this is easy to use in scenarios of multiple Properties affect visibility for sections of the node graph at different levels of depth. Considering both of these threads I recommend calling this extension I believe that makes the mental model simple, intuitively communicating that a child node with Also, instead of just specifying the disabled value statically:
... I recommend to add ability to connect that to the same system of tags that would be used for material variants. We might disable something based on any of the tags being set:
... or, if we don't want to list all the negative tags, keep something disabled unless a specific tag is set:
|
I was looking for something like that. #80 seems to be somewhat related We have a concept of "views" in our app. A view is a camera plus a set of nodes to render. So my suggestion would be to allow adding some kind of "visibility tag" to nodes and also cameras. This seems similar to what @edzis suggested. Although I am not entirely sure how it must affect subtrees. I think it is a point of controversy, different people may have very different ideas about it. Maybe the behavior there should be either more flexible or more restrictive. More flexible would be to add an option that defines how the subtree is affected. I personally don't like the "flexible" option, I have seen this in another format and it was very hard to figure what is visible and what is not there. But businesses may require crazy things) UPD: only allowing it for leaf nodes won't work because a node may have both mesh and children. |
| Name | Type | Default | Description | ||
|-------------|-----------|---------|----------------------------- | ||
| `visible` | `boolean` | `true` | Node is visible or not. | ||
| `recursive` | `boolean` | `false` | Valid for children as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many engines do not support non-recursive behavior, so it can be a lot of work to implement. I personally would suggest we do not support non-recursive behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason why it is hard to support is that if the engine does not support recursive visibility, you need to add new nodes for the main hierarchy with meshes as child nodes. But this screws up trying to do animations, etc, because now there is additional nodes.
This PR is superseded by KHR_node_visibility, so this PR can be closed. The key difference is that KHR_nodes_disable allows recursive and non-recursive visibility, while KHR_node_visibility only has a single property for visibility and is always recursive. As discussed above and pointed out by @bhouston, the non-recursive behavior is not desired, so we only want the recursive behavior, which is what |
No description provided.