-
Notifications
You must be signed in to change notification settings - Fork 1.2k
KHR_nodes_disable extension #1760
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# KHR_nodes_disable | ||
|
||
## Contributors | ||
|
||
* Norbert Nopper, UX3D (@UX3DGpuSoftware) | ||
|
||
## Status | ||
|
||
Draft | ||
|
||
## Dependencies | ||
|
||
Written against the glTF 2.0 spec. | ||
|
||
## Overview | ||
|
||
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. | ||
|
||
In general, if the `recursive` property is enabled, a renderer can stop traversing the children. There is an exception, if the nodes are joints. In this case, the matrices are still calculated. | ||
|
||
This extension does have an affect on the node itself. E.g. if the node contains a punctual light as given in the extension, the light would not be used for lighting the scene as well. | ||
|
||
## glTF Schema Updates | ||
|
||
The `KHR_nodes_disable` may contain the following properties: | ||
|
||
| 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 commentThe 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 commentThe 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. |
||
|
||
### JSON Schema | ||
|
||
[KHR_nodes_disable.schema.json](schema/KHR_nodes_disable.schema.json) | ||
|
||
### Example JSON | ||
|
||
```json | ||
{ | ||
"node": [ | ||
{ | ||
"extensions": { | ||
"KHR_nodes_disable": { | ||
"visible": false, | ||
"recursive": true | ||
} | ||
} | ||
} | ||
] | ||
} | ||
``` |
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.
https://graphics.pixar.com/usd/docs/api/class_usd_geom_imageable.html#aa0dfa061a65be443436288f7406ba3db
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.