<p>Wenzel Jakob et al presented a <a href="http://www.cs.cornell.edu/projects/layered-sg14/layered.pdf">framework for layered Materials</a> at SIGGRAPH 2014. Section 6.2 explains importance sampling. If you prefer code over equations, the method is implemented in the <a href="http://www.mitsuba-renderer.org">Mitsuba renderer</a>.</p>

CC BY-SA 3.0
2017-01-29T00:07:57.050Z
Note that the method by Jakob et al. relies on rendering of tabulated BSDF data in some specialised Fourier basis representation. For details, also refer to the corresponding [technical report](http://rgl.s3.eu-central-1.amazonaws.com/media/papers/Jakob2014Comprehensive_1.pdf).
An open-source implementation is also available in the newest, 3rd edition of [PBRT](https://github.com/mmp/pbrt-v3/). The BSDF files can be generated with [layerlab](https://github.com/wjakob/layerlab/) in Python.
tizian
CC BY-SA 3.0
2017-01-28T13:22:55.387Z
2017-01-28T13:22:55.387Z
Stefan Werner
<p>I'm currently trying to implement a Monte Carlo path tracer. I've done some research and it seems that a common approach to materials is to use a layered model. Something like this:</p>

<p><a href="https://i.sstatic.net/2ABBQ.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/2ABBQ.jpg" alt="enter image description here"></a></p>

<p>When light hits the surface, Fresnel tells us how much of that light is reflected by the first layer and how much goes to the second, and so forth.</p>

<p>So I did something similar, but simpler: only one layer of specular and one layer of diffuse. No transmittance yet. So far so good, I use a simple cosine-weighted <a href="https://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function" rel="nofollow noreferrer">brdf</a> for my diffuse and the Cook-Torrance microfaceted model for my specular. </p>

<p>Now comes the hard part: what should I do once a ray hits the surface?
Normally, I'd pick the brdf corresponding to the surface material, sample an incident light direction, evaluate the brdf, and divide by the right probability distribution function.</p>

<p>But here, a surface hit effectively corresponds to multiple materials. The naive way to handle this would be to sample once for each layer hit. But this clearly is source of a huge performance hit, causing my path to effectively become a tree.</p>

<p>Is there a better solution? </p>

CC BY-SA 3.0
2017-02-01T08:59:27.680Z
Can you not 'monte-carlo' the material layers? E.g. Weight each layer according to their reflectivity and pick one at random based on that.  Deeper layers will need some attenuation based on the sum of absorption of all layers above them.
PaulHK
<pathtracing><material><filtering>
Path tracer - multi layered materials and importance sampling
castan
# Path tracer - multi layered materials and importance sampling

(Asked by: username_0 on 2017-01-27)

I'm currently trying to implement a Monte Carlo path tracer. I've done some research and it seems that a common approach to materials is to use a layered model. Something like this:

[![enter image description here](https://i.sstatic.net/2ABBQ.jpg)](https://i.sstatic.net/2ABBQ.jpg)

When light hits the surface, Fresnel tells us how much of that light is reflected by the first layer and how much goes to the second, and so forth.

So I did something similar, but simpler: only one layer of specular and one layer of diffuse. No transmittance yet. So far so good, I use a simple cosine-weighted [brdf](https://en.wikipedia.org/wiki/Bidirectional_reflectance_distribution_function) for my diffuse and the Cook-Torrance microfaceted model for my specular.

Now comes the hard part: what should I do once a ray hits the surface?
Normally, I'd pick the brdf corresponding to the surface material, sample an incident light direction, evaluate the brdf, and divide by the right probability distribution function.

But here, a surface hit effectively corresponds to multiple materials. The naive way to handle this would be to sample once for each layer hit. But this clearly is source of a huge performance hit, causing my path to effectively become a tree.

Is there a better solution?

**Tags:** pathtracing, material, filtering

> **Comments:**
> **username_1**: Can you not 'monte-carlo' the material layers? E.g. Weight each layer according to their reflectivity and pick one at random based on that.  Deeper layers will need some attenuation based on the sum of absorption of all layers above them.  

---

## 1 answers

### Answer by username_2 on 2017-01-28. Score: 7 | Accepted answer

Wenzel Jakob et al presented a [framework for layered Materials](http://www.cs.cornell.edu/projects/layered-sg14/layered.pdf) at SIGGRAPH 2014. Section 6.2 explains importance sampling. If you prefer code over equations, the method is implemented in the [Mitsuba renderer](http://www.mitsuba-renderer.org).

> **Comments:**
> **username_3**: Note that the method by Jakob et al. relies on rendering of tabulated BSDF data in some specialised Fourier basis representation. For details, also refer to the corresponding [technical report](http://rgl.s3.eu-central-1.amazonaws.com/media/papers/Jakob2014Comprehensive_1.pdf). An open-source implementation is also available in the newest, 3rd edition of [PBRT](https://github.com/mmp/pbrt-v3/). The BSDF files can be generated with [layerlab](https://github.com/wjakob/layerlab/) in Python.  

---

