KhronosGroup / KhronosGroup/glTF
Disambiguation of attribute semantic names
- Dominant language
- HTML
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 17h 26m
- Merged PRs (30d)
- 5
Description
The [(Meshes) Overview](https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#meshes-overview) section of the specification says
> Application-specific attribute semantics **MUST** start with an underscore, e.g., `_TEMPERATURE`
Some questions are not sufficiently answered by this.
---
The first question is very vague and hard to answer specifically: What constitutes "application-specific"?
---
A broader, more specific, and somewhat crucial question is: Is it possible to disambiguate custom attribute names in extensions?
For example, there could be two extensions that both define a generic attribute name like `_ID` or `_VALUE`. The name clash would prevent the extensions to be used at the same time. A seemingly simple and straightforward solution would be to require the attribute names to be prefixed with the extension name. Something like `"_EXT_foo_bar_ID"` looks a bit odd, but is as unambiguous as it gets. In any case: _Only_ requiring the undescore prefix may not be sufficient (also because there is no way to sensibly figure out which extension might already use which attribute names).
---
A question that is somewhat tangential, but brought up this one (via https://github.com/CesiumGS/3d-tiles/issues/611 ): Can extensions define custom attributes _without_ the `_` underscore?
Based on my understanding, the answer to this is **no**: The validator dedicatedly checks for the semantics that are defined in the core spec, and only skips the ones that start with an undescore, via the [`checkAttributeSemanticName`](https://github.com/KhronosGroup/glTF-Validator/blob/e60dd6d6a96aed2fa18e80af2bfffe5436684438/lib/src/base/mesh.dart#L171) function, causing a `MESH_PRIMITIVE_INVALID_ATTRIBUTE` error for **all** unknown attribute names that do **not** start with an underscore. But I wanted to ask for a confirmation here: Is it correct that such attribute names would be considered as invalid _even when_ the support for the extension was added to the validator?
Contributor guide
Research direction
Start with the Meshes Overview section of the glTF 2.0 specification and the validator entry point checkAttributeSemanticName in lib/src/base/mesh.dart. Review the linked 3D Tiles discussion and comment thread for context. Done means the specification and validator behavior have an agreed, unambiguous resolution for extension-defined attribute names.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100