<p>So I am in the midst of writing my own path traced renderer and right now I have only implemented the old Blinn-Phong models where we separately calculated the diffuse and specular components of the material and each object had a specular and a diffuse color. </p>

<p>Now going towards the more general side I want to be able to render different types of objects wood, polished wood, perfect mirror like reflections etc. However all this information confuses me on how should I implement these BSDFs or in other words how should I choose when to apply a certain BSDF or maybe a combination of two?</p>

<p>This is usually done using a material approach. The material being diffuse, glossy or perfect specular would define which BSDFs should I use.</p>

<p>I read PBRT for clues and they break surface reflection into 4 types. Diffuse, Glossy Specular, Specular and retro reflective. Then they implement an <code>enum</code> that stores the type corresponding to these reflection.</p>

<p>The enum has the types</p>

<pre><code>BSDF_REFLECTION
BSDF_TRANSMISSION
BSDF_DIFFUSE
BSDF_GLOSSY
BSDF_SPECULAR
BSDF_ALL
</code></pre>

<ol>
<li><p>The users are supposed to select a bitwise combination of the first two and 
the next 3 ones. Where <code>BSDF_ALL</code> is a combination of
all the flags. This interface seems nice but there is one little
confusion. If <code>BSDF_ALL</code> combines all flags, then this means the
surface can be <code>diffuse</code> and <code>specular</code>. However this seems odd, a
perfectly specular surface can't be diffuse. While <code>Glossy + Diffuse</code> make 
sense (polished wood, paint on a rough wall), <code>diffuse + specular</code> and 
<code>glossy + specular</code> don't make sense to me.</p></li>
<li><p>Assuming we have solved the above problem consider an object that is 
glossy+diffuse like an orange or lemon skin. How do we
calculate the color for this surface? Suppose I am using
<a href="https://en.wikipedia.org/wiki/Oren%E2%80%93Nayar_reflectance_model" rel="nofollow noreferrer">Oran-Nayar</a> model (ON) for diffuse surfaces and
<a href="https://en.wikipedia.org/wiki/Specular_highlight#Cook%E2%80%93Torrance_model" rel="nofollow noreferrer">Cook-Torrance</a> (CT) for specular ones. </p>

<p>Should I compute the diffuse component through ON and specular
through (CT) then add them together? However both of these models
have their own parameters which define the slope distribution for
microfacet. For ON that's $\sigma^2$, the variance of the Gaussian
distribution and for CT that's $m$, which wiki describes as "RMS
slope of microfacets" (check respective links). Which one of these
will govern the roughness of the surface?</p></li>
<li><p>Moving on further there is a more general question. In the older models such 
as Blinn-Phong we used to have a separate diffuse and specular color. The 
specular color, from what I understand is nothing more than the Fresnel 
Reflectance. This is because Fresnel
reflectance is dependent on wavelength. In case of Dielectrics this
isn't discernable but for metals it usually is (gold gives of a
yellowish tint). Hence for dielectrics the specular color would just
be the plain old Fresnel reflectance replicated across RGB channels
while for metals this would be the color of the tint. </p>

<p>The thing that confuses me is the lingering concept of diffuse and
specular reflectivity. Consider Cook-Torrance's original paper where
they describe their model as.</p>

<p>$R = dR_d + sR_s$</p>

<p>Where $d$ and $s$ are the coeffecients for diffuse and specular
reflectivity respectively and they must hold the condition.</p>

<p>$d+s \leq 1$</p>

<p>$R_d$ is any diffuse BRDF (they assume lambertian) while $R_s$ is
their new proposed BRDF for specular surfaces.</p>

<p>That's where my biggest confusion is. I was thinking the diffuse and
specular colors as the object's respective reflectivities in each
channel. The above equation however separates the color from
reflectivity. <strong>Which concept is used in PBR?</strong></p></li>
</ol>

CC BY-SA 4.0
2018-09-03T23:11:21.100Z
Not a proper answer but regarding your second point, don't use Oren Nayar with CT - the roughness terms are not compatible. Google 'Hammon GGX' for a diffuse term that plays nice.
russ
CC BY-SA 4.0
2018-09-04T19:40:12.593Z
@russ - Must be why I haven't seen anybody using both with one another. I'm separating my point 3 into a different question which is more concerned with light-matter interactions and is a little unrelated to how I should pick my BSDFs.
gallickgunner
<brdf><physically-based>
PBR - How to handle multiple BSDFs and material type
gallickgunner
# PBR - How to handle multiple BSDFs and material type

