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

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 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?

  • 1
    $\begingroup$ 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. $\endgroup$ – PaulHK Feb 1 '17 at 8:59
  • $\begingroup$ PaulHK That's exactly what I am doing in my path tracer, russian roulette for each interface between layers, so, no branching at all. Unfortunatelly, my implementation is not finished yet, so I do not have information regarding the actual performance. I've based my implementation on the paper "Arbitrarily Layered Micro-Facet Surfaces" by Andrea Weidlich and Alexander Wilkie, which seems to be more limited than the framework of Wenzel Jakob (pointed out in the answer by Stefan), but which is capable of generating quite good results and is much simpler to implement. $\endgroup$ – Christian Pagot May 19 '17 at 4:31

Wenzel Jakob et al presented a framework for layered Materials at SIGGRAPH 2014. Section 6.2 explains importance sampling. If you prefer code over equations, the method is implemented in the Mitsuba renderer.

| improve this answer | |
  • 2
    $\begingroup$ 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. An open-source implementation is also available in the newest, 3rd edition of PBRT. The BSDF files can be generated with layerlab in Python. $\endgroup$ – tizian Jan 29 '17 at 0:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.