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
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. IfBSDF_ALL
combines all flags, then this means the surface can bediffuse
andspecular
. However this seems odd, a perfectly specular surface can't be diffuse. WhileGlossy + Diffuse
make sense (polished wood, paint on a rough wall),diffuse + specular
andglossy + specular
don't make sense to me.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 model (ON) for diffuse surfaces and Cook-Torrance (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?
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?