# Physically Based Shading for Diffuse surfaces

So I am currently in the process of implementing Physically based Shading in my pathtracer using microfacet models and I'm quite stuck at comprehending light interaction with diffuse surfaces.

First of all I want to get a clear concept of how surfaces actually get their color. We all know that the color of any surface is due to their property to absorb light of certain wavelength in the Visible region of the spectrum. More specifically, according to the answer here, when light hits an atom or molecule it gets absorbed if the electrons have the same vibrational frequency as the light. Which is the reason for the color of a surface. Now let's see what happens when light interacts with a diffuse surface.

When Light hits a diffuse (dielectric or non-metal) surface 2 things happen. It gets reflected specularly or it gets refracted, scattered, and re-emitted which we call "diffuse reflection". The amount of light that gets reflected/refracted depends on the Fresnel Equation which are wave-length dependent. This gives off the hint that an RGB triple also arises due to wavelength dependent IOR and thus maybe the reason for the color. So here's the main confusion.

1. When light hits a diffuse surface and gets reflected specularly it's possible that the atoms or molecules at the interaction surface absorb some of the light. This might be the reason for the color. On the other hand, the composition of light also changes in each of the R, G, B spectrum due to wavelength dependent index of refraction and Fresnel equations. So what's the real reason for the color? Is it the former or the latter or a mix of the two? I've read some notes by Naty Hoffman where he also suggests using the Fresnel Reflectance values as the specular color when calculating a specular BRDF like Cook torrance. Adds a lot more to my confusion.

After the above has been clarified how does the whole thing tie with the light that got refracted, scattered and re-emitted?

1. Secondly since diffuse surfaces exhibit both specular and diffuse reflection why do I mostly see people using just lambertian model for diffuse surfaces? The proper way would be to use a BRDF for diffuse reflection + a BRDF for specular like Cook Torrance. Am I correct?

2. Thirdly shouldn't we be weighting the diffuse component with $$(1-F_{in})(1-F_{out})...$$ or more fresnel terms depending on, if the refracted ray undergoes total internal reflection. Are these factors built-in by default or what?

• I'll try to find time to answer later, but in the mean time, Naty Hoffman's course is an excellent primer (I'm not sure those are the notes you are referring to). Video: youtube.com/watch?v=j-A0mwsJRmk Course material: blog.selfshadow.com/publications/s2013-shading-course Jan 29, 2019 at 8:39
• Regarding your third point, I asked a similar question here: computergraphics.stackexchange.com/questions/2285/… Jan 29, 2019 at 8:41
• Yeah I actually read the whole course notes by Naty. It was an eye opener but I still couldn't get an answer to above problems. Infact that's where my problem arose. If the Fresnel reflectance is an RGB triple then what's the origin of the color, the absorption by atoms or the frensel reflectance? Maybe the two are linked but I can't seem to figure out how. I read your question but didn't quite understand what the guy was trying to say in the end. So basically the gist is, the fresnel terms are actually baked inside the diffuse BRDF? Jan 29, 2019 at 9:32

So after reading up some more research papers and the concepts of most people working in this field here and there, I've reached an answer I'm satisfied with. If someone disagrees or thinks there is a better or more correct way to think the problem do share your ideas.

1) First to answer my point 1. I've noticed that most di-electric surfaces' Index of refraction remains fairly constant over the visible spectrum. This means the Fresnel Reflectances remain constant and are quite low over the visible spectrum for normal incidence. For angles near 90 degrees, even rough di-electric surfaces start reflecting the incoming light specularly. You can see this data here

However in the case of metals the IOR or more specifically the Fresnel Reflectances take on the exact same value as the color (in case of gold and copper). From this I conclude that,

For metals where Fresnel Reflectances (FR) vary greatly over the visible spectrum, FR is linked and is just a consequence of the surface of metals absorbing photons of certain frequencies. This means for Gold, the electrons at the surface absorb the blue-end of the spectrum, the remaining golden colored light either gets reflected or refracted. Thus the Fresnel Reflectance is golden in color which we can also call the "Specular Color". Note that the absorption depends on whether there are electrons available. It's possible for some blue photons to refract or reflect if there aren't much electrons for absorbing to begin with.

