Skip to content

Commit

Permalink
Bring extension into line with KHR_materials_ior and KHR_materials_sp…
Browse files Browse the repository at this point in the history
…ecular
  • Loading branch information
MiiBond committed Jul 22, 2020
1 parent 9eacd46 commit d25209a
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 92 deletions.
63 changes: 0 additions & 63 deletions extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md

This file was deleted.

This file was deleted.

81 changes: 81 additions & 0 deletions extensions/2.0/Vendor/ADOBE_materials_clearcoat_specular/README.md
Original file line number Diff line number Diff line change
@@ -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)

Original file line number Diff line number Diff line change
@@ -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": { }
}
}

0 comments on commit d25209a

Please sign in to comment.