-
Notifications
You must be signed in to change notification settings - Fork 7
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
Added option to assign metadata to nodes #63
Added option to assign metadata to nodes #63
Conversation
This could potentially be solved by hierarchical metadata: CesiumGS/3d-tiles#558. Maybe that's a good enough resource to stick with the simpler approach for now.
This would make it similar to KHR_xmp_json_ld, which could be a good thing, but could also lead to the question "why not XMP?". Personally I think there's room for multiple metadata encodings as long as they're sufficiently different. (In this case the binary type system would be a differentiator). So hesitantly, yeah, it should be possible to assign metadata to other glTF elements. |
I'm also hesitating a bit. At this point, one could argue that it could/should also be possible to assign it to all |
|
||
*Defined in [glTFChildOfRootProperty.EXT_structural_metadata.schema.json](./schema/glTFChildOfRootProperty.EXT_structural_metadata.schema.json).* | ||
|
||
When property values are stored in a [Property Table](#property-tables), then the entries of this table may be associated with elements of the glTF asset. This applies to all elements that are a `glTFChildOfRootProperty`. Each of these elements can contain an `EXT_structural_metadata` object that defines the source of the metadata values for this element. It contains the `propertyTable`, which is the index of the property table in the array of property tables of the root-level `EXT_structural_metadata` extension object, and the `index`, which is the index of the row in this table that contains the metadata values for the respective element. |
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.
This applies to all elements that are a
glTFChildOfRootProperty
.
glTFChildOfRootProperty
feels a bit too jargony unless someone is familiar with the glTF schema. Should the types be listed out explicitly like in KHR_xmp_json_ld? Note that some types like accessor
and bufferView
are omitted. As a side note, which approach is easier for code generators?
If we list them explicitly maybe something like this:
Property table values can be referenced from glTF objects of type: (list out types explicitly). Each of these elements can contain an
EXT_structural_metadata
object that defines the source of the metadata values for this element. It contains thepropertyTable
, which is the index of the property table in the array of property tables of the root-levelEXT_structural_metadata
extension object, and theindex
, which is the index of the row in this table that contains the metadata values for the respective element.
@@ -0,0 +1,26 @@ | |||
{ |
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.
This document mentions "node" a few times
@@ -39,6 +39,7 @@ Written against the glTF 2.0 specification. | |||
- [Property Attributes](#property-attributes) | |||
- [Property Textures](#property-textures) | |||
- [Binary Data Storage](#binary-data-storage) | |||
- [Assigning Metadata](#assigning-metadata) |
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.
It feels more appropriate for the Assigning Metadata
section to go before Binary Data Storage
These points are somewhat interdependent. One thing that I wondered about: The schema file is currently called
is somehow related to some detail of the The point is: We could now restrict it to nodes, and call it I think that it could make sense to solve this in a similar way as |
I tried this ^ in https://github.com/javagl/glTF/tree/3d-tiles-next-node-metadata/extensions/2.0/Vendor/EXT_structural_metadata#assigning-metadata An aside: You mentioned
but the 'Binary Data Storage' is a short paragraph that is directly related to the preceding 'Metadata Storage' section - describing the 'Metadata Storage' itself, then switching to something unrelated, and then coming back to an "encoding detail" for the metadata storage looks a bit odd for me. I just made 'Binary Data Storage' a subsection of 'Metadata Storage' - could that make sense for you as well? |
@javagl all that sounds reasonable. 👍 |
When metadata is stored in a property table, it is possible to associate glTF nodes with metadata instances/entities, by adding information about the property table and the feature (row) index inside the node:
This is described in a short paragraph at https://github.com/javagl/glTF/tree/3d-tiles-next-node-metadata/extensions/2.0/Vendor/EXT_structural_metadata#node-metadata and the associated schema file.
Note: This is a draft PR for now, because there are two technical questions that might have to be discussed in more detail:
1. Should it be possible to associate multiple metadata entities with a node?
As a first shot, it could just be an array that contains the
propertyTable/index
objects that describe the actual entities:But this is not yet thought through, and if we decide to support that conceptually, then details of the structure can still be sorted out.
2. Should it be possible to assign metadata to other glTF elements (beyond nodes?)
The same structure that is used for associating metadata entities with nodes could be used for each
glTFChildOfRootProperty
. These are the elements of the top-levelglTF
object arrays, like animations, nodes, textures etc. One could argue that it's hard to find a use-case for metadata in abufferView
, but even if it is not going to be allowed generically, one could think about how this concept could later be extended to other objects in a sensible way (i.e without creating<type>.EXT_structural_metadata.schema.json
files for each of them, and in a preferably backward-compatible way...)