In-case of di-electrics the FR don't change much over the visible spectrum. However we can see color. The possible explanation is that the color in case of di-electrics comes from within the surface. That is, there are no such electrons present at the "interface" that absorb certain frequencies. Else we would have seen different FR for different wavelengths. The electrons absorbing wavelengths of certain frequencies come from within the surface, like pigments lying inside a liquid. Hence for di-electrics FR is not really linked to the concept of electrons absorbing certain frequencies imo.

This makes sense to me as colored metals (gold, copper) tint the reflections with their color. However certain di-electrics don't such as a polished marble floor. The reason for that again is that in case of metals the cause of color i.e. absorption by electrons occurs directly on the surface. The reflected light thus has a different composition for R,G,B giving us the tint. However for di-electrics the cause of color lies beneath the surface. Hence the reflection is non-tinted.

Thus simply stating for metals FR is the same as the albedo/color of the surface. For non-metals or di-electrics FR is different from the albedo/color and just defines the amount of specular reflection.

2) The proper way would surely be to use a BRDF with both diffuse and specular components since diffuse surfaces reflect greatly at near-grazing angles.

3) Still don't know about this. It might be baked in or not. What I do know is that the diffuse component should surely get lesser and specular component larger as angle increases to 90.

Another interesting point to note is that the basic Fresnel Equations apply for transparent and Flat surfaces. For metals we have complex IOR making the equations a little more complex. Sebastian Lagarde did a comparison here. Fresnel equations don't apply to rough surfaces but for microfacet models where we assume each facet to be perfectly specular we can maybe. Either way they are a good way to approximate the behaviour for increasing reflection near 90 degrees.

When people talk about diffuse surfaces in CG they usually mean ideal diffuse surfaces. That is, the BRDF is simply: $$f(\omega_o,x,\omega_i) = const$$. We're talking about Lambertian reflectance. The colour you perceive is due to both the initial light colour and the albedo of the material. If you shine white light, then you'll really perceive what's left of it after absorption. So when you set $$albedo = (r,g,b)$$ then your surface reflects $$r \%$$ of the red light, $$g\%$$ of the green light, and $$b\%$$ of the blue light. Note that the tricolor formulation is not how it actually works in the real world, to be precise you should really be dealing with wavelengths, however $$RGB$$ is a good approximation perceptually due to how the human visual system works.

The cosine term is not actually part of the diffuse BRDF either, it comes from Lambert's law (the cosine term in the rendering equation).

Lastly you should realise that even Cook-Torrance is an approximation to a class of semi-plausible BRDFs.

• I actually know most of the things you're trying to tell me. In CG nothing is accurate and we are dealing with approximations even at the highest level of Physically based rendering/shading. The main point is the origin of the color. As you said albedo represents the amount light energy gets reflected in that specific wavelength or in-other words get absorbed. Where does the RGB triple for Fresnel reflectance ties in as this also represents the amount of energy reflected in each of the specific wavelengths? Jan 31, 2019 at 9:54
• gallickgunner: You don't use Fresnel with ideal diffuse materials. RGB are not specific wavelengths either, you do (weighted) integration over wavelengths. @simon F Please do not edit my post over nothing. 'realize' is a perfectly valid spelling. And I would appreciate it if you do not remove my thoughts out of my post. Most of what was written was wrong in case you did not notice. Jan 31, 2019 at 10:16
• I edited your answer WRT your opinion on the OP's mental state. IMO that was inappropriate. (As for the spelling that was simply because my the browser flagged it as incorrect) Jan 31, 2019 at 11:15
• @Simon F Yeah, after googling it doesn't seem like it means what I thought it did (at least in English, I translated a phrase from my language), I apologise. What I was trying to say is that he has too many wrong notions mixed up with correct ones. My point being that it's probably best that he reads a good book/article on the subject from scratch, rather than keep adding on top of that. Jan 31, 2019 at 13:19
• I'm not concerned whether we are talking about ideal diffuse or real diffuse. (atleast for point 1). When I say specific wavelengths, I don't mean to think of R,G,B as a single number assosciated with wavelength. I fully comprehend R,G,B are more of a range of spectrum. If it seemed that way then I apologize for stating it that way. That aside your answer here completely misses the core of my question and points 1,2,3. I'm simply confused about the relation between the fresnel reflectance and the energy getting absorbed. Both imply the origin for the color of the surface. Jan 31, 2019 at 14:16