|
| 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 | + |
0 commit comments