Weidlich-Wilkie Layered Model
This is a part of the blog post series Rendering Layered Materials.
Here I present a (hopefully) brief explanation of the original layered model by Andrea Weidlich and Alexander Wilkie, published in 2007 at the Graphite conference (predecessor of the SIGGRAPH Asia conference). In my explanation I will restrict to just two layers, instead of the paper’s general approach allowing arbitrary amount of layers.
They assume that the outer layer is a micro-facet-based model (the ideally smooth Fresnel model can be thought of as a special case of a micro-facet model too) and that there is homogeneous attenuating medium between the layers. The inner layer can be of any reflective model, whether it’s micro-facet based or not, since the layered model works with the layer’s reflection component only without any special micro-facet-related assumptions on it.
To avoid evaluation of complex sub-surface light scattering, Weidlich and Wilkie proposed an approximation based on the following 4 simplifications:
- Thin layers: Micro-facets are considered to be much larger in horizontal extent, than the layers are thick.
- Single-point refractions: Refraction rays that are generated for the computation of the entire BSDF, are assumed to meet at a single point on the inner layer interface.
- Single-point sampling: Rays which are generated by sampling the inner BSDF layer are assumed to exit at the original point of incidence.
- Non-scattering medium: All light scattering is due to reflection at the boundaries between layers; no scattering occurs within individual layers.
The simplification 1 allows them to assume that an incident ray of light will leave through the same micro-facet through which it entered the surface, thus simplifying both evaluation and sampling. The simplifications 2 and 3 cause, along with easier evaluation and sampling, that the resulting model stays a “single-point” scattering function (BSDF) instead of extending it to an “areal” sub-surface scattering function (BSSDF), which would be needed if we wanted to do a full light transport simulation. The simplification 4 simply forbids volumetric scattering within the medium, which would make the whole task much more complicated.
In a modern realistic renderer, a BSDF needs to handle two tasks: evaluation and sampling. Let’s see how the Weidlich-Wilkie model addresses them.
Evaluation
Layered BSDF evaluation process. Image reused from the Weidlich-Wilkie paper.
- The BSDF of the outer layer $f_{r1}$ is evaluated for the two given, arbitrary incoming directions $\omega_{i}$ and $\omega_{o}$. This yields a reflection component and two refraction directions $\omega_{i}^{\prime} $ and $\omega_{o}^{\prime}$.
- The light which is refracted below the outer layer (transmission coefficient $T_{12}$) follows the two refraction directions associated with the initial incident directions, and is attenuated by the medium (attenuation coefficient $a$).
- These two refraction directions are assumed to meet at a single point on the inner layer $f_{r2}$.
- On returning from the inner layer, the individual BSDF components are attenuated by the Fresnel transmission coefficients $T_{21}$ for the outer layer, and added to the total BSDF.
The total BSDF is then
where $a$ represents the medium attenuation (modeled with the Beer-Lambert-Bouguer law)
where $\alpha$ is the medium attenuation coefficient, $d$ is the thickness of the layer, $\theta_{i^{\prime}}$ and $\theta_{o^{\prime}}$ are inclinations of the respective refraction directions, and
where $G$ is the geometric attenuation term of the micro-facet model used. The paper doesn’t make it clear whether the term belongs to the outer or to the inner layer. It, most likely, is the outer one, because the inner layer is not necessarily micro-facet based.
My notes on evaluation
The paper doesn’t explain the $t$ component. This is how the inner layer reflection component looks like after expansion of $t$:
It seems to me that this is an effort to evaluate the light transmission through micro-facet-based surface, and probably also a compensation term for missing energy. A different solution of light transmission through micro-facet-based surface was published, also in 2007, in the paper Microfacet Models for Refraction through Rough Surfaces by Walter et al.
It is important to understand that the model tries to approximate the whole sub-surface light transport by evaluating just one path under the outer layer. It also neglects the multiple scattering nature of the light transport within the layers. This basically cuts all the energy which is reflected (partially or completely) from the inner layer and then from the the outer layer back into the medium between the two layers. The paper tries to compensate the missing energy by an “energy compensation term” which it doesn’t mention further.
An interesting property of their single-path approximation is (and the paper doesn’t explain this clearly enough) that they use the micro-facet’s normal for computing the refracted directions. This may cause approximation imprecisions when the normal approaches grazing angles.
Last, but not least, the paper doesn’t address the effect of solid angle (de-)compression which occurs when the light crosses the boundaries between media with different indices of refraction.
Sampling
Sampling configuration. Image reused from the Weidlich-Wilkie paper.
When a ray hits a surface, a micro-facet normal for the outer layer’s model is generated. The sampling of the whole BSDF then resembles a light propagation simulation – light would be partially reflected and partially refracted according to the Fresnel equation, which defines two paths to follow. One of the paths is chosen randomly.
For the reflection path, we only reflect the incident direction from the micro-facet and we are done. For the refraction path, we have to refract the incident direction through the micro-facet and use it to sample a reflection direction of the inner layer. The direction has to be refracted back through the micro-facet of the outer layer to the outside world.
The paper doesn’t explain how to compute the resulting PDF when sampling the BSDF, but we can assume that it is consistent with the computations done when the whole BSDF is evaluated. In that case, the PDF is computed as a weighted sum of the individual PDFs $p_i$ of both layers with some arbitrarily chosen constant weights $w_i$:
My notes on sampling
Not enough attention is paid to explaining how to correctly and efficiently generate samples. The sampling process randomly picks one of the layers according to probabilities equal to constants $w_i$ and uses its PDF to generate the resulting direction. Since the sampling strategy should be as proportional to the whole BSDF as possible to get good importance sampling, we need to weight the individual sampling PDFs with the actual contributions of the respective BSDF components (layers). Therefore, using constant weights hardly leads to an optimal sampling strategy since it completely ignores both the Fresnel attenuation and the attenuation within the medium which are both direction dependent.
The second problem with the sampling arises from the fact that the probability density of the direction generated by the inner BSDF changes when undergoing refraction operation at the outer layer. This leads to inconsistency between the computed and the actual PDF, which subsequently leads to a biased Monte-Carlo estimator in the renderer.