-
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
Define conventions and best practices for naming and data layout in glTF extensions #2311
Comments
Short notes:
|
Thanks for replying! I do indeed want to bump this up on your TODO list for this year, but also we can wait a few months for people to reply to this issue with feedback.
The structure of KHR_lights_punctual is also similar, although it has a much flatter hierarchy, with color, intensity, and range properties on the base JSON, and a sub-JSON to describe cone angles.
I see that the text you linked only covers the "scope" plurality, but not the "feature" plurality. |
Almost anything in glTF can have a name, even though it's not a unique identifier to be used for references — mesh primitives are the only important exception that comes to mind.
I'm not sure a rule would serve us well for the "feature". Generally the feature serves as a modifier to the scope. If it were a noun I suppose it should probably default to singular, but exceptions like Also relevant: |
Another point, we should consider standardizing references to vanilla glTF data structures. For example, if a As far as I know, existing extensions are already consistent in this aspect (although in vanilla glTF itself there are some cases where this isn't followed). For example the WIP physics extensions are using |
I'm using the |
For discussion about a specific case involving the best practice of using |
When designing a new glTF extension, it would be nice to have guidelines for how to structure the data "the glTF way". These guidelines would be helpful to everyone for both Khronos extensions and vendor extensions.
Let me give an example. Does Khronos recommend using a
"type"
string enum to describe the behavior of an object, or are boolean flags preferred? For example, glTF cameras are defined using"type": "perspective"
or"type": "orthographic"
. Is this the recommended way extensions should define types? What about"isOrthographic"
or"isPerspective"
booleans? Similarly, KHR_lights_punctual uses"type"
. Context: There is ongoing debate on whether physics body motion should have its behavior type defined with a string-based enum like"type": "dynamic"
or"type": "kinematic"
, or if it should use an"isKinematic"
boolean. Since "not kinematic" isn't the same meaning as "dynamic", an enum makes sense to me.Another example, type-specific data. From looking at glTF cameras, it seems like the glTF way is to combine a type enum with sub-JSON, like
{ "type": "perspective", "perspective": { ... } }
. However, I have seen other proposed layouts, including key-only{ "perspective": { ... } }
and flat{ "type": "perspective", ... }
. Which is preferred for new extensions?Yet another example, extension name plurality. Do we want extension names to be singular, plural, or does it depend on the context? The current list of extensions are mixed. For example, we have extensions prefixed with
KHR_materials_
andKHR_texture_
. This is a weird inconsistency, why notKHR_material_
orKHR_textures_
? There is no difference in usage, I looked at bothKHR_materials_sheen
andKHR_texture_basisu
, each instance of the extension defines properties for only one thing (a material or a texture).Last example, extension name prefixes. Do we want to group together related extensions with the same prefix? For example,
KHR_materials_
,KHR_mesh_
, andKHR_texture_
. The names of the physics extensions is currently an ongoing debate, I personally would like to see them all prefixed withKHR_physics_
, but there is resistance to this.To be clear, I am not suggesting that we rename or change existing ratified extensions, but I am suggesting to create guidelines to be consistent for all new extensions. It's better to have a guideline that all extension authors can follow rather than having debates about conventions for each extension. It's not productive to be stuck debating these minor details when we could instead agree on a guideline for all new extensions to follow.
The conventions and best practices for glTF extensions would have the following goals:
Ensure that the data is laid out in a consistent way between extensions, so that extension implementers are not surprised when implementing a new extension.
Ensure that data in an extension is designed with a similar level of flexibility as other extensions or glTF itself.
Minimize the friction if an extension is moved into a new namespace, such as if Khronos adopts the extension. If the original spec used a boolean flag, and Khronos uses a type enum, that's more friction compared to if the original spec started out with the data formatted in a way that Khronos considers best practice for glTF.
The text was updated successfully, but these errors were encountered: