From d25209a5942a35df81d1b2d37d9811a380c4b393 Mon Sep 17 00:00:00 2001 From: Michael Bond Date: Wed, 22 Jul 2020 13:40:02 -0700 Subject: [PATCH] Bring extension into line with KHR_materials_ior and KHR_materials_specular --- .../ADOBE_materials_clearcoat_ior/README.md | 63 --------------- ....ADOBE_materials_clearcoat_ior.schema.json | 29 ------- .../README.md | 81 +++++++++++++++++++ ...E_materials_clearcoat_specular.schema.json | 32 ++++++++ 4 files changed, 113 insertions(+), 92 deletions(-) delete mode 100644 extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md delete mode 100644 extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/schema/glTF.ADOBE_materials_clearcoat_ior.schema.json create mode 100644 extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/README.md create mode 100644 extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/schema/glTF.ADOBE_materials_clearcoat_specular.schema.json diff --git a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md deleted file mode 100644 index 5f2f26f48b..0000000000 --- a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md +++ /dev/null @@ -1,63 +0,0 @@ -# ADOBE\_materials\_clearcoat\_ior - -## Contributors - -* Mike Bond, Adobe, [@miibond](https://twitter.com/miibond) - -## Status - -Draft. The format of the IOR texture will depend on the final format chosen for KHR_materials_ior - -## Dependencies - -Written against the glTF 2.0 spec. -* Requires the `KHR_materials_clearcoat` extension to also be defined on the material - -## Exclusions - -* This extension must not be used on a material that also uses `KHR_materials_pbrSpecularGlossiness`. -* This extension must not be used on a material that also uses `KHR_materials_unlit`. - -## Overview - -This extension defines a way to control the index of refraction (IOR) for the clearcoat layer that's provided by the `KHR_materials_clearcoat` extension. This effectively overrides the default IOR for clearcoat, which is `1.5`. - -## Extending Materials - -Adding IOR to the clearcoat can be done by adding the `ADOBE_materials_clearcoat_ior` extension to any glTF material that already has the `KHR_materials_clearcoat` extension defined on it. For example, the following defines a material with a clearcoat that has an IOR of 3.0. - -```json -{ - "materials": [ - { - "name": "varnish", - "extensions": { - "KHR_materials_clearcoat": { - "clearcoatFactor": 1.0 - }, - "ADOBE_materials_clearcoat_ior": { - "clearcoatIorFactor": 3.0 - } - } - } - ] -} -``` - -### Clearcoat IOR - -All implementations should use the same calculations for the BRDF inputs. Implementations of the BRDF itself can vary based on device performance and resource constraints. See [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) for more details on the BRDF calculations. - -As with the core glTF 2.0 spec, all coloured textures are assumed to be sRGB and all coloured factors are assumed to be linear. - -| | Type | Description | Required | -|----------------------------------|---------------------------------------------------------------------------------|----------------------------------------|----------------------| -|**clearcoatIorFactor** | `number[4]` | The clearcoat IOR factor. | No, default: `[1.0, 1.0, 1.0, 1.0]` | -|**clearcoatIorTexture** | [`textureInfo`](/specification/2.0/README.md#reference-textureInfo) | The clearcoat layer's IOR texture. | No | - - - -## Schema - -- [glTF.ADOBE_materials_clearcoat_ior.schema.json](schema/glTF.KHR_materials_clearcoat.schema.json) - diff --git a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/schema/glTF.ADOBE_materials_clearcoat_ior.schema.json b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/schema/glTF.ADOBE_materials_clearcoat_ior.schema.json deleted file mode 100644 index d44f6b330d..0000000000 --- a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/schema/glTF.ADOBE_materials_clearcoat_ior.schema.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "$schema": "http://json-schema.org/draft-04/schema", - "title": "ADOBE_materials_clearcoat_ior glTF extension", - "type": "object", - "description": "glTF extension that defines the colour tint of the clearcoat.", - "allOf": [ { "$ref": "glTFProperty.schema.json" } ], - "properties": { - "clearcoatIorFactor": { - "type": "array", - "items": { - "type": "number", - "minimum": 0.0, - "maximum": 1.0 - }, - "description": "The transmittance of the clearcoat layer.", - "default": [ 1.0, 1.0, 1.0 ], - "minItems": 3, - "maxItems": 3, - "gltf_detailedDescription": "The colour of light allowed to be transmitted through the clearcoat layer of the material. A value of black means no light passes through. A value of white means all light passes through." - }, - "clearcoatTintTexture": { - "allOf": [ { "$ref": "textureInfo.schema.json" } ], - "description": "The clearcoat layer tint texture.", - "gltf_detailedDescription": "The clearcoat layer tint texture. These values are sampled from the R channel. The values are linear. Assume white colour if no texture is supplied." - }, - "extensions": { }, - "extras": { } - } -} diff --git a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/README.md b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/README.md new file mode 100644 index 0000000000..ad93785c44 --- /dev/null +++ b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/README.md @@ -0,0 +1,81 @@ +# ADOBE\_materials\_clearcoat\_ior + +## Contributors + +* Mike Bond, Adobe, [@miibond](https://twitter.com/miibond) + +## Status + +Draft. + +## Dependencies + +Written against the glTF 2.0 spec. +* Requires the `KHR_materials_clearcoat` extension to also be defined on the material + +## Exclusions + +* This extension must not be used on a material that also uses `KHR_materials_pbrSpecularGlossiness`. +* This extension must not be used on a material that also uses `KHR_materials_unlit`. + +## Overview + +This extension defines a way to control the index of refraction (IOR) and specular F0 for the clearcoat layer that's provided by the `KHR_materials_clearcoat` extension. This overrides the default IOR for clearcoat (which is `1.5`) and also provides a way to modulate the F0 reflectivity. This is exactly analogous to the way that the `KHR_materials_ior` and `KHR_materials_specular` extensions work together to modify F0 reflectivity. + +## Extending Materials + +Adding reflectivity information to the clearcoat can be done by adding the `ADOBE_materials_clearcoat_specular` extension to any glTF material that already has the `KHR_materials_clearcoat` extension defined on it. For example, the following defines a material with a clearcoat that has an IOR of 3.0. + +```json +{ + "materials": [ + { + "name": "varnish", + "extensions": { + "KHR_materials_clearcoat": { + "clearcoatFactor": 1.0 + }, + "ADOBE_materials_clearcoat_specular": { + "clearcoatIor": 3.0 + } + } + } + ] +} +``` + +### Clearcoat Reflectivity + +All implementations should use the same calculations for the BRDF inputs. Implementations of the BRDF itself can vary based on device performance and resource constraints. See [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) for more details on the BRDF calculations. + +As with the core glTF 2.0 spec, all coloured textures are assumed to be sRGB and all coloured factors are assumed to be linear. + +| | Type | Description | Required | +|----------------------------------|---------------------------------------------------------------------------------|----------------------------------------|----------------------| +|**clearcoatIor** | `number` | The clearcoat IOR. | No, default: `1.5` | +|**clearcoatSpecularFactor** | `number` | The clearcoat specular factor. | No, default: `1.0` | +|**clearcoatSpecularTexture** | [`textureInfo`](/specification/2.0/README.md#reference-textureInfo) | The clearcoat layer's specular amount, stored in the `B` channel of a texture. | No | + +The clearcoat Fresnel contribution is usually calculated just as described for the base layer in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation). +This extension modifies the Fresnel contribution of clearcoat as follows: +The `clearcoatIor` can be used to calculate the reflectance at normal incidence for the coating (`coatBaseF0`) that will replace the default `F0` of `0.04`. + +``` +coatBaseF0 = ((clearcoatIor - outside_ior) / (clearcoatIor + outside_ior))^2 +``` + +Then, this can be used with the specular factor to determine the overall Fresnel contribution for the clear coating. + +``` +coatSpecularF0 = coatBaseF0 * clearcoatSpecularFactor * clearcoatSpecularTexture.b; +coatSpecularF90 = clearcoatSpecularFactor * clearcoatSpecularTexture.b; + +clearcoatFresnel = coatSpecularF0 + (coatSpecularF90 - coatSpecularF0) * (1 - VdotH)^5; +``` + +Note that the specular factor texture data is read from the `B` channel so that the same RGB texture can be shared between the `KHR_materials_clearcoat` and `ADOBE_materials_clearcoat_specular` extensions. + +## Schema + +- [glTF.ADOBE_materials_clearcoat_specular.schema.json](schema/glTF.ADOBE_materials_clearcoat_specular.schema.json) + diff --git a/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/schema/glTF.ADOBE_materials_clearcoat_specular.schema.json b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/schema/glTF.ADOBE_materials_clearcoat_specular.schema.json new file mode 100644 index 0000000000..8d432afa81 --- /dev/null +++ b/extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/schema/glTF.ADOBE_materials_clearcoat_specular.schema.json @@ -0,0 +1,32 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema", + "title": "ADOBE_materials_clearcoat_ior glTF extension", + "type": "object", + "description": "glTF extension that defines the colour tint of the clearcoat.", + "allOf": [ { "$ref": "glTFProperty.schema.json" } ], + "properties": { + "clearcoatIor": { + "type": "number", + "description": "The clearcoat layer's index of refraction.", + "default": 1.5, + "minimum": 0.0, + "maximum": 1.0, + "gltf_detailedDescription": "The clearcoat layer's index of refraction." + }, + "clearcoatSpecularFactor": { + "type": "number", + "description": "The clearcoat layer's specular intensity.", + "default": 1.0, + "minimum": 0.0, + "maximum": 1.0, + "gltf_detailedDescription": "The clearcoat layer's specular intensity." + }, + "clearcoatSpecularTexture": { + "allOf": [ { "$ref": "textureInfo.schema.json" } ], + "description": "The clearcoat layer specular intensity texture.", + "gltf_detailedDescription": "The clearcoat layer's specular intensity texture. These values are sampled from the B channel." + }, + "extensions": { }, + "extras": { } + } +}