<p>Looking around here on various sources (including related questions on this site), if my understanding is correct, when implementing a path tracer with a material which has both a diffuse term and a specular term, we can randomly choose whether to evaluate the diffuse or the specular ray then divide the result by the probability of choosing diffuse or specular.</p>

<p>For example if we have a material 50% specular, we would have:</p>

<p>If diffuse ray was chosen:</p>

<p><span class="math-container">$\frac{DiffuseBRDF*incomingLight}{0.5}$</span></p>

<p>If specular ray was chosen:</p>

<p><span class="math-container">$\frac{SpecularBRDF*incomingLight}{0.5}$</span></p>

<p>Once diffuse/specular is chosen, we have to find which ray exactly we want to use for <span class="math-container">$incomingLight$</span>. In my case I have a rough dieletric surface (not a perfect mirror) and I would like to use importance sampling and use for example a cosine weighted pdf for diffuse and a NDF weighted pdf for the specular term. I couldn't find a source for this particular case, but If my understanding is correct, I would end up with either:</p>

<p><span class="math-container">$\frac{DiffuseBRDF*incomingLight}{0.5*DiffusePdf}$</span></p>

<p>if diffuse was chosen, or:</p>

<p><span class="math-container">$\frac{SpecularBRDF*incomingLight}{0.5*SpecularPdf}$</span></p>

<p>if specular was chosen. Is this result correct?</p>

CC BY-SA 4.0
2020-05-17T11:20:11.923Z
This BRDF is normally defined as a mix of diffuse and an specular component with a lob. The specular component normally is defined using microfacets reflection model. Have a look at FresnelBlend section from PBRT in this link: http://www.pbr-book.org/3ed-2018/Reflection_Models/Microfacet_Models.html
ali
CC BY-SA 4.0
2020-05-17T13:46:56.057Z
@ali Thanks. Yes I've just found the pbrt to be very helpful in this regard, and by carefully reading chapter 14 I think I've got the answer to the above question: The above result is correct only in one particular case, when you have a matte + perfect mirror material. In case of a non-perfect mirror BOTH DiffuseBRDF and SpecularBRDF are included, and the two Pdfs are weighted, like so: (DiffuseBRDF + SpecularBRDF)*incomingLight / 0.5*DiffusePdf + 0.5*SpecularPdf
yggdrasil
<pathtracing><brdf><importance-sampling>
How to properly combine diffuse and rough specular BRDFs in a path tracer
yggdrasil
# How to properly combine diffuse and rough specular BRDFs in a path tracer

(Asked by: username_0 on 2020-05-16)

Looking around here on various sources (including related questions on this site), if my understanding is correct, when implementing a path tracer with a material which has both a diffuse term and a specular term, we can randomly choose whether to evaluate the diffuse or the specular ray then divide the result by the probability of choosing diffuse or specular.

For example if we have a material 50% specular, we would have:

If diffuse ray was chosen:

$\frac{DiffuseBRDF\*incomingLight}{0.5}$

If specular ray was chosen:

$\frac{SpecularBRDF\*incomingLight}{0.5}$

Once diffuse/specular is chosen, we have to find which ray exactly we want to use for $incomingLight$. In my case I have a rough dieletric surface (not a perfect mirror) and I would like to use importance sampling and use for example a cosine weighted pdf for diffuse and a NDF weighted pdf for the specular term. I couldn't find a source for this particular case, but If my understanding is correct, I would end up with either:

$\frac{DiffuseBRDF\*incomingLight}{0.5\*DiffusePdf}$

if diffuse was chosen, or:

$\frac{SpecularBRDF\*incomingLight}{0.5\*SpecularPdf}$

if specular was chosen. Is this result correct?

**Tags:** pathtracing, brdf, importance-sampling

> **Comments:**
> **username_1**: This BRDF is normally defined as a mix of diffuse and an specular component with a lob. The specular component normally is defined using microfacets reflection model. Have a look at FresnelBlend section from PBRT in this link: http://www.pbr-book.org/3ed-2018/Reflection_Models/Microfacet_Models.html  
> **username_0**: @username_1 Thanks. Yes I've just found the pbrt to be very helpful in this regard, and by carefully reading chapter 14 I think I've got the answer to the above question: The above result is correct only in one particular case, when you have a matte + perfect mirror material. In case of a non-perfect mirror BOTH DiffuseBRDF and SpecularBRDF are included, and the two Pdfs are weighted, like so: (DiffuseBRDF + SpecularBRDF)*incomingLight / 0.5*DiffusePdf + 0.5*SpecularPdf  

---

## 0 answers