(Asked by: username_0 on 2018-09-03)

So I am in the midst of writing my own path traced renderer and right now I have only implemented the old Blinn-Phong models where we separately calculated the diffuse and specular components of the material and each object had a specular and a diffuse color.

Now going towards the more general side I want to be able to render different types of objects wood, polished wood, perfect mirror like reflections etc. However all this information confuses me on how should I implement these BSDFs or in other words how should I choose when to apply a certain BSDF or maybe a combination of two?

This is usually done using a material approach. The material being diffuse, glossy or perfect specular would define which BSDFs should I use.

I read PBRT for clues and they break surface reflection into 4 types. Diffuse, Glossy Specular, Specular and retro reflective. Then they implement an `enum` that stores the type corresponding to these reflection.

The enum has the types

```
BSDF_REFLECTION
BSDF_TRANSMISSION
BSDF_DIFFUSE
BSDF_GLOSSY
BSDF_SPECULAR
BSDF_ALL

```

1. The users are supposed to select a bitwise combination of the first two and
   the next 3 ones. Where `BSDF_ALL` is a combination of
   all the flags. This interface seems nice but there is one little
   confusion. If `BSDF_ALL` combines all flags, then this means the
   surface can be `diffuse` and `specular`. However this seems odd, a
   perfectly specular surface can't be diffuse. While `Glossy + Diffuse` make
   sense (polished wood, paint on a rough wall), `diffuse + specular` and
   `glossy + specular` don't make sense to me.
2. Assuming we have solved the above problem consider an object that is
   glossy+diffuse like an orange or lemon skin. How do we
   calculate the color for this surface? Suppose I am using
   [Oran-Nayar](https://en.wikipedia.org/wiki/Oren%E2%80%93Nayar_reflectance_model) model (ON) for diffuse surfaces and
   [Cook-Torrance](https://en.wikipedia.org/wiki/Specular_highlight#Cook%E2%80%93Torrance_model) (CT) for specular ones.

   Should I compute the diffuse component through ON and specular
   through (CT) then add them together? However both of these models
   have their own parameters which define the slope distribution for
   microfacet. For ON that's $\sigma^2$, the variance of the Gaussian
   distribution and for CT that's $m$, which wiki describes as "RMS
   slope of microfacets" (check respective links). Which one of these
   will govern the roughness of the surface?
3. Moving on further there is a more general question. In the older models such
   as Blinn-Phong we used to have a separate diffuse and specular color. The
   specular color, from what I understand is nothing more than the Fresnel
   Reflectance. This is because Fresnel
   reflectance is dependent on wavelength. In case of Dielectrics this
   isn't discernable but for metals it usually is (gold gives of a
   yellowish tint). Hence for dielectrics the specular color would just
   be the plain old Fresnel reflectance replicated across RGB channels
   while for metals this would be the color of the tint.

   The thing that confuses me is the lingering concept of diffuse and
   specular reflectivity. Consider Cook-Torrance's original paper where
   they describe their model as.

   $R = dR\_d + sR\_s$

   Where $d$ and $s$ are the coeffecients for diffuse and specular
   reflectivity respectively and they must hold the condition.

   $d+s \leq 1$

   $R\_d$ is any diffuse BRDF (they assume lambertian) while $R\_s$ is
   their new proposed BRDF for specular surfaces.

   That's where my biggest confusion is. I was thinking the diffuse and
   specular colors as the object's respective reflectivities in each
   channel. The above equation however separates the color from
   reflectivity. **Which concept is used in PBR?**

**Tags:** brdf, physically-based

> **Comments:**
> **username_1**: Not a proper answer but regarding your second point, don't use Oren Nayar with CT - the roughness terms are not compatible. Google 'Hammon GGX' for a diffuse term that plays nice.  
> **username_0**: @username_1 - Must be why I haven't seen anybody using both with one another. I'm separating my point 3 into a different question which is more concerned with light-matter interactions and is a little unrelated to how I should pick my BSDFs.  

---

## 0 answers

