From 4e02cc6fc005a73a2a8dcc202f164155d0a607e0 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Tue, 15 Apr 2025 14:38:00 +0100 Subject: [PATCH 1/8] Prelimiary proposal for fixing the coat darkening statement in the spec to avoid color shifts --- index.html | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 6f53c48..cdcad3f 100644 --- a/index.html +++ b/index.html @@ -946,29 +946,32 @@ ![Figure [coat_darkening_grid]: Diffuse base with a clear-coat, for coats of different relative IOR $\eta_c$](images/coat_darkening_grid.png width="60%") -However this darkening may not always be desirable artistically, as in some applications it is beneficial for the observed color of the coated color to "match" the input base color (in a sense defined more precisely below in equation [undarkened_coat_albedo]). We allow for this by introducing a **`coat_darkening`** parameter, $\delta$. By default $\delta$ = $1$, in which case the physically correct darkening effect due to internal reflections occurs as normal. In the case $\delta$ = $0$ however, the base albedo is instead _boosted_ uniformly by just enough to counteract the darkening effect. The boost factor is reduced to 1 linearly as $\delta \rightarrow 1$. +However this darkening may not always be desirable artistically, as in some applications it is beneficial for the observed color of the coated color to "match" the input base color (in a sense defined more precisely below in equation [undarkened_coat_albedo]). We allow for this by introducing a **`coat_darkening`** parameter, $\delta$. By default $\delta$ = $1$, in which case the physically correct darkening effect due to internal reflections occurs as normal. In the case $\delta$ = $0$ however, the base albedo is modified to "counteract" the darkening effect. To describe what we mean by "counteract the darkening", we write the coat albedo in the general form +\begin{equation} \label{general_coat_albedo} +\mathbf{E}_c = F_0 + (1 - F_0) \mathbf{X} \ . +\end{equation} +where $F_0$ is the normal incidence Fresnel factor of the coat, $T_\mathrm{coat}$ is the coat absorption transmittance, and $E_b$ is the base albedo at normal incidence. -What we mean by "counteract the darkening" is defined as the albedo of the coated base viewed at normal incidence, $E_c$, being equal to the "un-darkened" albedo -\begin{equation} \label{undarkened_coat_albedo} -E_c = F_0 + E_b (1 - F_0) = \mathrm{lerp}(F_0, 1, E_b) +We then require that the effect of $\delta$ = **`coat_darkening`** is to multiply $\mathbf{X} \rightarrow B(\delta) \mathbf{X}$ by the scalar boost factor +\begin{equation} \label{undarkened_coat_albedo_scaling} +B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{X})}, 1, \delta \biggr) \ . \end{equation} -where $E_b$ is the base albedo at normal incidence, which is a straightforward interpretation of the requirement for the observed color of the coated base to match the uncoated base, taking into account the presence of the Fresnel effect of the coat. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be boosted by some compensating uniform "boost" factor $B_0$ in order for the coated base to achieve this un-darkened albedo. The effect of $\delta$ = **`coat_darkening`** is then defined to be the following modulation of the applied boost factor: -\begin{equation} \label{boost_factor} -B(\delta) = \mathrm{lerp}(B_0, 1, \delta) \ . +This is a straightforward interpretation of the requirement for the *luminance of the base* of the "un-darkened" coat to be equal to what it would be if the albedo was given by the usual un-darkened albedo scaling formula, while retaining the chromaticity of the physically darkened coat: +\begin{equation} \label{undarkened_coat_albedo} +\mathbf{E}^U_c = F_0 + \mathbf{T}^2_\mathrm{coat} \, \mathbf{E}_b (1 - F_0) \end{equation} -While this defines the behavior at a physical level, in practice implementations will need to develop some specific approximation for the coat darkening effect. + +While this defines the behavior at the level of the required albedos, in practice implementations will need to develop some specific approximation for the coat darkening effect consistent with their physical approximations. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be boosted by some compensating uniform RGB "boost" factor $\mathbf{B}_0$ in order for the coated base to achieve this un-darkened luminance. While this can be implementation dependent, we suggest here a reasonably simple, efficient scheme which captures the essential behavior. -It can be shown that in the case of a Lambertian base with (constant) albedo $E_b$ and a perfectly smooth dielectric clear-coat -- the so-called _interfaced Lambertian_ model ([#Elias2001], [#d'Eon2021]) -- that the exact directional albedo of the coated base has the albedo-scaling-like form (where $\eta_c$ is the ratio of the coat IOR to the ambient IOR, and $F$ is the corresponding coat Fresnel factor): +Physically, it can be shown that in the case of a Lambertian base with (constant) albedo $E_b$ and a perfectly smooth dielectric clear-coat -- the so-called _interfaced Lambertian_ model ([#Elias2001], [#d'Eon2021]) -- that the exact directional albedo of the coated base has the albedo-scaling-like form (where $\eta_c$ is the ratio of the coat IOR to the ambient IOR, and $F$ is the corresponding coat Fresnel factor): \begin{equation} \label{interfaced_lambertian_albedo} -E_c(\omega_o) = F(\omega_o, \eta_c) + E_b \Bigl(1 - F(\omega_o, \eta_c)\Bigr) \Delta(E_b, \eta_c) +\mathbf{E}_c(\omega_o) = F(\omega_o, \eta_c) + \mathbf{E}_b \Bigl(1 - F(\omega_o, \eta_c)\Bigr) \mathbf{\Delta}(\mathbf{E}_b, \eta_c) \end{equation} -where $\Delta(E_b, \eta_c)$ is a darkening factor given by +where $\mathbf{\Delta}(\mathbf{E}_b, \eta_c)$ is a darkening factor given by \begin{equation} \label{general_darkening_formula} -\Delta(E_b, \eta_c) = \frac{1 - K}{1 - E_b K} \ . +\mathbf{\Delta}(\mathbf{E}_b, \eta_c) = \frac{1 - K}{1 - \mathbf{E}_b K} \ . \end{equation} -We can thus approximate the required boost factor as the reciprocal of this, i.e. $B_0 \approx \Delta^{-1}$. Note that as $E_b \rightarrow 1$, the darkening factor $\Delta \rightarrow 1$, as required since physically no energy is lost if the base reflects all incident energy (in the clear-coat case). If the base albedo $E_b$ is boosted by $B(\delta)$, then clearly at $\delta=0$ the darkening factor cancels and equation [undarkened_coat_albedo] is satisfied as required. - Here $K \in [0,1]$ is the _internal diffuse reflection coefficient_, which corresponds to the fraction of the energy leaving the base which returns to the base due to internal reflection from the coat. Higher values of $K$ lead to more internal reflections, thus more darkening and saturation. In the case of a Lambertian base (which should be a reasonable approximation to the rough metal, dielectric, or diffuse cases), $K = K_r$ where, with relative coat IOR $\eta_c$: \begin{equation} \label{internal_diffuse_reflection_coefficient_for_rough_base} @@ -979,7 +982,6 @@ K_s = F(\omega_o, \eta_c) \ , \end{equation} which becomes exact in the limit of a perfectly smooth metallic or dielectric base. There is significantly less darkening in the case of a smooth base, as the specular reflection from the base is less likely to generate total internal reflection at the coat boundary. - We thus recommend in the general case that the darkening factor of equation [general_darkening_formula] be applied, but taking \begin{equation} \label{internal_diffuse_reflection_coefficient_for_general_base} K = \mathrm{lerp}(K_s, K_r, r_b) @@ -994,9 +996,20 @@ \end{equation} while the metallic roughness can be taken to be $r_m = r$. (Note that in this formula for $r_d$, a clamp must be applied to ensure that $\xi_s F_s \in [0, 1]$). +Incorporating the absorption coefficient is more complicated, but a reasonable approximation at normal incidence is to replace +\begin{equation} \label{general_darkening_formula_with_absorption} +\mathbf{\Delta}(\mathbf{E}_b, \eta_c) = \frac{1 - K \mathbf{T}^2_\mathrm{coat}}{1 - \mathbf{E}_b K \mathbf{T}^2_\mathrm{coat}} \ . +\end{equation} +and equation [interfaced_lambertian_albedo] is modified with an additional $\mathbf{T}^2_\mathrm{coat}$ factor in the second term. + +We can thus approximate +\begin{equation} \label{B_approx} +B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b \mathbf{\Delta})}, 1, \delta \biggr) \approx \mathrm{lerp}\biggl(\frac{1}{\mathrm{lum}(\mathbf{\Delta})}, 1, \delta\biggr) \ . +\end{equation} + Given the general formula equation [general_darkening_formula] for the darkening, a reasonable approximate scheme -- assuming no other compensation is made to approximate the effect -- is to multiply the base BSDF by the uniform _modulated darkening factor_ (taking into account the presence weight $\mathtt{C}$ = **`coat_weight`** and the darkening parameter $\delta$ = **`coat_darkening`**): \begin{equation} \label{modulated_darkening_factor} -(1-\mathtt{C}) + \mathtt{C} \, B(\delta) \,\Delta = \mathrm{lerp}(1, \Delta, \mathtt{C}\,\delta) \ , +(1-\mathtt{C}) + \mathtt{C} \, B(\delta) \,\mathbf{\Delta} \end{equation} with $\Delta$ evaluated via equation [general_darkening_formula] with internal diffuse reflection coefficient, accounting for base roughness, given by equation [internal_diffuse_reflection_coefficient_for_general_base]. From 2ac845dfa1d8fc8925c18b1ea499ff14d7e95ee4 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Tue, 15 Apr 2025 15:06:01 +0100 Subject: [PATCH 2/8] typos --- index.html | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index cdcad3f..3324dcf 100644 --- a/index.html +++ b/index.html @@ -950,19 +950,18 @@ \begin{equation} \label{general_coat_albedo} \mathbf{E}_c = F_0 + (1 - F_0) \mathbf{X} \ . \end{equation} -where $F_0$ is the normal incidence Fresnel factor of the coat, $T_\mathrm{coat}$ is the coat absorption transmittance, and $E_b$ is the base albedo at normal incidence. - -We then require that the effect of $\delta$ = **`coat_darkening`** is to multiply $\mathbf{X} \rightarrow B(\delta) \mathbf{X}$ by the scalar boost factor +where $F_0$ is the normal incidence Fresnel factor of the coat. We then require that the effect of $\delta$ = **`coat_darkening`** is to multiply $\mathbf{X} \rightarrow B(\delta) \mathbf{X}$ by the scalar boost factor \begin{equation} \label{undarkened_coat_albedo_scaling} -B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{X})}, 1, \delta \biggr) \ . +B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{X})}, 1, \delta \biggr) \end{equation} -This is a straightforward interpretation of the requirement for the *luminance of the base* of the "un-darkened" coat to be equal to what it would be if the albedo was given by the usual un-darkened albedo scaling formula, while retaining the chromaticity of the physically darkened coat: +where $\mathbf{T}_\mathrm{coat}$ is the coat absorption transmittance, and $E_b$ is the base albedo at normal incidence. + +This is a straightforward interpretation of the requirement for the *luminance of the base* of the "un-darkened" coat to be equal to what it would be if the albedo was given by the usual un-darkened albedo scaling formula (while retaining the chromaticity of the albedo of physically darkened coat): \begin{equation} \label{undarkened_coat_albedo} -\mathbf{E}^U_c = F_0 + \mathbf{T}^2_\mathrm{coat} \, \mathbf{E}_b (1 - F_0) +F_0 + \mathbf{T}^2_\mathrm{coat} \, \mathbf{E}_b (1 - F_0) \ . \end{equation} -While this defines the behavior at the level of the required albedos, in practice implementations will need to develop some specific approximation for the coat darkening effect consistent with their physical approximations. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be boosted by some compensating uniform RGB "boost" factor $\mathbf{B}_0$ in order for the coated base to achieve this un-darkened luminance. -While this can be implementation dependent, we suggest here a reasonably simple, efficient scheme which captures the essential behavior. +While this defines the behavior at the level of the required albedos, in practice implementations will need to develop some specific approximation for the coat darkening effect consistent with their physical approximations. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be altered in order for the coated base to achieve the un-darkened albedo. While this can be implementation dependent, we suggest here a reasonably simple, efficient scheme which captures the essential behavior. Physically, it can be shown that in the case of a Lambertian base with (constant) albedo $E_b$ and a perfectly smooth dielectric clear-coat -- the so-called _interfaced Lambertian_ model ([#Elias2001], [#d'Eon2021]) -- that the exact directional albedo of the coated base has the albedo-scaling-like form (where $\eta_c$ is the ratio of the coat IOR to the ambient IOR, and $F$ is the corresponding coat Fresnel factor): \begin{equation} \label{interfaced_lambertian_albedo} From 2a8fb22ee8ca680d50a85b99164615917bbcdb16 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Tue, 15 Apr 2025 16:14:36 +0100 Subject: [PATCH 3/8] typo --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3324dcf..4b80dd0 100644 --- a/index.html +++ b/index.html @@ -954,7 +954,7 @@ \begin{equation} \label{undarkened_coat_albedo_scaling} B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{X})}, 1, \delta \biggr) \end{equation} -where $\mathbf{T}_\mathrm{coat}$ is the coat absorption transmittance, and $E_b$ is the base albedo at normal incidence. +where $\mathbf{T}_\mathrm{coat}$ is the coat absorption transmittance, and $\mathbf{E}_b)$ is the base albedo at normal incidence. This is a straightforward interpretation of the requirement for the *luminance of the base* of the "un-darkened" coat to be equal to what it would be if the albedo was given by the usual un-darkened albedo scaling formula (while retaining the chromaticity of the albedo of physically darkened coat): \begin{equation} \label{undarkened_coat_albedo} From 720ad45c5f7797e85abfac69cc8044a0ab8c4924 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Fri, 2 May 2025 20:39:20 +0100 Subject: [PATCH 4/8] Alter coat darkening specification to behave more intuitively --- index.html | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/index.html b/index.html index 4b80dd0..c83f1f0 100644 --- a/index.html +++ b/index.html @@ -946,22 +946,24 @@ ![Figure [coat_darkening_grid]: Diffuse base with a clear-coat, for coats of different relative IOR $\eta_c$](images/coat_darkening_grid.png width="60%") -However this darkening may not always be desirable artistically, as in some applications it is beneficial for the observed color of the coated color to "match" the input base color (in a sense defined more precisely below in equation [undarkened_coat_albedo]). We allow for this by introducing a **`coat_darkening`** parameter, $\delta$. By default $\delta$ = $1$, in which case the physically correct darkening effect due to internal reflections occurs as normal. In the case $\delta$ = $0$ however, the base albedo is modified to "counteract" the darkening effect. To describe what we mean by "counteract the darkening", we write the coat albedo in the general form +However this darkening may not always be desirable artistically, as in some applications it is beneficial for the observed color of the coated base to "match" the input base color (in a sense defined more precisely below in equation [undarkened_coat_albedo]). We allow for this by introducing a **`coat_darkening`** parameter, $\delta$. By default $\delta$ = $1$, in which case the physically correct darkening effect due to internal reflections occurs as normal. In the case $\delta$ = $0$ however, the base albedo is modified to "counteract" the darkening effect. To describe what we mean by "counteract the darkening", we write the (physically darkened) coat albedo at normal incidence in the general form \begin{equation} \label{general_coat_albedo} -\mathbf{E}_c = F_0 + (1 - F_0) \mathbf{X} \ . +\mathbf{E}_c = F_0 + (1 - F_0) \mathbf{E}^\prime_c \ . \end{equation} -where $F_0$ is the normal incidence Fresnel factor of the coat. We then require that the effect of $\delta$ = **`coat_darkening`** is to multiply $\mathbf{X} \rightarrow B(\delta) \mathbf{X}$ by the scalar boost factor +where $F_0$ is the normal incidence Fresnel factor of the coat, and $\mathbf{E}^\prime_c$ represents the albedo due to transmission into the coat medium (and scattering off the base substrate, potentially multiple internal reflections off the coat interface, and re-transmission back out). +We then require that the *effect* of $\delta$ = **`coat_darkening`** is to multiply $\mathbf{E}^\prime_c$ by an RGB boost factor \begin{equation} \label{undarkened_coat_albedo_scaling} -B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{X})}, 1, \delta \biggr) +\mathbf{B}(\delta) = \mathrm{lerp}\biggl(\frac{\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b}{\mathbf{E}^\prime_c}, 1, \delta \biggr) \end{equation} -where $\mathbf{T}_\mathrm{coat}$ is the coat absorption transmittance, and $\mathbf{E}_b)$ is the base albedo at normal incidence. +where $\mathbf{T}_\mathrm{coat}$ is the coat absorption transmittance, and $\mathbf{E}_b$ represents the normal-incidence albedo of the entire base beneath the coat (which can be approximated as the normal-incidence albedos of the individual slabs of the base, blended according to their mix weights). -This is a straightforward interpretation of the requirement for the *luminance of the base* of the "un-darkened" coat to be equal to what it would be if the albedo was given by the usual un-darkened albedo scaling formula (while retaining the chromaticity of the albedo of physically darkened coat): +This is a straightforward implementation of the requirement for the albedo of the "un-darkened" coat to be equal to the usual albedo scaling formula of equation [non-reciprocal-albedo-scaling-with-T] (which involves no color shift other than that due to the absorption, and the combination with the Fresnel factor), i.e. \begin{equation} \label{undarkened_coat_albedo} -F_0 + \mathbf{T}^2_\mathrm{coat} \, \mathbf{E}_b (1 - F_0) \ . +\mathbf{E}_c = F_0 + (1 - F_0) \mathbf{E}^\prime_c \mathbf{B}(\delta) \; \rightarrow \; F_0 + \mathbf{T}^2_\mathrm{coat} \, \mathbf{E}_b (1 - F_0) \end{equation} +as $\delta \rightarrow 0$. -While this defines the behavior at the level of the required albedos, in practice implementations will need to develop some specific approximation for the coat darkening effect consistent with their physical approximations. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be altered in order for the coated base to achieve the un-darkened albedo. While this can be implementation dependent, we suggest here a reasonably simple, efficient scheme which captures the essential behavior. +Note that we have not specified the detailed physical mechanism by which the boosting of $\mathbf{E}^\prime_c$ occurs, instead we have only defined what the resultant effective albedo modification has to be as **`coat_darkening`** is varied. While this defines the behavior at the level of the required albedos, in practice implementations will need to develop some specific approximation for the coat darkening effect consistent with their physical approximations. Due to the physical effect of the darkening due to the internal reflections, the base BSDF would generally need to be altered in order for the coated base to achieve the un-darkened albedo. While this can be implementation dependent, we suggest here a reasonably simple, efficient scheme which captures the essential behavior. Physically, it can be shown that in the case of a Lambertian base with (constant) albedo $E_b$ and a perfectly smooth dielectric clear-coat -- the so-called _interfaced Lambertian_ model ([#Elias2001], [#d'Eon2021]) -- that the exact directional albedo of the coated base has the albedo-scaling-like form (where $\eta_c$ is the ratio of the coat IOR to the ambient IOR, and $F$ is the corresponding coat Fresnel factor): \begin{equation} \label{interfaced_lambertian_albedo} @@ -997,22 +999,22 @@ Incorporating the absorption coefficient is more complicated, but a reasonable approximation at normal incidence is to replace \begin{equation} \label{general_darkening_formula_with_absorption} -\mathbf{\Delta}(\mathbf{E}_b, \eta_c) = \frac{1 - K \mathbf{T}^2_\mathrm{coat}}{1 - \mathbf{E}_b K \mathbf{T}^2_\mathrm{coat}} \ . +\mathbf{\Delta}(\mathbf{E}_b, \eta_c) \approx \frac{1 - K \mathbf{T}^2_\mathrm{coat}}{1 - \mathbf{E}_b K \mathbf{T}^2_\mathrm{coat}} \end{equation} and equation [interfaced_lambertian_albedo] is modified with an additional $\mathbf{T}^2_\mathrm{coat}$ factor in the second term. - -We can thus approximate +We can thus approximate $\mathbf{E}^\prime_c \approx \mathbf{E}_b \mathbf{T}^2_\mathrm{coat} \mathbf{\Delta}$. The boost factor of equation [undarkened_coat_albedo_scaling] then reduces to: \begin{equation} \label{B_approx} -B(\delta) = \mathrm{lerp}\biggl(\frac{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b)}{\mathrm{lum}(\mathbf{T}_\mathrm{coat}^2 \mathbf{E}_b \mathbf{\Delta})}, 1, \delta \biggr) \approx \mathrm{lerp}\biggl(\frac{1}{\mathrm{lum}(\mathbf{\Delta})}, 1, \delta\biggr) \ . +\mathbf{B}(\delta) = \mathrm{lerp}\biggl(\frac{1}{\mathbf{\Delta}}, 1, \delta\biggr) \ . \end{equation} -Given the general formula equation [general_darkening_formula] for the darkening, a reasonable approximate scheme -- assuming no other compensation is made to approximate the effect -- is to multiply the base BSDF by the uniform _modulated darkening factor_ (taking into account the presence weight $\mathtt{C}$ = **`coat_weight`** and the darkening parameter $\delta$ = **`coat_darkening`**): +Given the general formula equation [general_darkening_formula_with_absorption] for the darkening, a reasonable approximate scheme -- assuming no other compensation is made to approximate the effect -- is to multiply the base BSDF by the uniform _modulated darkening factor_ (depending on the darkening parameter $\delta$ = **`coat_darkening`**): \begin{equation} \label{modulated_darkening_factor} -(1-\mathtt{C}) + \mathtt{C} \, B(\delta) \,\mathbf{\Delta} +\mathbf{B}(\delta) \,\mathbf{\Delta} \mathbf{T}^2_\mathrm{coat} = \mathrm{lerp}\left(1, \mathbf{\Delta}, \delta\right) \,\mathbf{T}^2_\mathrm{coat} \end{equation} -with $\Delta$ evaluated via equation [general_darkening_formula] with internal diffuse reflection coefficient, accounting for base roughness, given by equation [internal_diffuse_reflection_coefficient_for_general_base]. +with $\mathbf{\Delta}$ evaluated via equation [general_darkening_formula_with_absorption] with internal diffuse reflection coefficient, accounting for base roughness, given by equation [internal_diffuse_reflection_coefficient_for_general_base]. + +In the absense of the coat the physical darkening does not occur, which may be modelled by having the base darkening factor be $\mathrm{lerp}(1, \mathbf{B}(\delta) \,\mathbf{\Delta} \mathbf{T}^2_\mathrm{coat}, \mathtt{C})$ where $\mathtt{C}$ = **`coat_weight`** is the presence weight of the coat. -The base albedo $E_b$ which appears in equation [general_darkening_formula] represents the normal-incidence albedo of the entire base beneath the coat. This albedo can be approximated as the normal-incidence albedos of the individual slabs of the base, blended according to their mix weights. ### View-dependent absorption From b582934206602995fb6941f42209618ad666a648 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Sat, 3 May 2025 02:27:05 +0100 Subject: [PATCH 5/8] Fix coat darkening math approximation (absorbing case) --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index c83f1f0..3848aec 100644 --- a/index.html +++ b/index.html @@ -971,7 +971,7 @@ \end{equation} where $\mathbf{\Delta}(\mathbf{E}_b, \eta_c)$ is a darkening factor given by \begin{equation} \label{general_darkening_formula} -\mathbf{\Delta}(\mathbf{E}_b, \eta_c) = \frac{1 - K}{1 - \mathbf{E}_b K} \ . +\mathbf{\Delta}(\mathbf{E}_b, \eta_c) = \frac{1 - K}{1 - K \mathbf{E}_b} \ . \end{equation} Here $K \in [0,1]$ is the _internal diffuse reflection coefficient_, which corresponds to the fraction of the energy leaving the base which returns to the base due to internal reflection from the coat. Higher values of $K$ lead to more internal reflections, thus more darkening and saturation. In the case of a Lambertian base (which should be a reasonable approximation to the rough metal, dielectric, or diffuse cases), $K = K_r$ where, with relative coat IOR $\eta_c$: @@ -997,9 +997,9 @@ \end{equation} while the metallic roughness can be taken to be $r_m = r$. (Note that in this formula for $r_d$, a clamp must be applied to ensure that $\xi_s F_s \in [0, 1]$). -Incorporating the absorption coefficient is more complicated, but a reasonable approximation at normal incidence is to replace +Incorporating the absorption coefficient is more complicated, but a rough approximation at normal incidence is to replace \begin{equation} \label{general_darkening_formula_with_absorption} -\mathbf{\Delta}(\mathbf{E}_b, \eta_c) \approx \frac{1 - K \mathbf{T}^2_\mathrm{coat}}{1 - \mathbf{E}_b K \mathbf{T}^2_\mathrm{coat}} +\mathbf{\Delta}(\mathbf{E}_b, \eta_c) \approx \frac{1 - K}{1 - K \mathbf{E}_b \mathbf{T}^2_\mathrm{coat}} \end{equation} and equation [interfaced_lambertian_albedo] is modified with an additional $\mathbf{T}^2_\mathrm{coat}$ factor in the second term. We can thus approximate $\mathbf{E}^\prime_c \approx \mathbf{E}_b \mathbf{T}^2_\mathrm{coat} \mathbf{\Delta}$. The boost factor of equation [undarkened_coat_albedo_scaling] then reduces to: From 5d9315c7f6e3fe25162d5b0d2af303b5de74ee49 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Fri, 30 May 2025 18:17:33 +0100 Subject: [PATCH 6/8] Add MaterialX implementation. --- reference/open_pbr_surface.mtlx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/reference/open_pbr_surface.mtlx b/reference/open_pbr_surface.mtlx index 3707f14..40803d3 100644 --- a/reference/open_pbr_surface.mtlx +++ b/reference/open_pbr_surface.mtlx @@ -499,13 +499,17 @@ + + + + - + - + @@ -514,18 +518,19 @@ - - - - - + + + + + + - + From 4e44cb0150ec58e113549d39dbe527412128f95c Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Fri, 30 May 2025 18:58:42 +0100 Subject: [PATCH 7/8] Refactor the coat calculation --- reference/open_pbr_surface.mtlx | 57 +++++++++++++++++---------------- 1 file changed, 30 insertions(+), 27 deletions(-) diff --git a/reference/open_pbr_surface.mtlx b/reference/open_pbr_surface.mtlx index 40803d3..7651524 100644 --- a/reference/open_pbr_surface.mtlx +++ b/reference/open_pbr_surface.mtlx @@ -459,7 +459,9 @@ - + + + @@ -494,12 +496,14 @@ - + - + @@ -507,61 +511,60 @@ - + - + - + + + - - - - - - + - - - - - - - - + + - + - + - + - + + - + + + + + + + + - + @@ -571,7 +574,7 @@ - + From 773e5349d8ff784d6f45414c60d752729e3c93a7 Mon Sep 17 00:00:00 2001 From: Jamie Portsmouth Date: Fri, 30 May 2025 19:10:44 +0100 Subject: [PATCH 8/8] tweak --- reference/open_pbr_surface.mtlx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/open_pbr_surface.mtlx b/reference/open_pbr_surface.mtlx index 7651524..e963781 100644 --- a/reference/open_pbr_surface.mtlx +++ b/reference/open_pbr_surface.mtlx @@ -533,7 +533,7 @@ - +