Skip to content
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

Required top-level object properties #639

Closed
pjcozzi opened this issue Jul 6, 2016 · 12 comments
Closed

Required top-level object properties #639

pjcozzi opened this issue Jul 6, 2016 · 12 comments

Comments

@pjcozzi
Copy link
Member

pjcozzi commented Jul 6, 2016

For example, just asset metadata and geometry objects so a valid glTF asset doesn't need to include materials and friends.

@lexaknyazev would you be able to open a PR into the 1.0.1 branch with a proposal?

@lexaknyazev
Copy link
Member

would you be able to open a PR into the 1.0.1 branch with a proposal?

As soon as we agree on specifics:

  • asset dictionary is required (this implies existence of asset.version).
  • meshes dictionary is required and must not be empty.
  • mesh.primitives array is required and must not be empty. (Btw, what's the point in empty array here?)
  • [mesh.]primitive.attributes dictionary is required. (Again, why isn't it already?) This implies requirements for non-empty accessors, bufferViews and buffers dictionaries.
  • [mesh.]primitive.material is not required.

Not sure about nodes.

@pjcozzi What do you think?


Is there any valid use case for explicit null anywhere in glTF?

@pjcozzi
Copy link
Member Author

pjcozzi commented Jul 7, 2016

All looks good. As for the previously optional properties, I think we were just being too aggressive with defaults.

I am tempted to require nodes, but there have been requests to use glTF for purely geometry, e.g., in one global coordinate system.

Is there any valid use case for explicit null anywhere in glTF?

What do you mean? Do you have an example?

@lexaknyazev
Copy link
Member

lexaknyazev commented Jul 7, 2016

Is there any valid use case for explicit null anywhere in glTF?

What do you mean? Do you have an example?

JSON values can be null (instead of undefined). It could be used as a placeholder for app-specific usage or as a stub for required fields. For example, buffer.uri for KHR_binary_glTF could be like this:

{
  "buffers": {
    "binary_glTF": {
      "byteLength": 12345,
      "uri": null // instead of "data:,"
    }
  }
}

@lexaknyazev
Copy link
Member

At the current state of spec, default material is defined as a material without technique (or extensions).
Should primitive without material property be rendered with default material or should it be excluded from rendering?

Since default material doesn't have any values, I propose to refine that part like this:

  • primitive with no material renders with default material (here's one more possible use case for null: use "material": null to disable object rendering).
  • material can't have values if material.technique is undefined.

@pjcozzi
Copy link
Member Author

pjcozzi commented Jul 7, 2016

Is there any valid use case for explicit null anywhere in glTF?

Ah, I see what you mean (#639 (comment)). I guess a property could be null, and the default value applies if the property is missing, undefined, or null? Or the default value only applies if the property is missing.

Since default material doesn't have any values, I propose to refine that part like this:

  • primitive with no material renders with default material (here's one more possible use case for null: use "material": null to disable object rendering).
  • material can't have values if material.technique is undefined.

All OK with me.

@lexaknyazev
Copy link
Member

If a property is missing, it is undefined. null is explicit, so it should be used carefully.

@pjcozzi
Copy link
Member Author

pjcozzi commented Jul 8, 2016

@lexaknyazev OK to close this? Or is there anything else to discuss about null.

@lexaknyazev
Copy link
Member

If there's nothing else for mandatory asset data, let's close this and discuss null in a separate issue.

@lexaknyazev
Copy link
Member

See #646 for null.

@pjcozzi pjcozzi closed this as completed Jul 9, 2016
@thokra1
Copy link

thokra1 commented Jan 31, 2017

I know this issue is closed, but I am befuddled that there is no rationale stated here. For our company we decided to adopt glTF 1.0 exactly for the reason that nothing was mandatory by default. This way, we are able to specify materials and all the transitively mandatory assets as needed, while the meshes are currently stored in a custom binary format and loaded by other means (i.e. not by a glTF loader). While we want to transition to glTF for all assets at some point, we cannot make this transition right now. We actually generate some more info and export directly to glTF with 3DSMax scripts.

I'm totally fine with metadata being mandatory but what is the rational behind forcing the inclusion of at a non-empty dictionary of buffers and transitive dependencies?

Is there another, more appropriate place to discuss this?

@pjcozzi
Copy link
Member Author

pjcozzi commented Jan 31, 2017

I think it is a valid use case to use glTF for just materials, so I would be fine with loosening the 2.0 spec so that nodes is optional (which implicitly makes meshes, accessors, etc. optional). The asset just would not be rendered when loaded as a glTF alone, but could be used when combined with another payload, which is increasingly common.

Also see #815 (comment)

Perhaps if scenes is not defined, nothing is rendered; this is only used when glTF is packaged with another format, e.g., a game engine format might reference glTF nodes directly.

@thokra1
Copy link

thokra1 commented Feb 2, 2017

@pjcozzi: thank you!

lexaknyazev added a commit that referenced this issue Feb 2, 2017
lexaknyazev added a commit that referenced this issue Feb 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants