Specular BRDF Reference
While I worked on our new shading model for UE4 I tried many different options for our specular BRDF. Specifically, I tried many different terms for to Cook-Torrance microfacet specular BRDF:
Directly comparing different terms requires being able to swap them while still using the same input parameters. I thought it might be a useful reference to put these all in one place using the same symbols and same inputs. I will use the same form as Naty , so please look there for background and theory. I'd like to keep this as a living reference so if you have useful additions or suggestions let me know.
First let me define alpha that will be used for all following equations using UE4's roughness:
Normal Distribution Function (NDF)The NDF, also known as the specular distribution, describes the distribution of microfacets for the surface. It is normalized  such that:
It is interesting to notice all models have
This is not the common form but follows when
GGX (Trowbridge-Reitz) :
GGX Anisotropic :
Geometric ShadowingThe geometric shadowing term describes the shadowing from the microfacets. This means ideally it should depend on roughness and the microfacet distribution.
SmithThe following geometric shadowing models use Smith's method for their respective NDF. Smith breaks
I will define
The Smith integral has no closed form solution for Blinn-Phong. Walter  suggests using the same equation as Beckmann.
This is not the common form but is a simple refactor by multiplying by
Schlick  approximated the Smith equation for Beckmann. Naty  warns that Schlick approximated the wrong version of Smith, so be sure to compare to the Smith version before using.
For UE4, I used the Schlick approximation and matched it to the GGX Smith formulation by remapping
FresnelThe Fresnel function describes the amount of light that reflects from a mirror surface given its index of refraction. Instead of using IOR we instead use the parameter or
OptimizeBe sure to optimize the BRDF shader code as a whole. I choose these forms of the equations to either match the literature or to demonstrate some property. They are not in the optimal form to compute in a pixel shader. For example, grouping Smith GGX with the BRDF denominator we have this:
In optimized HLSL it looks like this:
float a2 = a*a;
float G_V = NoV + sqrt( (NoV - NoV * a2) * NoV + a2 );
float G_L = NoL + sqrt( (NoL - NoL * a2) * NoL + a2 );
return rcp( G_V * G_L );
If you are using this on an older non-scalar GPU you could vectorize it as well.
References Hoffman 2013, "Background: Physics and Math of Shading"
 Blinn 1977, "Models of light reflection for computer synthesized pictures"
 Beckmann 1963, "The scattering of electromagnetic waves from rough surfaces"
 Walter et al. 2007, "Microfacet models for refraction through rough surfaces"
 Burley 2012, "Physically-Based Shading at Disney"
 Neumann et al. 1999, "Compact metallic reflectance models"
 Kelemen 2001, "A microfacet based coupled specular-matte brdf model with importance sampling"
 Smith 1967, "Geometrical shadowing of a random rough surface"
 Schlick 1994, "An Inexpensive BRDF Model for Physically-Based Rendering"
 Karis 2013, "Real Shading in Unreal Engine 4"
 Cook and Torrance 1982, "A Reflectance Model for Computer Graphics"
 Reed 2013, "How Is the NDF Really Defined?"