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

KHR_texture_procedurals Draft Proposal #2381

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft

Conversation

kwokcb
Copy link

@kwokcb kwokcb commented Apr 3, 2024

Draft Proposal for KHR_texture_procedurals

  • Specification proposal ready for initial feedback.
  • Draft JSON Schema is still progress.
  • Example assets will be forthcoming in a glTF Sample Assets branch.

@lexaknyazev lexaknyazev marked this pull request as draft April 16, 2024 16:20

## Dependencies

Written against the glTF 2.0 spec.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should MaterialX 1.39 spec be added as a dependency.


1. **Interoperability**: Adhere to an industry a standard node schema (MaterialX) with a runtime friendly JSON representation.

More specifically __only__ nodes defined in the MaterialX specification are supported. This ensures that the procedural graphs can be easily converted to MaterialX and USDShade graphs.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MaterialX "1.39" specification

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second extension will be written against gltf 2.0 and KHR_procedural


For the first version of this extension nodes which are used to define shading models are not allowed. Please refer to the [resources](#resources) section for links to supported MaterialX node definitions.

2. **Fidelity**: Provide the ability to generate complex patterns, noise, or other effects that currently must be "baked" into texture maps. Provide the ability to provide mappings from one shading model to another without baking in a consistent manner via procedural graphs. Provide the ability to support NPR effects for unlit materials. Reduces runtime memory usage by generating patterns / shading programmatically.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Provide the ability to support NPR effects for unlit materials" - is this required?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be changed to say that you can map to a "unlit" material in glTF. So NPR can be removed in mapping procedural textures to unlit.

Comment on lines 107 to 115
```json
{
"extensions": {
"KHR_texture_procedurals": {
"mimetype": "application/mtlx+json;version=<MaterialX_version>",
"procedurals": []
}
}
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following up from last call, proposed change is to simply mention

"extensions": {
        "KHR_texture_procedurals"
    }

Which indicates that gltf texture procedural "structure" is used.
When gltf texture procedural uses MaterialX 1.39 nodes the extension will be

"extensions": 
                "KHR_texture_procedurals_MaterialX_1.39": {
}

Example usage:

"extensionsRequired" : [
    "KHR_texture_procedurals"
]
"extensionsUsed" : [
    "KHR_texture_procedurals_MaterialX_1.39"
]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use case #1 gltf using Mtlx 1.39
extensionsRequired" : [
"KHR_texture_procedurals"
"KHR_texture_procedurals_MaterialX_1.39"
]
use case #2 gltf using Mtlx 2.0
extensionsRequired" : [
"KHR_texture_procedurals"
"KHR_texture_procedurals_MaterialX_2.00"
]
use case #3
extensionsRequired" : [
"KHR_texture_procedurals"
"NV_MDL_texture_procedurals"
]
(mixing of procedurals is not allowed, only one node library can be used at a time)
extensionsRequired" : [
"KHR_texture_procedurals"
"KHR_texture_procedurals_MaterialX_1.39"
"KHR_texture_procedurals_MaterialX_2.00"
]

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean to include NV_MDL_texture_procedurals is there some co-dependency implied here or just an example ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does the extenions portion look like. Is it still this ?

{
    "extensions": {
        "KHR_texture_procedurals": {
            "procedurals": []
        }
    }
}

Or do you need something like this ?

{
    "extensions": {
        "KHR_texture_procedurals_MaterialX_1.39": {
            "procedurals": []
        }
    }
}

Comment on lines 116 to 135
```
It is assumed that a mimetype is always required. As part of the mimetype a version `<MaterialX_version>` is specified. This is the version of the MaterialX library specification used when writing to glTF. The version is specified as a string in the form of `<major version>.<minor version>`. For example, if the MaterialX library version is 1.39, the mimetype would be `application/mtlx+json;version=1.39`.

The correspond version is specified in a MaterialX XML document as follows:

```xml
<materialx version="1.39">
</materialx>
```

The version in the mimetype __is not__ the extension version. If in the future the schema needs to be modified (perhaps due to changes in MaterialX) then a new extension version would be required.

The `procedurals` array specifies the procedural graphs that are used in the glTF asset.

### Versioning

Elements from different versions of MaterialX is disallowed. External tooling must handle this (e.g. by performing an "upgrade" operation).

<img src="./figures//version_upgrade.svg" width=100%>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section can be removed since use of KHR_texture_procedurals + KHR_texture_procedurals_MaterialX_1.39 will imply MaterialX library used.

```json
{
"extensions": {
"KHR_texture_procedurals_MaterialX_1.39": {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct usage ? i.e. the extension is hard-coded to a version ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants