-
Notifications
You must be signed in to change notification settings - Fork 34
Roughening improvements #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev_1.2
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1022,12 +1022,14 @@ | |
|
|
||
| If the coat is rough, the microfacet BSDF lobes of the underlying base substrate (metal and dielectric) are also effectively roughened. If this is not otherwise accounted for by the light transport, it can instead be reasonably approximated by directly altering the NDF of the base BSDFs. | ||
|
|
||
| A formula we recommend for this is obtained by identifying the NDF of each microfacet lobe as corresponding approximately to a Gaussian in slope-space with variance given by $\alpha_t^2 + \alpha_b^2 = r^4$ (in the notation of the [Microfacet model](index.html#model/microfacetmodel) section). Modeling the effect of the roughening as the convolution of these Gaussian NDFs (and double counting the coat variance since the reflection passes through the coat boundary twice), the resulting modified roughness of the base, $r'_\mathrm{B}$, (taking into account the presence weight of the coat, $\mathtt{C}=$ **`coat_weight`**) is given by | ||
| \begin{equation} | ||
| r'_\mathrm{B} = \mathrm{lerp}\Bigl( r_\mathrm{B}, \mathrm{min} \bigl(1, r^4_\mathrm{B} + 2 r^4_\mathrm{C} \bigr)^\frac{1}{4}, \mathtt{C} \Bigr) | ||
| A formula we recommend for this is obtained by identifying the NDF of each microfacet lobe as corresponding approximately to a Gaussian in slope-space with variance given by $\alpha_t^2 + \alpha_b^2 = r^4$ (in the notation of the [Microfacet model](index.html#model/microfacetmodel) section). | ||
| The effect of the coat roughening can then be modeled as the convolution of these Gaussian NDFs, which corresponds to adding the variances (double counting the coat variance since the reflection passes through the coat boundary twice). The IOR ratio of the coat and ambient medium $\eta_\mathrm{ca}$ also needs to be accounted for, since as $\eta_\mathrm{ca} \rightarrow 1$ the roughening due to the coat goes to zero. | ||
| This leads to the following suggested approximate formula for the modified roughness $r'_\mathrm{B}$ of the base due to the coat: | ||
| \begin{equation} \label{coat_roughening_heuristic} | ||
| r'_\mathrm{B} = \mathrm{min} \bigl(1, r^4_\mathrm{B} + 2 x_C r^4_\mathrm{C} \bigr)^\frac{1}{4} \quad \textrm{with } x_C = 1 - \mathrm{min}(\eta_\mathrm{ca}, 1/\eta_\mathrm{ca}) | ||
| \end{equation} | ||
| where $r_\mathrm{B}=$ **`specular_roughness`** and $r_\mathrm{C}=$ **`coat_roughness`**. | ||
|
|
||
| Of course, the presence weight of the coat ($\mathtt{C}=$ **`coat_weight`**) also needs to be taken into account, ideally by blending between the effect with and without the coat present. Alternatively, a cruder approximation would be to just set the roughness of the base to $\mathrm{lerp}(r_\mathrm{B}, r'_\mathrm{B}, \mathtt{C})$. | ||
|
|
||
|
|
||
| ### Total internal reflection | ||
|
|
@@ -1094,9 +1096,9 @@ | |
|
|
||
| The form of this model is the following (with $\mu_i, \mu_o$ the angle cosines to the normal of $\omega_i, \omega_o$): | ||
| \begin{equation} | ||
| \mu_i \, f_\mathrm{fuzz}(\omega_i, \omega_o) = \mathbf{F} \, E_\mathrm{fuzz}(\mu_o, \alpha) \, D(\mu_i | \mu_o, \alpha) | ||
| \mu_i \, f_\mathrm{fuzz}(\omega_i, \omega_o) = \mathbf{F} \, E_\mathrm{fuzz}(\mu_o, r_F) \, D(\mu_i | \mu_o, r_F) | ||
| \end{equation} | ||
| where $\mathbf{F}$ = **`fuzz_color`**, $E_\mathrm{fuzz}(\mu_o, \alpha)$ (termed $R$ in [#Zeltner2022]) is the reflectance at angle cosine $\mu_o$ given roughness $\alpha$ = **`fuzz_roughness`** $\in [0,1]$, and $D(\mu_i | \mu_o, \alpha)$ is a lobe defined by linear transformations of a cosine lobe (LTCs), where the transformation matrices (and $E_\mathrm{fuzz}$) are tabulated in a grid in the $(\mu_o, \alpha)$ plane, with values fitted to a simulation of the scattering in the volumetric fuzz microflake layer. Since the LTC lobe $D$ is a normalized PDF over the hemisphere, the resulting albedo of $f_\mathrm{fuzz}$ is $\mathbf{F} \, E_\mathrm{fuzz}(\mu_o, \alpha)$. | ||
| where $\mathbf{F}$ = **`fuzz_color`**, $E_\mathrm{fuzz}(\mu_o, r_F)$ (termed $R$ in [#Zeltner2022]) is the reflectance at angle cosine $\mu_o$ given roughness $r_F$ = **`fuzz_roughness`** $\in [0,1]$ (termed $\alpha$ in [#Zeltner2022]), and $D(\mu_i | \mu_o, r_F)$ is a lobe defined by linear transformations of a cosine lobe (LTCs), where the transformation matrices (and $E_\mathrm{fuzz}$) are tabulated in a grid in the $(\mu_o, r_F)$ plane, with values fitted to a simulation of the scattering in the volumetric fuzz microflake layer. Since the LTC lobe $D$ is a normalized PDF over the hemisphere, the resulting albedo of $f_\mathrm{fuzz}$ is $\mathbf{F} \, E_\mathrm{fuzz}(\mu_o, r_F)$. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume you're using different variables than the Zeltner paper to be consistent with other formulas in the OpenPBR spec. Is that right?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, since |
||
|
|
||
| If using the albedo-scaling interpretation of layering, a reasonable approximation of the reflection from the fuzz layer combined with the reflection from the base is to take | ||
| \begin{eqnarray} | ||
|
|
@@ -1110,6 +1112,13 @@ | |
|
|
||
| The fuzz shading normal is assumed to inherit from that of the substrate layer, the physical picture being that the fuzz volume settles and conforms to the geometry of the substrate. The substrate is generally a mixture of coat and uncoated base. Thus physically the fuzz model should be evaluated with each of the **`geometry_coat_normal`** and **`geometry_normal`** separately (if they differ), and the final result blended according to the **`coat_weight`**. As a practical approximation, it may be more convenient and efficient to instead approximate the fuzz normal by interpolating the coat and base normal according to **`coat_weight`**. | ||
|
|
||
| The scattering within the fuzz layer will have the effect of roughening the appearance of the substrate beneath it. | ||
| A simple suggested approximation for this can be adapted from the formula used to model the coat roughening, in equation [coat_roughening_heuristic]. If we consider the fuzz layer to generate roughening by scattering, we can approximate its effective roughness as being proportional to the albedo of the layer, as well as to the tint color (since darker fuzz will physically scatter less and absorb more). This leads to the following heuristic for the modified roughness $r'_\mathrm{B}$ of the substrate lobe: | ||
| \begin{equation} \label{fuzz_roughening_heuristic} | ||
| r'_\mathrm{B} = \mathrm{min} \bigl(1, r^4_\mathrm{B} + 2 R^4_\mathrm{F} \bigr)^\frac{1}{4} \quad \textrm{with $R_F = \mathrm{lum}(\mathbf{F} E_\mathrm{fuzz})$} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The inclusion of E_fuzz here means that the roughening will be more intense at grazing angles where the optical density is higher, correct?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The fuzz doesn't use a GGX distribution like the coat, so I wonder whether these fourth powers are still justifiable. Based on my own empirical testing, I had to tone down the fuzz roughening quite a bit (compared to coat roughening) to get it to look plausible.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, the E_fuzz functions almost like a coverage weight, since it's essentially the opacity of the fuzz layer, so intuitively it seems like the blending based on E_fuzz (and maybe the color F too) should be a simple lerp on the final roughness (unaffected by the powers and roots).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yes true.
The So I am just loosely assuming that this albedo can be a sort of proxy of the "amount of scattering", and thus the amount of roughening captured in a roughness scalar If the roughening is some (angular) Gaussian blurring with the angular blur varying with We'll need to do some simulations to check how it compares to reality, and fix it up accordingly.
Not sure I agree, since as noted it's really the albedo (varying with input direction). The coverage (and opacity) is constant in the Zeltner model, i.e. unit optical depth of fuzz. Obviously we also have the fuzz weight, functioning as an actual coverage weight, which should affect the roughening. |
||
| \end{equation} | ||
| where $r_\mathrm{B}$ is the original substrate roughness, and $\mathrm{lum}(\cdots)$ computes the luminance of the RGB argument. This should be applied to both the coat (if present) and the base lobes. If both the fuzz and the coat are present, then the base lobe roughness will be broadened by both the coat and fuzz formulas successively. The presence weights of the fuzz and coat should be accounted for appropriately. | ||
|
|
||
|
|
||
| Fuzz params | Label | Type | Range | Default | Description | ||
| ---------------------|-----------|----------|:------------:|:-------------:|---------------------------------------------- | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does "x" mean something or is it just an arbitrary available variable name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a variable name. It accounts for the IOR, so not sure what symbol to use. Putting the min inside the brackets looked worse.