Skip to content

Commit d25209a

Browse files
committed
Bring extension into line with KHR_materials_ior and KHR_materials_specular
1 parent 9eacd46 commit d25209a

File tree

4 files changed

+113
-92
lines changed

4 files changed

+113
-92
lines changed

extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/README.md

Lines changed: 0 additions & 63 deletions
This file was deleted.

extensions/2.0/Vendor/ADOBE_materials_clearcoat_ior/schema/glTF.ADOBE_materials_clearcoat_ior.schema.json

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# ADOBE\_materials\_clearcoat\_ior
2+
3+
## Contributors
4+
5+
* Mike Bond, Adobe, [@miibond](https://twitter.com/miibond)
6+
7+
## Status
8+
9+
Draft.
10+
11+
## Dependencies
12+
13+
Written against the glTF 2.0 spec.
14+
* Requires the `KHR_materials_clearcoat` extension to also be defined on the material
15+
16+
## Exclusions
17+
18+
* This extension must not be used on a material that also uses `KHR_materials_pbrSpecularGlossiness`.
19+
* This extension must not be used on a material that also uses `KHR_materials_unlit`.
20+
21+
## Overview
22+
23+
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.
24+
25+
## Extending Materials
26+
27+
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.
28+
29+
```json
30+
{
31+
"materials": [
32+
{
33+
"name": "varnish",
34+
"extensions": {
35+
"KHR_materials_clearcoat": {
36+
"clearcoatFactor": 1.0
37+
},
38+
"ADOBE_materials_clearcoat_specular": {
39+
"clearcoatIor": 3.0
40+
}
41+
}
42+
}
43+
]
44+
}
45+
```
46+
47+
### Clearcoat Reflectivity
48+
49+
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.
50+
51+
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.
52+
53+
| | Type | Description | Required |
54+
|----------------------------------|---------------------------------------------------------------------------------|----------------------------------------|----------------------|
55+
|**clearcoatIor** | `number` | The clearcoat IOR. | No, default: `1.5` |
56+
|**clearcoatSpecularFactor** | `number` | The clearcoat specular factor. | No, default: `1.0` |
57+
|**clearcoatSpecularTexture** | [`textureInfo`](/specification/2.0/README.md#reference-textureInfo) | The clearcoat layer's specular amount, stored in the `B` channel of a texture. | No |
58+
59+
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).
60+
This extension modifies the Fresnel contribution of clearcoat as follows:
61+
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`.
62+
63+
```
64+
coatBaseF0 = ((clearcoatIor - outside_ior) / (clearcoatIor + outside_ior))^2
65+
```
66+
67+
Then, this can be used with the specular factor to determine the overall Fresnel contribution for the clear coating.
68+
69+
```
70+
coatSpecularF0 = coatBaseF0 * clearcoatSpecularFactor * clearcoatSpecularTexture.b;
71+
coatSpecularF90 = clearcoatSpecularFactor * clearcoatSpecularTexture.b;
72+
73+
clearcoatFresnel = coatSpecularF0 + (coatSpecularF90 - coatSpecularF0) * (1 - VdotH)^5;
74+
```
75+
76+
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.
77+
78+
## Schema
79+
80+
- [glTF.ADOBE_materials_clearcoat_specular.schema.json](schema/glTF.ADOBE_materials_clearcoat_specular.schema.json)
81+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-04/schema",
3+
"title": "ADOBE_materials_clearcoat_ior glTF extension",
4+
"type": "object",
5+
"description": "glTF extension that defines the colour tint of the clearcoat.",
6+
"allOf": [ { "$ref": "glTFProperty.schema.json" } ],
7+
"properties": {
8+
"clearcoatIor": {
9+
"type": "number",
10+
"description": "The clearcoat layer's index of refraction.",
11+
"default": 1.5,
12+
"minimum": 0.0,
13+
"maximum": 1.0,
14+
"gltf_detailedDescription": "The clearcoat layer's index of refraction."
15+
},
16+
"clearcoatSpecularFactor": {
17+
"type": "number",
18+
"description": "The clearcoat layer's specular intensity.",
19+
"default": 1.0,
20+
"minimum": 0.0,
21+
"maximum": 1.0,
22+
"gltf_detailedDescription": "The clearcoat layer's specular intensity."
23+
},
24+
"clearcoatSpecularTexture": {
25+
"allOf": [ { "$ref": "textureInfo.schema.json" } ],
26+
"description": "The clearcoat layer specular intensity texture.",
27+
"gltf_detailedDescription": "The clearcoat layer's specular intensity texture. These values are sampled from the B channel."
28+
},
29+
"extensions": { },
30+
"extras": { }
31+
}
32+
}

0 commit comments

Comments
 (0)