Computer Graphics · Shading Models
Microfacet Distributions and the Shadowing Term That Balances Them
Why a half-vector distribution alone gives the wrong energy, how Smith masking accounts for one microsurface occluding another, and what correlated visibility changes.
A microfacet model replaces a rough surface with a statistical description: a field of tiny mirror facets, each oriented along some normal, and a distribution saying how many facets point each way. Cook and Torrance introduced the form for rendering in 1982, building on the earlier optics work of Torrance and Sparrow. The attraction is that a single distribution, a Fresnel factor, and a shadowing factor produce a specular lobe whose width and shape match many real materials.
The difficulty is that the three factors are not independent. The same microgeometry that redirects light also hides it. A formulation that treats the distribution as if every facet were visible from every direction produces more reflected energy than arrived, particularly at grazing angles, and a renderer built on it will brighten a rough metal until it glows.
Facets, half-vectors, and the distribution D
A facet reflects the incident direction ω_i into outgoing ω_o only if its own normal is the half-vector h = normalize(ω_i + ω_o). For a fixed pair of directions, that is a single direction, so the number of facets that can serve the pair is proportional to the density of facet normals around h. Call the normalized density D(h). It integrates to one over the sphere of normals when weighted by the cosine:
$$\int_{\Omega} D(h), (h \cdot n), d\omega_h = 1$$
The normalization is where implementations diverge. Several conventions are in circulation, differing by factors of cos θ_h or by whether the density is defined with respect to the half-vector measure or the normal measure. Beckmann’s distribution, derived from a Gaussian model of surface slopes, and GGX (Trowbridge–Reitz), derived from a Cauchy-like slope distribution, are the two classical choices. Both have a roughness parameter; GGX’s long tail is why it produces the characteristic soft falloff seen on brushed metal.
GGX in the common parameterization, with α the roughness, is
$$D(h) = \frac{\alpha^2}{\pi \left( (h \cdot n)^2 (\alpha^2 - 1) + 1 \right)^2}$$
As α approaches zero the distribution collapses toward the mirror delta at h = n. As α approaches one it becomes very broad. The tail decays as roughly 1/θ⁴ for large angles, far slower than Beckmann’s Gaussian tail, and that difference is measurable: GGX and Beckmann with the same nominal roughness do not look alike at the lobe edge.
Why D alone overestimates
For a specular microfacet BRDF the reflected radiance is a ratio of the facet density to a geometric factor, because the light collected by a tilted facet is spread over a different projected area. The classical form is
$$f_r = \frac{F(\omega_i, h), D(h), G(\omega_i, \omega_o)}{4, (\omega_i \cdot n)(\omega_o \cdot n)}$$
The factor of four comes from the Jacobian of the half-vector change of variables, which converts an integral over outgoing directions into one over half-vector directions. It is not a normalization; it is a consequence of the substitution, and dropping it makes the lobe four times too wide or narrow depending on which side of the equation the mistake lands.
G is the geometric term: the fraction of facets that are neither shadowed from the light nor masked from the eye, considering that a rough surface has valleys. Without G, the model asserts that the surface is a fog of independently floating mirrors with no mutual occlusion, and nothing in the physics permits that. At normal incidence, G is close to one for modest roughness. At grazing incidence, it falls sharply, and that fall is what keeps the lobe from exceeding the energy budget.
The combined term G/(4 cosθ_i cosθ_o) is often called the visibility term V. For the Smith shadowing model, V simplifies to a product of two one-dimensional functions divided by the same denominator, which is why Smith is cheap and why nearly every production renderer uses it.
/* Smith height-correlated masking-shadowing with GGX, after Heitz 2014. */
static double lambda_ggx(double cos_v, double alpha) {
double c2 = cos_v * cos_v;
double tan2 = (1.0 - c2) / c2; /* caller guarantees cos_v > 0 */
return 0.5 * (sqrt(1.0 + alpha * alpha * tan2) - 1.0);
}
static double smith_g2_ggx(double cos_i, double cos_o, double alpha) {
double li = lambda_ggx(cos_i, alpha);
double lo = lambda_ggx(cos_o, alpha);
return 1.0 / (1.0 + li + lo); /* height-correlated masking-shadowing */
}
/* The visibility term used in the BRDF: G divided by the 4 cos factors. */
static double visibility_ggx(double cos_i, double cos_o, double alpha) {
return smith_g2_ggx(cos_i, cos_o, alpha) / (4.0 * cos_i * cos_o);
}
Two conventions of “uncorrelated” and “correlated” Smith appear in this code and in the literature. Uncorrelated Smith assumes the height that shadows a point and the height that masks it are independent random variables, so the joint probability factorizes. Correlated Smith accounts for the fact that both conditions are evaluated at the same point on the same height field, and it produces a slightly darker result with the same cost. The difference is a few percent on rough surfaces at grazing angles, but it is systematic and it shows up as a visible ring where a sphere turns away from the camera.
Energy: the part no G fixes
Even with exact Smith masking, single-scattering microfacet models lose energy. The reason is that a facet can reflect light toward another facet, which reflects it again. The single-scattering model counts only paths that leave the surface after exactly one facet interaction. On a rough metal with α near 1, the missing multiple-scattering component is significant; integrating the single-scattering lobe shows a deficit that grows into a substantial fraction of the reflected energy at high roughness, with the exact figure depending on the Fresnel value.
The effect is visually specific: a rough metal with correct single-scattering G looks too dark in the mid-tones and has insufficient saturation shift toward the highlight, because the missing component is light that has been reflected twice and therefore attenuated by the Fresnel factor a second time. White rough surfaces are the clearest test: a white furnace test with a dielectric at α = 1 loses a large visible fraction of energy.
Compensating requires either an added diffuse-like lobe fitted to the deficit or an explicit multi-bounce solution. The Kulla–Conty approach computes the directional albedo of the single-scattering layer numerically, then adds a term whose albedo is exactly the complement, scaled by a Fresnel product. It is an approximation, but it is an approximation of a quantity that can be computed, not a fudge factor. The multiple-scattering energy compensation article treats that correction in detail.
There is also a subtler accounting problem: the compensation term is reciprocal only if the underlying single-scattering model is. Any anisotropic or height-correlated edit that breaks reciprocity also breaks the ability to reuse a single precomputed albedo table, because the reciprocal direction’s albedo differs.
Anisotropy and the direction of the grain
Real brushed materials are anisotropic: machining marks, hair, and drawn metal all have a preferred direction. The standard extension stretches the roughness along two tangential axes, giving α_x and α_y instead of one α. The half-vector is projected onto the tangent frame and each component is scaled by its roughness before the distribution is evaluated.
The consequence is a specular lobe that is narrow across the grain and wide along it, which produces the elongated highlight streaks seen on turned metal. The masking term must use the same anisotropy; evaluating G with an isotropic roughness while D is anisotropic gives an inconsistent energy budget and produces a lobe that is too bright along the narrow axis.
At α_x = α_y the model reduces exactly to the isotropic case, which makes it possible to store one pair of roughness values per material and let artists dial them independently. Extreme ratios, beyond roughly 10:1, tend to produce visible artifacts on interpolated normals because the tangent frame becomes ill-conditioned where the interpolated normal is close to the geometric one.
Where the model stops describing the surface
Microfacet theory assumes the facets are much larger than the wavelength and much smaller than the shading footprint. Both bounds fail in practice. A surface polished to roughness below about a tenth of a wavelength stops behaving like a collection of mirrors and starts exhibiting thin-film interference or diffraction; the visual signature is colored highlights that shift with angle, which no amount of GGX can produce. A surface whose facets are comparable to a pixel footprint aliases, because the distribution is being sampled below its own scale, which is a filtering problem rather than a reflectance one.
The model also assumes a height field: single-valued, no undercuts. Etched metal and woven fabric violate this. For those, the distribution can still be fitted to measurements, but the fitted parameters no longer mean what the derivation says they mean, and energy compensation derived from single-scattering assumptions may not apply; the complement-lobe correction exists precisely because the single-scattering assumption understates the reflected energy. A BRDF that fits the data is not the same as a model that explains it, and keeping the distinction is what prevents a renderer from accumulating corrections that cancel each other.
References
- Models of Light Reflection for Computer Synthesized Pictures — James F. Blinn, SIGGRAPH 1977
- Microfacet Models for Refraction through Rough Surfaces — Walter, Marschner, Li, Torrance, EGSR 2007
- Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs — Eric Heitz, Journal of Computer Graphics Techniques, 2014