You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|**clearcoatFactor**|`number`| The clearcoat layer intensity. | No, default: `0.0`|
@@ -62,34 +61,100 @@ The following parameters are contributed by the `KHR_materials_clearcoat` extens
62
61
|**clearcoatRoughnessTexture**|[`textureInfo`](/specification/2.0/README.md#reference-textureInfo)| The clearcoat layer roughness texture. | No |
63
62
|**clearcoatNormalTexture**|[`normalTextureInfo`](/specification/2.0/README.md#reference-normaltextureinfo)| The clearcoat normal map texture. | No |
64
63
65
-
The clearcoat BRDF is layered on top of the glTF 2.0 Metallic-Roughness material, including emission and all extensions. The `clearcoatFactor` determines the view-independent intensity of the clearcoat BRDF. If `clearcoatFactor` (in the extension) is zero, the whole clearcoat layer is disabled. Implementations of the BRDF itself can vary based on device performance and resource constraints. As in the specular term of the glTF 2.0 Metallic-Roughness material, the roughness input is squared to make it perceptually linear, and the Fresnel term uses a fixed refractive index of 1.5, corresponding to a F0 of 0.04.
64
+
If `clearcoatFactor` (in the extension) is zero, the whole clearcoat layer is disabled.
66
65
67
66
The values for clearcoat layer intensity and clearcoat roughness can be defined using factors, textures, or both. If the `clearcoatTexture` or `clearcoatRoughnessTexture` is not given, respective texture components are assumed to have a value of 1.0. All clearcoat textures contain RGB components in linear space. If both factors and textures are present, the factor value acts as a linear multiplier for the corresponding texture values.
If `clearcoatNormalTexture` is not given, no normal mapping is applied to the clear coat layer, even if normal mapping is applied to the base material. Otherwise, `clearcoatNormalTexture` may be a reference to the same normal map used by the base material, or any other compatible normal map.
70
74
71
-
## Implementation Notes
75
+
The clearcoat effect is modeled via a microfacet BRDF. The BRDF is layered on top of the glTF 2.0 Metallic-Roughness material, including emission and all extensions, using a new `fresnel_coat` function:
76
+
77
+
```
78
+
# from glTF 2.0 Metallic-Roughness material (core)
79
+
material = mix(dielectric_brdf, metal_brdf, metallic)
80
+
81
+
# clearcoat
82
+
clearcoat_brdf = specular_brdf(
83
+
normal = clearcoatNormal,
84
+
α = clearcoatRoughness^2)
85
+
86
+
# layering
87
+
coated_material =
88
+
fresnel_coat(
89
+
normal = clearcoatNormal,
90
+
ior = 1.5,
91
+
weight = clearcoat,
92
+
base = material,
93
+
layer = clearcoat_brdf)
94
+
```
95
+
96
+
The `fresnel_coat` function adds a BRDF as a layer on top of another BSDF according to `weight` and a Fresnel term. The layer is weighted with `weight*fresnel(ior)`. The base is weighted with `1-(weight*fresnel(ior))`. `normal` is a float3 vector that affects the top layer, but not the base.
97
+
98
+
### Implementation
72
99
73
100
*This section is non-normative.*
74
101
75
-
All implementations should use the same calculations for the BRDF inputs. See [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) for more details on the BRDF calculations.
102
+
Implementations of the BRDF or the layering operator can vary based on device performance and resource constraints.
103
+
104
+
#### Clearcoat BRDF
105
+
106
+
The specular BRDF for the clearcoat layer `clearcoat_brdf` is computed using the specular term from the glTF 2.0 Metallic-Roughness material, defined in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation). Roughness and normal are taken from `clearcoatNormal` and `clearcoatRoughness`.
76
107
77
-
The clearcoat formula `f_clearcoat` is computed using the specular term from the glTF 2.0 Metallic-Roughness material, defined in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation). Use specular F0 equal `0.04`, base color black `0.0, 0.0, 0.0`, metallic value `0.0`, and the clearcoat roughness value defined in this extension as follows:
108
+
#### Layering
109
+
110
+
The `fresnel_coat` function is computed using the Schlick Fresnel term from the glTF 2.0 Metallic-Roughness material, defined in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation).
and finally, substituting and simplifying, using some symbols from [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation) and `Nc` for the clearcoat normal:
In order to make the material energy conserving with a simple layering function, we compute the microfacet Fresnel term with `NdotV` instead of `VdotH`. That means that we ignore the orientation of the microsurface. As the clearcoat roughness is usually very low the microfacets orientation is very close to the normal direction, and `NdotV ≈ NdotL`.
149
+
150
+
The simple layering function ignores many effects that occur between clearcoat and base layer. For example:
151
+
* The clearcoat layer is assumed to be infinitely thin. There is no refraction.
152
+
* The index of refraction of clearcoat and base layer do not influence each other. The Fresnel terms are computed independently.
153
+
* There is no scattering between layers.
154
+
* There is no diffraction.
155
+
156
+
More sophisticated layering techniques that improve the accuracy of the renderings are described in [Appendix B](/specification/2.0/README.md#appendix-b-brdf-implementation).
0 commit comments