# Microfacet shading for diffuse materials

I recently replaced the Lambertian BRDF in my path-tracer with Oren-Nayar, under the assumption that I could adjust it to use the GGX distribution model with appropriate masking/shadowing.

PBR suggests this is't viable, though - Oren-Nayar is formulated without any clear $D$/$F$/$G$ parameters, and a note under the Torrance-Sparrow model states that "one of the nice things about the Torrance-Sparrow model is that the derivation doesn't depend on the particular microfacet distribution being used" (implying this isn't the case for Oren-Nayar).

If Oren-Nayar is extensible, how would I do that? I suspect I could replace my $\sigma$ values with an NDF taking some $\alpha$ parameter (effectively convolving against the implicit Gaussian in the Oren-Nayar definition), and multiply the evaluated Oren-Nayar function against $G$ to capture masked segments of $dA$, but won't this clash with assumptions made by the derivation? PBR states that the function natively accounts for Gaussian-distributed masking, so applying another function over the top should result in over-darkening...

If it isn't extensible, can I adjust Torrance-Sparrow instead? Locking $F(\omega_o)$ to $1$ should remove Fresnel effects, and the specular assumption can be negated by extracting the $d\omega_h = \frac{d\omega_o}{4\cos\theta_o}$ relationship to create the modified BRDF $f(\omega_o, \omega_i) = \frac{D(\omega_h)G(\omega_o,\ \omega_i)d\omega_h}{d\omega_o\cos\theta_o}$

You can combine Oren-Nayar with GGX, if your normalize the result. A BRDF is defined by two properties: Helmholtz reciprocity and energy conservation.

$f(l_i, l,_o) = f(l_o, l_i)$

$f(l_i, l_o) \leq 1$

Your Oren-Nayar is the diffuse part $f_d(l_i, l_o)$ and your GGX is your specular part $f_s(l_i, l_o)$. If both are energy conserving, then both are at most $1$, but combined they may be $\geq 1$ and here lies your problem. Oren-Nayar has been combined with specular terms before (see for example The Rendering of Ryze from Crytek, you should have a look at how others did it. If you combine them, keep in mind that you need two different roughness values. The ones of Oren-Nayar and GGX don't match (which by the looks of it you know already) but neither can you convert from one to the other via an algorithm.

A better solution imo is to use a different diffuse term. Have a look at the papers Physically Based Shading at Disney by Brent Burley and PBR diffuse Lighting for GGX+Smith Microsurfaces by Earl Hammon Jr.. Physically Based Shading discusses several diffuse lighting BRDFs, including Oren-Nayar and then goes on to introduce an own diffuse BRDF which can use the same roughness value as GGX (be careful, as the roughness here is squared before using, iirc, because that was easier to use for artists). This resulting BRDF is not energy conserving, which was accepted by the author, since

This seems to provide a reasonable match to the MERL data and was also found to be artistically pleasing.

A solution for this was introduced by Sebastien Lagarde and Charles de Rousiers in Moving Frostbite to Physocally Based Rendering, they renormalized the entire BRDF.

PBR diffuse Lighting for GGX+Smith Microsurfaces by Earl Hammon takes a different approach, he calculates an approximation like Oren and Nayar did, only he did it for GGX NDF and Smith shadowing/masking. Both the Disney Diffuse and Hammon's Diffuse BRDF can easily be combined with the GGX specular term and are visually more pleasing than Lambert.

• Sorry for all the layout errors... Was typing this on my phone without any preview. I'll correct that knce I'm at my pc. – Tare Feb 1 '18 at 6:21
• Sorry for the wait...ended up getting caught up with bdpt and forgetting about materials for a while :). It sounds like GGX/Smith is a strictly specular NDF and Oren-Nayar is a strictly diffuse NDF (i.e. it's meaningless to expect diffuse illumination from GGX/Smith or specular illumination from Oren-Nayar, even if you swap out the underlying macrosurfaces), is that right? – Paul Ferris Feb 22 '18 at 23:53
• Yes, that is (mostly) correct. One thing about Oren-Nayar is that it incorporates some aspect of specular lights, because it has some view dependency. However, there are no real highlights, there is just a shadowing effect where $n \cdot v \rightarrow 0$ (with $n$ is surface normale and $v$ is view vector), so I'd not go as far and say that that effect is real specular lighting effect. – Tare Feb 23 '18 at 6:35
• Great, thank you! My mostly-unfinished materials system defines a "material" as a vector of BRDF probabilities; would I get reasonable results if I had two randomly-selected + separate specular/diffuse microfacet BRDFs (given distinct specular/diffuse roughnesses + PDFs for the individual BRDFs)? – Paul Ferris Feb 23 '18 at 13:08
• I am not entirely sure, how you are doing this. If you want to know, if you can reasonable results by combining an arbitrary diffuse BRDF with an arbitrary specular BRDF, then yes, it is possible. In fact, if you look through somewhat modern games and papers, that's what people have been doing for quite some time - they choose one BRDF for diffuse and one for specular lighting and then manually tweak the properties until the result looks good. The combinations are up to the teams: A lot of people used GGX+Lambert, but also Beckmann+Lamber or either specular BRDF with Oren-Nayar has been used. – Tare Feb 23 '18 at 13:37