Principled v Generalized Diffuse

When we generally talk about 'diffuse', technically we intend the relationship between object normals and light direction such that the diffuse model is : N.L. This reads, - N dot L. When we take the dot of two vectors we measure the scalar magnitude between them. Here that means we get the magnitude of the light falling on the portion of object expressed by its normal. It's easy to see that the more the two vectors are aligned the less the magnitude and consequentely the less the diffuse shading. This is called the Lambert’s Cosine Law (it uses the cosine of the angle between the two vectors) and formally it states that a light ray hitting the surface from a given direction depends on the cosine of the angle of incidence.

For example let's say we have a white sphere and a plain area light.. then to compute diffuse shading we simply have to do (1,1,1)*(N.L). Where the light strikes perpendicular to the surface (ie. parallel to the surface normal) we have a dot of 1.. so it's (1,1,1)*1.. our fully white material. Where the light strikes almost parallel (ie. perpendicular to the surface normal) we have almost a dot of 0.. so it's (1,1,1)*0.. ie. fully shaded. This is the plain diffuse model.

Below, in green we've surface normals while the white line pointing at the sphere is the light direction. To get the full physical intuition of diffuse shading .. just look where we're at full white and where we start to get it shaded until we get to full black.

So how can we have different diffuse shading models considering the model itself is so basic but already a lot expressive of what our eyes see ? It is when we start considering the material may have micro-structures that eventually further contribute to the whole shading. Porous materials for example tends to flat the diffuse shading so that the shading between our full whites and full blacks gets less contrasted .. this is because the micro holes that generally make up a porous surface are absorbing light in the sense that it keeps bouncing into the micro holes without reaching our eyes.

This is where a more complex model is needed to model such effects. This model is generally the Oren-Nayar model. It exhibits a 'roughness' parameter to approach the porousness of a material. The theory is complex and we won't introduce it here. For the while we just need to know that it is based on a wrong asumption. The theory behind Oren-Nayar model is effectively based on single scattering micro-facet model. We have already heard of micro-facet theory because it is the same used to model reflections and it suffers of the same problem, - it is only single scattering while it should be multi scatter .. ie. light will bounce multiple times into those micro-holes and not only one single time. Without multiple scattering our results will be dark and to some extents not realistics. That's also why almost nobody cares about the diffuse 'roughness' parameter ;) 

Generally as developers we have a couple of ways to approach a certain problem. Go deeper into theory and provide better models or try to get approximated ones from reality inspection and heavy testing and maybe a bit of lucky. With RomboDiffuse nodes we get both approaches and more.

Let's see the approximated one. Oren-Nayar model backups on serious theory but it misses to fully exploit it for the reasons we've seen above. This means that it is generally slower and less realistic than other approximated models. Here we'll compare it with a 'principled' implementation we use in romboDiffusePrincipled node (we deal instead with Oren-Nayar with romboDiffuseGeneralized; Arnold Standard Surface also uses Oren-Nayar).

Diffuse Principled has a roughness param and a subsurface param.
Let's see first how a principled vs generalized (Oren-Nayar) models compare.

Both images above have been rendered with roughness set to zero. We see a little difference at grazing angles where the principled model is a tad brighter. Let's set now roughness at 0.5 for both models. Here differences start to appear more dramatic. We already see what's going on with the generalized model .. it gets too dark because of what we said above about single scattering .. ie. it starts leaking energy.

We said roughness should make the contrast between light and dark less contrasted because light is attenuated by micro porosity. It does with both models but the generalized model gets really too dark while the principled does not, keeping its overall brightness as we can see below where we set roughness at 1.

Now let's compare how the roughness influences the appearance of the principled diffuse model. We can clearly see how the rough diffuse is less contrasted while it retains its overall brightness.

We have not finished with the Diffuse Principled because it allows for an additional parameter that will further influence its overall appearance. This parameter is called 'subsurface'. It simulates overall subsurface scattering without effectively computing any SSS. What generally does SSS ? It does darken a bit the overall brightness because some light is intended to never come back from under the surface. It does also further un-contrast the diffuse appearance because where with plain diffuse we should be almost black .. with SSS we'll have some more light there coming from under the surface. Left, plain diffuse; right, roughness and sss at 1. See how bright and dark peaks are inhibited by the two parameters for an overall less contrasted appearance while maintaing energy conservation. 

Because of the energy leaks we almost never use the DiffuseGeneralized node when we need to deal with diffuse roughness, we provide it as a shading node just so we're able to match some renditions done with that model but for our own work we almost always use the DiffusePrincipled node. It can be easily used everywhere where we need plain diffuse shading and it is particularly effective for wall paints, paper, potteries, ceramics etc.

Take care that in a different scenario both diffuse roughness and subsurface params make a big difference in the final appearance. We really use them to better control the distribution of light on the surface. Just below we compare between zero and full roughness .. with full roughness light gets less reach because the surface is rough.

Here instead we compare 0 to 1 subsurface param. 

Eventually a comparison between plain lambert and a principled implementation wih roughness and subsurface both set to 0.5. Note how we get rid of the dark silhouette and how the material is exhibiting backscattering. 

Leave a Reply