9.8.1. Normal Distribution Functions

The normal distribution function has a significant effect on the appearance of the rendered surface. The shape of the NDF, as plotted on the sphere of microfacet normals, determines the width and shape of the cone of reflected rays (the specular lobe), which in turn determines the size and shape of specular highlights. The NDF affects the overall perception of surface roughness, as well as more subtle visual aspects such as whether highlights have a distinct edge or are surrounded by haze.

However, the specular lobe is not a simple copy of the NDF shape. It, and thus the highlight shape, is distorted to a greater or lesser degree depending on surface curvature and view angle. This distortion is especially strong for flat surfaces viewed at glancing angles, as shown in Figure 9.35. Ngan et al. [1271] present an analysis of the reason behind this distortion.

image

Figure 9.35. The images on the left are rendered with the non-physical Phong reflection model. This model’s specular lobe is rotationally symmetrical around the reflection vector. Such BRDFs were often used in the early days of computer graphics. The images in the center are rendered with a physically based microfacet BRDF. The top left and center show a planar surface lit at a glancing angle. The top left shows an incorrect round highlight, while the center displays the characteristic highlight elongation on the microfacet BRDF. This center view matches reality, as shown in the photographs on the right. The difference in highlight shape is far more subtle on the sphere shown in the lower two rendered images, since in this case the surface curvature is the dominating factor for the highlight shape. (Photographs courtesy of Elan Ruskin.)

Isotropic Normal Distribution Functions

Most NDFs used in rendering are isotropic—rotationally symmetrical about the macroscopic surface normal nn . In this case, the NDF is a function of just one variable, the angle θmθm between nn and the microfacet normal mm . Ideally, the NDF can be written as expressions of cosθmcosθm that can be computed efficiently as the dot product of nn and mm .

The Beckmann NDF [124] was the normal distribution used in the first microfacet models developed by the optics community. It is still widely used in that community today. It is also the NDF chosen for the Cook-Torrance BRDF [285,286]. The normalized Beckmann distribution has the following form:

(9.35)

D(m)=χ+(n·m)πα2b(n·m)4exp((n·m)2-1α2b(n·m)2).
D(m)=χ+(nm)πα2b(nm)4exp((nm)21α2b(nm)2).

The term χ+(n·m)χ+(nm) ensures that the value of the NDF is 0 for all microfacet normals that point under the macrosurface. This property tells us that this NDF, like all the other NDFs we will discuss in this section, describes a heightfield microsurface. The αbαb parameter controls the surface roughness. It is proportional to the root mean square (RMS) slope of the microgeometry surface, so αb=0αb=0 represents a perfectly smooth surface.

To derive the Smith G2G2 function for the Beckmann NDF, we need the corresponding ΛΛ function, to plug into Equation 9.24 (if using the separable form of G2G2 ), 9.31 (for the height correlated form), or 9.32 (for the direction and height correlated form).

The Beckmann NDF is shape-invariant, which simplifies the derivation of ΛΛ . As defined by Heitz [708], an isotropic NDF is shape-invariant if the effect of its roughness parameter is equivalent to scaling (stretching) the microsurface. Shape-invariant NDFs can be written in the following form:

(9.36)

D(m)=χ+(n·m)α2(n·m)4g(1-(n·m)2α(n·m)),
D(m)=χ+(nm)α2(nm)4g(1(nm)2α(nm)),

where g represents an arbitrary univariate function. For an arbitrary isotropic NDF, the ΛΛ function depends on two variables. The first is the roughness αα , and the second is the incidence angle of the vector ( vv or ll ) for which ΛΛ is computed. However, for a shape-invariant NDF, the ΛΛ function depends only on the variable a:

(9.37)

a=n·sα1-(n·s)2,
a=nsα1(ns)2,

where ss is a vector representing either vv or ll . The fact that ΛΛ depends on only one variable in this case is convenient for implementation. Univariate functions can be more easily fitted with approximating curves, and can be tabulated in one-dimensional arrays.

The ΛΛ function for the Beckmann NDF is

(9.38)

Λ(a)=erf(a)-12+12aπexp(-a2).
Λ(a)=erf(a)12+12aπexp(a2).

Equation 9.38 is expensive to evaluate since it includes erferf , the error function. For this reason, an approximation [1833] is typically used instead:

(9.39)

Λ(a){1-1.259a+0.396a23.535a+2.181a2,wherea<1.6,0,wherea1.6.
Λ(a){11.259a+0.396a23.535a+2.181a2,0,wherea<1.6,wherea1.6.

The next NDF we will discuss is the Blinn-Phong NDF. It was widely used in computer graphics in the past, though in recent times it has been largely superseded by other distributions. The Blinn-Phong NDF is still used in cases where computation is at a premium (e.g., on mobile hardware) because it is less expensive to compute than the other NDFs discussed in this section.

The Blinn-Phong NDF was derived by Blinn [159] as a modification of the (non-physically based) Phong shading model [1414]:

(9.40)

D(m)=χ+(n·m)αp+22π(n·m)αp.
D(m)=χ+(nm)αp+22π(nm)αp.

The power αpαp is the roughness parameter of the Phong NDF. High values represent smooth surfaces and low values represent rough ones. The values of αpαp can go arbitrarily high for extremely smooth surfaces—a perfect mirror would require αp=αp= . A maximally random surface (uniform NDF) can be achieved by setting αpαp to 0. The αpαp parameter is not convenient to manipulate directly since its visual impact is highly nonuniform. Small numerical changes have large visual effects for small αpαp values, but large values can be changed significantly without much visual impact. For this reason, αpαp is typically derived from a user-manipulated parameter via a nonlinear mapping. For example, αp=msαp=ms , where s is a parameter value between 0 and 1 and m is an upper bound for αpαp in a given application. This mapping was used by several games, including Call of Duty: Black Ops, where m was set to a value of 8192 [998].

Such “interface mappings” are generally useful when the behavior of a BRDF parameter is not perceptually uniform. These mappings are used to interpret parameters set via sliders or painted in textures.

Equivalent values for the Beckmann and Blinn-Phong roughness parameters can be found using the relation αp=2α-2b-2αp=2α2b2 [1833]. When the parameters are matched in this way, the two distributions are quite close, especially for relatively smooth surfaces, as can be seen in the upper left of Figure 9.36.

image

Figure 9.36. On the upper left, a comparison of Blinn-Phong (dashed blue) and Beckmann (green) distributions for values of αbαb ranging from 0.025 to 0.2 (using the parameter relation αp=2α-2b-2αp=2α2b2 ). On the upper right, a comparison of GGX (red) and Beckmann (green) distributions. The values of αbαb are the same as in the left plot. The values of αgαg have been adjusted by eye to match highlight size. These same values have been used in the spheres rendered on the bottom image. The top row uses the Beckmann NDF and the bottom row uses GGX.

The Blinn-Phong NDF is not shape-invariant, and an analytic form does not exist for its ΛΛ function. Walter et al. [1833] suggest using the Beckmann ΛΛ function in conjunction with the αp=2α-2b-2αp=2α2b2 parameter equivalence.

In the same 1977 paper [159] in which Blinn adapted the Phong shading function into a microfacet NDF, he proposed two other NDFs. Of these three distributions, Blinn recommended one derived by Trowbridge and Reitz [1788]. This recommendation was not widely heeded, but 30 years later the Trowbridge-Reitz distribution was independently rediscovered by Walter et al. [1833], who named it the GGX distribution. This time, the seed took root. Within a few years, adoption of the GGX distribution started spreading across the film [214,1133] and game [861,960] industries, and today it likely is the most often-used distribution in both. Blinn’s recommendation appears to have been 30 years ahead of its time. Although “Trowbridge-Reitz distribution” is technically the correct name, we use the GGX name in this book since it is firmly established.

The GGX distribution is

(9.41)

D(m)=χ+(n·m)α2gπ(1+(n·m)2(α2g-1))2.
D(m)=χ+(nm)α2gπ(1+(nm)2(α2g1))2.

The roughness control provided by the αgαg parameter is similar to that provided by the Beckmann αbαb parameter. In the Disney principled shading model, Burley [214] exposes the roughness control to users as αg=r2αg=r2 , where r is the user-interface roughness parameter value between 0 and 1. Exposing r as a slider value means that the effect changes in a more linear fashion. This mapping has been adopted by most applications that use the GGX distribution.

The GGX distribution is shape-invariant, and its ΛΛ function is relatively simple:

(9.42)

Λ(a)=-1+1+1a22.
Λ(a)=1+1+1a22.

The fact that the variable a appears in Equation 9.42 only as a2a2 is convenient, since the square root in Equation 9.37 can be avoided.

Due to the popularity of the GGX distribution and the Smith masking-shadowing function, there has been a focused effort to optimize the combination of the two. Lagarde observes [960] that the height-correlated Smith G2G2 for GGX (Equation 9.31) has terms that cancel out when combined with the denominator of the specular microfacet BRDF (Equation 9.34). The combined term can be simplified thusly:

(9.43)

G2(l,v)4|n·l||n·v|0.5μoα2+μi(μi-α2μi)+μiα2+μo(μo-α2μo).
G2(l,v)4|nl||nv|0.5μoα2+μi(μiα2μi)+μiα2+μo(μoα2μo).

The equation uses the variable replacement μi=(n·l)+μi=(nl)+ and μo=(n·v)+μo=(nv)+ for brevity. Karis [861] proposes an approximated form of the Smith G1G1 function for GGX:

(9.44)

G1(s)2(n·s)(n·s)(2-α)+α,
G1(s)2(ns)(ns)(2α)+α,

where ss can be replaced with either ll or vv . Hammon [657] shows that this approximated form of G1G1 leads to an efficient approximation for the combined term composed of the height-correlated Smith G2G2 function and the specular microfacet BRDF denominator:

(9.45)

G2(l,v)4|n·l||n·v|0.5lerp(2|n·l||n·v|,|n·l|+|n·v|,α),
G2(l,v)4|nl||nv|0.5lerp(2|nl||nv|,|nl|+|nv|,α),

which uses the linear interpolation operator, lerp(x,y,s)=x(1-s)+yslerp(x,y,s)=x(1s)+ys .

When comparing the GGX and Beckmann distributions in Figure 9.36, it is apparent that the two have fundamentally different shapes. GGX has narrower peaks than Beckmann, as well as longer “tails” surrounding those peaks. In the rendered images at the bottom of the figure, we can see that GGX’s longer tails create the appearance of a haze or glow around the core of the highlight.

Many real-world materials show similar hazy highlights, with tails that are typically longer even than those of the GGX distribution [214]. See Figure 9.37. This realization has been a strong contributor to the growing popularity of the GGX distribution, as well as the continuing search for new distributions that would fit measured materials even more accurately.

image

Figure 9.37. NDFs fit to measured chrome from the MERL database. On the left, we have plots of the specular peak against θmθm for chrome (black), GGX (red; αg=0.006αg=0.006 ), Beckmann (green; αb=0.013αb=0.013 ), and Blinn-Phong (blue dashes; n=12000n=12000 ). Rendered highlights are shown on the right for chrome, GGX, and Beckmann. (Figure courtesy of Brent Burley [214].)

Burley [214] proposed the generalized Trowbridge-Reitz (GTR) NDF with a goal of allowing for more control over the NDF’s shape, specifically the tails of the distribution:

(9.46)

D(m)=k(α,γ)π(1+(n·m)2(α2g-1))γ.
D(m)=k(α,γ)π(1+(nm)2(α2g1))γ.

The γγ argument controls the tail shape. When γ=2γ=2 , GTR is the same as GGX. As the value of γγ decreases, tails of the distribution become longer, and as it increases, they become shorter. At high values of γγ , the GTR distribution resembles Beckmann. The k(α,γ)k(α,γ) term is the normalization factor, which we give in a separate equation, since it is more complicated than those of other NDFs:

(9.47)

k(α,γ)={(γ-1)(α2-1)(1-(α2)(1-γ)),whereγ1andα1,[6pt](α2-1)ln(α2),whereγ=1andα1,1,whereα=1.
k(α,γ)=(γ1)(α21)(1(α2)(1γ)),[6pt](α21)ln(α2),1,whereγ1andα1,whereγ=1andα1,whereα=1.

The GTR distribution is not shape-invariant, which complicates finding its Smith G2G2 masking-shadowing function. It took three years after publication of the NDF for a solution for G2G2 to be published [355]. This G2G2 solution is quite complex, with a table of analytical solutions for certain values of γγ (for intermediate values, interpolation must be used). Another issue with GTR is that the parameters αα and γγ affect the perceived roughness and “glow” in a non-intuitive manner.

Student’s t-distribution (STD) [1491] and exponential power distribution (EPD) [763] NDFs include shape control parameters. In contrast to GTR, these functions are shape-invariant with respect to their roughness parameters. At the time of writing, these are newly published, so it is not clear whether they will find use inapplications.

Instead of increasing the complexity of the NDF, an alternative solution to better matching measured materials is to use multiple specular lobes. This idea was suggested by Cook and Torrance [285,286]. It was experimentally tested by Ngan [1271], who found that for many materials adding a second lobe did improve the fit significantly. Pixar’s PxrSurface material [732] has a “roughspecular” lobe that is intended to be used (in conjunction with the main specular lobe) for this purpose. The additional lobe is a full specular microfacet BRDF with all the associated parameters and terms. Imageworks employs a more surgical approach [947], using a mix of two GGX NDFs that are exposed to the user as an extended NDF, rather than an entire separate specular BRDF term. In this case, the only additional parameters needed are a second roughness value and a blend amount.

Anisotropic Normal Distribution Functions

While most materials have isotropic surface statistics, some have significant anisotropy in their microstructure that noticeably affects their appearance, e.g., Figure 9.26 on page 329. To accurately render such materials, we need BRDFs, especially NDFs that are anisotropic as well.

Unlike isotropic NDFs, anisotropic NDFs cannot be evaluated with just the angle θmθm . Additional orientation information is needed. In the general case, the microfacet normal mm needs to be transformed into the local frame or tangent space defined by the normal, tangent, and bitangent vectors, respectively, nn , tt , and bb . See Figure on page 210. In practice, this transformation is typically expressed as three separate dot products: m·nmn , m·tmt , and m·bmb .

When combining normal mapping with anisotropic BRDFs, it is important to make sure that the normal map perturbs the tangent and bitangent vectors as well as the normal. This procedure is often done by applying the modified Gram-Schmidt process to the perturbed normal nn and the interpolated vertex tangent and bitangent vectors t0t0 and b0b0 (the below assumes that nn is already normalized):

(9.48)

t=t0-(t0·n)nt=t||t||,b=b0-(b0·n)n,b=b-(b·t)t}b=b||b||.
t=t0(t0n)nbb′′=b0(b0n)n,=b(bt)tt=t||t||,b=b′′||b′′||.

Alternatively, after the first line the orthogonal bb vector could be created by taking the cross product of nn and tt .

For effects such as brushed metal or curly hair, per-pixel modification of the tangent direction is needed, typically provided by a tangent map. This map is a texture that stores the per-pixel tangent, similar to how a normal map stores per-pixel normals. Tangent maps most often store the two-dimensional projection of the tangent vector onto the plane perpendicular to the normal. This representation works well with texture filtering and can be compressed similar to normal maps. Some applications store a scalar rotation amount instead, which is used to rotate the tangent vector around nn . Though this representation is more compact, it is prone to texture filtering artifacts where the rotation angle wraps around from 360360 to 00 .

A common approach to creating an anisotropic NDF is to generalize an existing isotropic NDF. The general approach used can be applied to any shape-invariant isotropic NDF [708], which is another reason why shape-invariant NDFs are preferable. Recall that isotropic shape-invariant NDFs can be written in the following form:

(9.49)

D(m)=χ+(n·m)α2(n·m)4g(1-(n·m)2α(n·m)),
D(m)=χ+(nm)α2(nm)4g(1(nm)2α(nm)),

with g representing a one-dimensional function that expresses the shape of the NDF. The anisotropic version is

(9.50)

D(m)=χ+(n·m)αxαy(n·m)4g((t·m)2α2x+(b·m)2α2y(n·m)).
D(m)=χ+(nm)αxαy(nm)4g(tm)2α2x+(bm)2α2y(nm).

The parameters αxαx and αyαy represent the roughness along the direction of tt and bb , respectively. If αx=αyαx=αy , Equation 9.50 reduces back to the isotropic form.

The G2G2 masking-shadowing function for the anisotropic NDF is the same as the isotropic one, except that the variable a (passed into the ΛΛ function) is calculated differently:

(9.51)

a=n·sα2x(t·s)2+α2y(b·s)2,
a=nsα2x(ts)2+α2y(bs)2,

where (as in Equation 9.37) ss represents either vv or ll .

Using this method, anisotropic versions have been derived for the Beckmann NDF,

(9.52)

D(m)=χ+(n·m)παxαy(n·m)4exp(-(t·m)2α2x+(b·m)2α2y(n·m)2),
D(m)=χ+(nm)παxαy(nm)4exp(tm)2α2x+(bm)2α2y(nm)2,

and the GGX NDF,

(9.53)

D(m)=χ+(n·m)παxαy((t·m)2α2x+(b·m)2α2y+(n·m)2)2.
D(m)=χ+(nm)παxαy((tm)2α2x+(bm)2α2y+(nm)2)2.

Both are shown in Figure 9.38.

image

Figure 9.38. Spheres rendered with anisotropic NDFs: Beckmann in the top row and GGX in the bottom row. In both rows αyαy is held constant and αxαx is increased from left to right.

While the most straightforward way to parameterize anisotropic NDFs is to use the isotropic roughness parameterization twice, once for αxαx and once for αyαy , other parameterizations are sometimes used. In the Disney principled shading model [214], the isotropic roughness parameter r is combined with a second scalar parameter kanisokaniso with a range of [0, 1]. The αxαx and αyαy values are computed from these parameters thusly:

(9.54)

kaspect=1-0.9kaniso,[3pt]αx=r2kaspect,[3pt]αy=r2kaspect.
kaspect[3pt]αx[3pt]αy=10.9kaniso,=r2kaspect,=r2kaspect.

The 0.9 factor limits the aspect ratio to 10 : 1.

Imageworks [947] use a different parameterization that allows for an arbitrary degree of anisotropy:

(9.55)

αx=r2(1+kaniso),αy=r2(1-kaniso).
αxαy=r2(1+kaniso),=r2(1kaniso).

9.8.2. Multiple-Bounce Surface Reflection

As mentioned earlier in Section 9.7, the microfacet BRDF framework does not account for light that is reflected (“bounced”) from the microsurface multiple times. This simplification causes some energy loss and over-darkening, especially for rough metals [712].

A technique used by Imageworks [947] combines elements from previous work [811,878] to create a term that can be added to the BRDF to simulate multiple-bounce surface reflection:

(9.56)

fms(l,v)=ˉF¯RsF1π(1-¯RsF1)(1-ˉF(1-¯RsF1))(1-RsF1(l))(1-RsF1(v)),
fms(l,v)=F¯¯¯RsF1¯¯¯¯¯¯¯¯π(1RsF1¯¯¯¯¯¯¯¯)(1F¯¯¯(1RsF1¯¯¯¯¯¯¯¯))(1RsF1(l))(1RsF1(v)),

where RsF1RsF1 is the directional albedo (Section 9.3) of fsF1fsF1 , which is the specular BRDF term with F0F0 set to 1. The function RsF1RsF1 depends on the roughness αα and elevation angle θθ . It is relatively smooth, so it can be precomputed numerically (using Equation 9.8 or 9.9) and stored in a small two-dimensional texture. Imageworks found that 32×3232×32 resolution is sufficient.

The function ¯RsF1RsF1¯¯¯¯¯¯¯¯ is the cosine-weighted average value of RsF1RsF1 over the hemisphere. It depends only on αα , so it can be stored in a one-dimensional texture, or an inexpensive curve could be fitted to the data. Since RsF1RsF1 is rotationally symmetric about nn , ¯RsF1RsF1¯¯¯¯¯¯¯¯ can be computed with a one-dimensional integral. We also use the change of variables μ=cosθμ=cosθ (see Equation 9.6 on page 312):

(9.57)

¯RsF1=sΩRsF1(s)(n·s)dssΩ(n·s)ds=1π2πϕ=01μ=0RsF1(μ)μdμdϕ=21μ=0RsF1(μ)μdμ.
RsF1¯¯¯¯¯¯¯¯=sΩRsF1(s)(ns)dssΩ(ns)ds=1π2πϕ=01μ=0RsF1(μ)μdμdϕ=21μ=0RsF1(μ)μdμ.

Finally, ˉFF¯¯¯ is the cosine-weighted average of the Fresnel term, computed in the same way:

(9.58)

ˉF=21μ=0F(μ)μdμ.
F¯¯¯=21μ=0F(μ)μdμ.

Imageworks provide a closed-form solution to Equation 9.58 in the case that the generalized Schlick form (Equation 9.18) is used for F:

(9.59)

ˉF=2p2F90+(3p+1)F02p2+3p+1.
F¯¯¯=2p2F90+(3p+1)F02p2+3p+1.

If the original Schlick approximation is used (Equation 9.16), then the solution simplifies to

(9.60)

ˉF=2021F0+121.
F¯¯¯=2021F0+121.

In the case of anisotropy, Imageworks use an intermediate roughness between αxαx and αyαy for the purpose of computing fmsfms . This approximation avoids the need to increase the dimensionality of the RsF1RsF1 lookup table, and the errors it introduces are small.

The results of the Imageworks multiple-bounce specular term can be seen in Figure 9.39.

image

Figure 9.39. In all rows the roughness of the surface increases from left to right. The top two rows show a gold material. The first row is rendered without the Imageworks multiple-bounce term, and the second is rendered with the multiple-bounce term. The difference is most noticeable for the rougher spheres. The next two rows show a black dielectric material. The third row is rendered without the multiple-bounce term, and the fourth row has the multiple-bounce term applied. Here the difference is more subtle, since the specular reflectance is much lower. (Figure courtesy of Christopher Kulla [947].)

9.9 BRDF Models for Subsurface Scattering

In the previous section we discussed surface, or specular, reflection. In this section we will discuss the other side of the issue, namely what happens to light refracted under the surface. As we discussed in Section 9.1.4, this light undergoes some combination of scattering and absorption, and part of it is re-emitted back out of the original surface. We will focus here on BRDF models for local subsurface scattering, or diffuse surface response, in opaque dielectrics. Metals are irrelevant, since they do not have any significant subsurface light interaction. Dielectric materials that are transparent or exhibit global subsurface scattering will be covered in Chapter 14.

We start our discussion of diffuse models with a section on the property of diffuse color and the possible values this color can have in real-world materials. In the following subsection we explain the effect of surface roughness on diffuse shading, and the criteria for choosing whether to use a smooth-surface or rough-surface shading model for a given material. The last two subsections are devoted to the smooth-surface and rough-surface models themselves.

9.9.1. Subsurface Albedo

The subsurface albedo ρssρss of an opaque dielectric is the ratio between the energy of the light that escapes a surface compared to the energy of the light entering into the interior of the material. The value of ρssρss is between 0 (all light is absorbed) and 1 (no light is absorbed) and can depend on wavelength, so ρssρss is modeled as an RGB vector for rendering. For authoring, ρssρss is often referred to as the diffuse color of the surface, just as the normal-incidence Fresnel reflectance F0F0 is typically referred to as the specular color. The subsurface albedo is closely related to the scattering albedo discussed in Section 14.1.

Since dielectrics transmit most incoming light rather than reflecting it at the surface, the subsurface albedo ρssρss is usually brighter and thus more visually important than the specular color F0F0 . Since it results from a different physical process than the specular color—absorption in the interior instead of Fresnel reflectance at the surface— ρssρss typically has a different spectral distribution (and thus RGB color) than F0F0 . For example, colored plastic is composed of a clear, transparent substrate with pigment particles embedded in its interior. Light reflecting specularly will be uncolored, while light reflecting diffusely will be colored from absorption by the pigment particles; for example, a red plastic ball has a white highlight.

Subsurface albedo can be thought of as the result of a “race” between absorption and scattering—will the light be absorbed before it has had a chance to be scattered back out of the object? This is why foam on a liquid is much brighter than the liquid itself. The process of frothing does not change the absorptivity of the liquid, but the addition of numerous air-liquid interfaces greatly increases the amount of scattering. This causes most of the incoming light to be scattered before it has been absorbed, resulting in a high subsurface albedo and bright appearance. Fresh snow is another example of a substance with a high albedo. There is considerable scattering in the interfaces between snow granules and air, but little absorption, leading to a subsurface albedo of 0.8 or more across the visible spectrum. White paint is slightly less, about 0.7. Many substances encountered in daily life, such as concrete, stone, and soil, average between 0.15 and 0.4. Coal is an example of a material with extremely low subsurface albedo, close to 0.0.

The process by which many materials become darker when wet is the inverse of the liquid froth example. If the material is porous, water penetrates into spaces formerly filled with air. Dielectric materials have an index of refraction that is much closer to water than to air. This decrease in the relative index of refraction decreases the scattering inside the material, and light travels longer distances (on average) before escaping the material. This change causes more light to be absorbed and the subsurface albedo becomes darker [821].

It is a common misconception (even reflected in well-regarded material authoring guidelines [1163]) that values of ρssρss should never go below a lower limit of about 0.015–0.03 (30–50 in 8-bit nonlinear sRGB encoding) for realistic material authoring. However, this lower limit is based on color measurements that include surface (specular) as well as subsurface (diffuse) reflectance, and is thus too high. Actual materials can have lower values. For example, the Federal specification for the “OSHA Black” paint standard [524] has a Y value of 0.35 (out of 100). Given the measurement conditions and surface gloss, this Y corresponds to a ρssρss value of about 0.0035 (11 in 8-bit nonlinear sRGB encoding).

When acquiring spot values or textures for ρssρss from real-world surfaces, it is important to separate out the specular reflectance. This extraction can be done via careful use of controlled lighting and polarization filters [251,952]. For accurate color, calibration should be performed as well [1153].

Not every RGB triple represents a plausible (or even physically possible) value for ρssρss . Reflectance spectra are more restricted than emissive spectral power distributions: They can never exceed a value of 1 for any wavelength, and they are typically quite smooth. These limitations define a volume in color space that contains all plausible RGB values for ρssρss . Even the relatively small sRGB color gamut contains colors outside this volume, so care must be taken when setting values for ρssρss to avoid specifying unnaturally saturated and bright colors. Besides reducing realism, such colors can cause over-bright secondary reflections when precomputing global illumination (Section ). The 2015 paper by Meng et al. [1199] is a good reference for this topic.

9.9.2. Scale of Subsurface Scattering and Roughness

Some BRDF models for local subsurface scattering take account of surface roughness—typically by using microfacet theory with a diffuse micro-BRDF fμfμ —and some do not. The deciding factor for which type of model to use is not simply how rough the surface is, though this is a common misconception. The correct deciding factor relates to the relative size of the surface irregularities and the subsurface scattering distances.

image

Figure 9.40. Three surfaces with similar NDFs but different relationships between the scale of the microgeometry and the subsurface scattering distances. On the top left, the subsurface scattering distances are smaller than the surface irregularities. On the top right, scattering distances are larger than the surface irregularities. The bottom figure shows a microsurface with roughness at multiple scales. The dashed red line represents the effective surface that only contains microstructure larger than the subsurface scattering distances.

See Figure 9.40. If the microgeometry irregularities are larger than the subsurface scattering distances (top left of figure), then the subsurface scattering will exhibit microgeometry-related effects such as retroreflection (Figure 9.29 on page 331). For such surfaces a rough-surface diffuse model should be used. As mentioned above, such models are typically based on microfacet theory, with the subsurface scattering treated as local to each microfacet, thus only affecting the micro-BRDF fμfμ .

If the scattering distances are all larger than the irregularities (top right of Figure 9.40), then the surface should be considered flat for the purpose of modeling subsurface scattering, and effects such as retroreflection will not occur. Subsurface scattering is not local to a microfacet, and cannot be modeled via microfacet theory. In this case, a smooth-surface diffuse model should be used.

In the intermediate case where the surface has roughness at scales both larger and smaller than the scattering distances, then a rough-surface diffuse model should be used, but with an effective surface that includes only irregularities larger than the scattering distances. Both diffuse and specular reflectance can be modeled with microfacet theory, but each with a different roughness value. The specular term will use a value based on the roughness of the actual surface, and the diffuse term will use a lower value, based on the roughness of the effective surface.

The scale of observation also ties into this, since it determines the definition of “microgeometry.” For example, the moon is often cited as a case where rough-surface diffuse models should be used, since it exhibits significant retroreflection. When we look at the moon from the earth, the scale of observation is such that even a five-foot boulder is “microgeometry.” Thus it is not surprising that we observe rough-surface diffuse effects such as retroreflection.

9.9.3. Smooth-Surface Subsurface Models

Here we will discuss smooth-surface subsurface models. These are appropriate for modeling materials where the surface irregularities are smaller than the subsurface scattering distances. Diffuse shading is not directly affected by surface roughness in such materials. If the diffuse and specular terms are coupled, which is the case for some of the models in this section, then surface roughness may affect diffuse shading indirectly.

As mentioned in Section 9.3, real-time rendering applications often model local subsurface scattering with a Lambertian term. In this case the BRDF diffuse term is ρssρss over ππ :

(9.61)

fdiff(l,v)=ρssπ.
fdiff(l,v)=ρssπ.

The Lambertian model does not account for the fact that light reflected at the surface is not available for subsurface scattering. To improve this model, there should be an energy trade-off between the surface (specular) and subsurface (diffuse) reflectance terms. The Fresnel effect implies that this surface-subsurface energy trade-off changes with incident light angle θiθi . With increasingly glancing incidence angles, the diffuse reflectance decreases as the specular reflectance increases. A basic way to account for this balance is to multiply the diffuse term by one minus the Fresnel part of the specular term [1626]. If the specular term is that of a flat mirror, the resulting diffuse term is

(9.62)

fdiff(l,v)=(1-F(n,l))ρssπ.
fdiff(l,v)=(1F(n,l))ρssπ.

If the specular term is a microfacet BRDF term, then the resulting diffuse term is

(9.63)

fdiff(l,v)=(1-F(h,l))ρssπ.
fdiff(l,v)=(1F(h,l))ρssπ.

Equations 9.62 and 9.63 result in a uniform distribution of outgoing light, because the BRDF value does not depend on the outgoing direction vv . This behavior makes some sense, since light will typically undergo multiple scattering events before it is re-emitted, so its outgoing direction will be randomized. However, there are two reasons to suspect that the outgoing light is not distributed perfectly uniformly. First, since the diffuse BRDF term in Equation 9.62 varies by incoming direction, Helmholtz reciprocity implies that it must change by outgoing direction as well. Second, the light must undergo refraction on the way out, which will impose some directional preference on the outgoing light.

Shirley et al. proposed a coupled diffuse term for flat surfaces that addresses the Fresnel effect and the surface-subsurface reflectance trade-off, while supporting both energy conservation and Helmholtz reciprocity [1627]. The derivation assumes that the Schlick approximation [1568] (Equation 9.16) is used for Fresnel reflectance:

(9.64)

fdiff(l,v)=2120π(1-F0)ρss(1-(1-(n·l)+)5)(1-(1-(n·v)+)5).
fdiff(l,v)=2120π(1F0)ρss(1(1(nl)+)5)(1(1(nv)+)5).

Equation 9.64 applies only to surfaces where the specular reflectance is that of a perfect Fresnel mirror. A generalized version that can be used to compute a reciprocal, energy-conserving diffuse term to couple with any specular term was proposed by Ashikhmin and Shirley [77] and further refined by Kelemen and Szirmay-Kalos [878]:

(9.65)

fdiff(l,v)=ρss(1-Rspec(l))(1-Rspec(v))π(1-¯Rspec).
fdiff(l,v)=ρss(1Rspec(l))(1Rspec(v))π(1Rspec¯¯¯¯¯¯¯¯¯¯¯).

Here, RspecRspec is the directional albedo (Section 9.3) of the specular term, and ¯RspecRspec¯¯¯¯¯¯¯¯¯¯ is its cosine-weighted average over the hemisphere. The value RspecRspec can be precomputed using Equation 9.8 or 9.9 and stored in a lookup table. The average ¯Rspec is computed the same way as a similar average we encountered earlier: ¯RsF1 (Equation 9.57).

The form in Equation 9.65 has some clear similarities to Equation 9.56, which is not surprising, since the Imageworks multiple-bounce specular term is derived from the Kelemen-Szirmay-Kalos coupled diffuse term. However, there is one important difference. Here, instead of RsF1 we use Rspec , the directional albedo of the full specular BRDF term including Fresnel, and with the multiple-bounce specular term fms as well, if one is used. This difference increases the dimensionality of the lookup table for Rspec since it depends not only on the roughness α and elevation angle θ , but on the Fresnel reflectance as well.

In Imageworks’ implementation of the Kelemen-Szirmay-Kalos coupled diffuse term, they use a three-dimensional lookup table, with the index of refraction as the third axis [947]. They found that the inclusion of the multiple-bounce term in the integral made Rspec smoother than RsF1 , so a 16×16×16 table was sufficient. Figure 9.41 shows the result.

image

Figure 9.41. The first and third rows show a specular term added to a Lambertian term. The second and fourth rows show the same specular term used with a Kelemen-Szirmay-Kalos coupled diffuse term. The top two rows have lower roughness values than the bottom two. Within each row, roughness increases from left to right. (Figure courtesy of Christopher Kulla [947].)

If the BRDF uses the Schlick Fresnel approximation and does not include a multiple-bounce specular term, then the value of F0 can be factored out of the integral. Doing so allows us to use a two-dimensional table for Rspec , storing two quantities in each entry, instead of a three-dimensional table, as discussed by Karis [861]. Alternatively, Lazarov [999] presents an analytic function that is fitted to Rspec , similarly factoring F0 out of the integral to simplify the fitted function.

Both Karis and Lazarov use the specular directional albedo Rspec for a different purpose, related to image-based lighting. More details on that technique can be found in Section 10.5.2. If both techniques are implemented in the same application, then the same table lookups can be used for both, increasing efficiency.

These models were developed by considering the implications of energy conservation between the surface (specular) and subsurface (diffuse) terms. Other models have been developed from physical principles. Many of these models rely on the work of Subrahmanyan Chandrasekhar (1910–1995), who developed a BRDF model for a semi-infinite, isotropically scattering volume. As demonstrated by Kulla and Conty [947], if the mean free path is sufficiently short, this BRDF model is a perfect match for a scattering volume of arbitrary shape. The Chandrasekhar BRDF can be found in his book [253], though a more accessible form using familiar rendering notation can be found in Equations 30 and 31 of a paper by Dupuy et al. [397].

Since it does not include refraction, the Chandrasekhar BRDF can be used to model only index-matched surfaces. These are surfaces where the index of refraction is the same on both sides, as in Figure 9.11 on page 304. To model non-index-matched surfaces, the BRDF must be modified to account for refraction where the light enters and exits the surface. This modification is the focus of work by Hanrahan and Krueger [662] and Wolff [1898].

9.9.4. Rough-Surface Subsurface Models

As part of the Disney principled shading model, Burley [214] included a diffuse BRDF term designed to include roughness effects and match measured materials:

(9.66)

fdiff(l,v)=χ+(n·l)χ+(n·v)ρssπ((1-kss)fd+1.25kssfss),

where

(9.67)

fd=(1+(FD90-1)(1-n·l)5)(1+(FD90-1)(1-n·v)5),FD90=0.5+2α(h·l)2,fss=(1(n·l)(n·v)-0.5)FSS+0.5,FSS=(1+(FSS90-1)(1-n·l)5)(1+(FSS90-1)(1-n·v)5),FSS90=α(h·l)2,

and α is the specular roughness. In the case of anisotropy, an intermediate value between αx and αy is used. This equation is often referred to as the Disney diffuse model.

The subsurface term fss is inspired by the Hanrahan-Krueger BRDF [662] and intended as an inexpensive replacement for global subsurface scattering on distant objects. The diffuse model blends between fss and the fd rough diffuse term based on the user-controlled parameter kss .

The Disney diffuse model has been used for films [214], as well as games [960] (though without the subsurface term). The full Disney diffuse BRDF also includes a sheen term, which is intended primarily for modeling fabrics, but also helps compensate for the energy lost due to the lack of a multiple-bounce specular term. The Disney sheen term will be discussed in Section 9.10. Several years later, Burley presented [215] an updated model designed to integrate with global subsurface scattering rendering techniques.

Since the Disney diffuse model uses the same roughness as the specular BRDF term, it may have difficulties modeling certain materials. See Figure 9.40. However, it would be a trivial modification to use a separate diffuse roughness value.

Most other rough-surface diffuse BRDFs have been developed using microfacet theory, with various different choices for the NDF D, micro-BRDF fμ , and masking-shadowing function G2 . The most well-known of these models was proposed by Oren and Nayar [1337]. The Oren-Nayar BRDF uses a Lambertian micro-BRDF, a spherical Gaussian NDF, and the Torrance-Sparrow “V-cavity” masking-shadowing function. The full form of the BRDF models one secondary bounce. Oren and Nayar also included a simplified “qualitative” model in their paper. Several improvements to the Oren-Nayar model have been proposed over the years, including optimizations [573], tweaks to make the “qualitative” model more closely resemble the full model without increasing its cost [504], and changing the micro-BRDF to a more accurate smooth-surface diffuse model [574,1899].

The Oren-Nayar model assumes a microsurface with quite different normal distribution and masking-shadowing functions than those used in current specular models. Two diffuse microfacet models were derived using the isotropic GGX NDF and height-correlated Smith masking-shadowing function. The first model, by Gotanda [574], is the result of numerically integrating the general microfacet equation (Equation 9.26), using as the micro-BRDF the specular coupled diffuse term in Equation 9.64. An analytic function was then fitted to the numerically integrated data. Gotanda’s BRDF does not account for interreflections between facets, and the fitted function is relatively complex.

Using the same NDF, masking-shadowing function, and micro-BRDF as Gotanda, Hammon [657] simulates the BRDF numerically, including interreflections. He shows that interreflections are important for this microfacet configuration, representing as much as half of the total reflectance for rougher surfaces. However, the second bounce contains almost all of the missing energy, so Hammon uses data from a two-bounce simulation. Also, likely because the addition of interreflections smoothed out the data, Hammon was able to fit a fairly simple function to the simulation results:

(9.68)

fdiff(l,v)=χ+(n·l)χ+(n·v)ρssπ((1-αg)fsmooth+αgfrough+ρssfmulti),

where

(9.69)

fsmooth=2120(1-F0)(1-(1-n·l)5)(1-(1-n·v)5),frough=kfacing(0.9-0.4kfacing)(0.5+n·hn·h),kfacing=0.5+0.5(l·v),fmulti=0.3641αg,

and αg is the GGX specular roughness. For clarity, the terms here have been factored slightly differently than in Hammon’s presentation. Note that fsmooth is the coupled diffuse BRDF from Equation 9.64 without the ρss/π factor, since this is multiplied in Equation 9.68. Hammon discusses “hybrid” BRDFs that substitute other smooth-surface diffuse BRDFs for fsmooth , to increase performance or improve compatibility with assets authored under older models.

Overall, Hammon’s diffuse BRDF is inexpensive and is based on sound theoretical principles, although he did not show comparisons with measured data. One caveat is that the assumption that surface irregularities are larger than scattering distances is fundamental to the derivation of the BRDF, which may limit the types of materials it can accurately model. See Figure 9.40.

The simple Lambertian term shown in Equation 9.61 is still implemented by many real-time rendering applications. Besides the Lambertian term’s low computational cost, it is easier to use with indirect and baked lighting than other diffuse models, and the visual differences between it and more sophisticated models are often subtle [251,861]. Nevertheless, the continuing quest for photorealism is driving an increase in the use of more accurate models.

9.10 BRDF Models for Cloth

Cloth tends to have microgeometry that is different from other types of materials. Depending on the fabric type, it may have highly repetitive woven microstructures, cylinders (threads) protruding vertically from the surface, or both. As a result, cloth surfaces have characteristic appearances that typically require specialized shading models, such as anisotropic specular highlights, asperity scattering [919] (bright edge effects caused by light scattering through protruding, translucent fibers), and even color shifts with view direction (caused by threads of different colors running through the fabric).

image

Figure 9.42. A material using the cloth system built for the game Uncharted 4

Aside from the BRDF, most fabrics have high-frequency spatial variation that is also key to creating a convincing cloth appearance [825]. See Figure 9.42.

Cloth BRDF models fall into three main categories: empirical models created from observation, models based on microfacet theory, and micro-cylinder models. We will go over some notable examples from each category.

9.10.1. Empirical Cloth Models

In the game Uncharted 2 [631], cloth surfaces use the following diffuse BRDF term:

(9.70)

fdiff(l,v)=ρssπ(krim((v·n)+)αrim+kinner(1-(v·n)+)αinner+kdiff),

where krim , kinner , and kdiff are user-controlled scaling factors for a rim lighting term, a term to brighten forward-facing (inner) surfaces, and a Lambertian term, respectively. Also, αrim and αinner control the falloff of the rim and inner terms. This behavior is non-physical, since there are several view-dependent effects but none that depend on the light direction.

In contrast, the cloth in Uncharted 4 [825] uses either a microfacet or micro-cylinder model, depending on cloth type (as detailed in the following two sections) for the specular term and a “wrap lighting” empirical subsurface scattering approximation for the diffuse term:

(9.71)

fdiff(l,v)(n·l)+ρssπ(cscatter+(n·l)+)+(n·l+w)+1+w.

Here we use the (x)+ notation introduced in Section 1.2, which indicates a clamp between 0 and 1. The odd notation fdiff(l,v)(n·l)+ indicates that this model affects the lighting as well as the BRDF. The term on the right side of the arrow replaces the term on the left side. The user-specified parameter cscatter is a scattering color, and the value w, with range [0, 1], controls the wrap lighting width.

For modeling cloth, Disney use their diffuse BRDF term [214] (Section 9.9.4) with a sheen term added to model asperity scattering:

(9.72)

fsheen(l,v)=ksheencsheen(1-(h·l)+)5,

where ksheen is a user parameter that modulates the strength of the sheen term. The sheen color csheen is a blend (controlled by another user parameter) between white and the luminance-normalized value of ρss . In other words, ρss is divided by its luminance to isolate its hue and saturation.

9.10.2. Microfacet Cloth Models

Ashikhmin et al. [78] proposed using an inverted Gaussian NDF to model velvet. This NDF was slightly modified in subsequent work [81], which also proposed a variant form of the microfacet BRDF for modeling materials in general, with no masking-shadowing term and a modified denominator.

The cloth BRDF used in the game The Order: 1886 [1266] combines the modified microfacet BRDF and a generalized form of the velvet NDF from Ashikhmin and Premože’s later report [81] with the diffuse term from Equation 9.63. The generalized velvet NDF is

(9.73)

D(m)=χ+(n·m)π(1+kampα2)(1+kampexp((n·m)2α2((n·m)2-1))(1-(n·m)2)2),

where α controls the width of the inverted Gaussian and kamp controls its amplitude. The full cloth BRDF is

(9.74)

f(l,v)=(1-F(h,l))ρssπ+F(h,l)D(h)4(n·l+n·v-(n·l)(n·v)).

A variation of this BRDF was used in the game Uncharted 4 [825] for rough fabrics such as wool and cotton.

Imageworks [947] use a different inverted NDF for a sheen term that can be added to any BRDF:

(9.75)

D(m)=χ+(n·m)(2+1α)(1-(n·m)2)12α2π.

Although there is no closed-form solution to the Smith masking-shadowing function for this NDF, Imageworks were able to approximate the numerical solution with an analytical function. Details on the masking-shadowing function and on energy conservation between the sheen term and the rest of the BRDF are discussed by Estevez and Kulla [442]. See Figure 9.43 for some examples rendered using the Imageworks sheen term.

image

Figure 9.43. The Imageworks sheen specular term added to a red diffuse term. From left to right, the sheen roughness values are α = 0.15, 0.25, 0.40, 0.65, and 1.0. (Figure courtesy of Alex Conty [442].)

Each of the cloth models we have seen so far are limited to specific types of fabric. The models discussed in the next section attempt to model cloth in a more general way.

9.10.3. Micro-Cylinder Cloth Models

The micro-cylinder models used for cloth are quite similar to those used for hair, so the discussion of hair models in Section can provide additional context. The idea behind these models is that the surface is assumed to be covered with one-dimensional lines. Kajiya and Kay developed a simple BRDF model for this case [847], which was given a solid theoretical foundation by Banks [98]. It is alternately known as the Kajiya-Kay BRDF or the Banks BRDF. The concept is based on the observation that a surface composed of one-dimensional lines has an infinite number of normals at any given location, defined by the normal plane perpendicular to the tangent vector t at that location. Although many newer micro-cylinder models have been developed from this framework, the original Kajiya-Kay model still sees some use, due to its simplicity. For example, in the game Uncharted 4 [825], the Kajiya-Kay BRDF was used for the specular term of shiny fabrics such as silk and velvet.

Dreamworks [348,1937] use a relatively simple and artist-controllable micro-cylinder model for fabric. Textures can be used to vary the roughness, color, and thread direction, which can point out of the surface plane for modeling velvet and similar fabrics. Different parameters can be set for the warp and weft threads to model complex color-changing fabrics, such as shot silk. The model is normalized to be energy-conserving.

Sadeghi et al. [1526] proposed a micro-cylinder model based on measurements from fabric samples as well as individual threads. The model also accounts for inter-thread masking and shadowing between threads.

In some cases actual hair BSDF models (Section ) are used for cloth. RenderMan’s PxrSurface material [732] has a “fuzz” lobe that uses the R term from the hair model by Marschner et al. [1128] (Section ). One of the models implemented in a real-time cloth rendering system by Wu and Yuksel [1924,1926] is derived from a hair model used by Disney for animated films [1525].

9.11 Wave Optics BRDF Models

The models we have discussed in the last few sections rely on geometrical optics, which treats light as propagating in rays rather than waves. As discussed on page 303, geometrical optics is based on the assumption that any surface irregularities are either smaller than a wavelength or larger than about 100 wavelengths.

Real-world surfaces are not so obliging. They tend to have irregularities at all scales, including the 1–100 wavelength range. We refer to irregularities with such sizes as nanogeometry to distinguish them from the microgeometry irregularities discussed in earlier sections, which are too small to be individually rendered but larger than 100 light wavelengths. The effects of nanogeometry on reflectance cannot be modeled by geometrical optics. These effects depend on the wave nature of light and wave optics (also called physical optics) is required to model them.

Surface layers, or films, with thicknesses close to a light wavelength also produce optical phenomena related to the wave nature of light.

In this section we touch upon wave optics phenomena such as diffraction and thin-film interference, discussing their (sometimes surprising) importance in realistically rendering what otherwise can seem to be relatively mundane materials.

9.11.1. Diffraction Models

Nanogeometry causes a phenomenon called diffraction. To explain it we make use of the Huygens-Fresnel principle, which states that every point on a wavefront (the set of points that have the same wave phase) can be treated as the source of a new spherical wave. See Figure 9.44.

image

Figure 9.44. To the left, we see a planar wavefront propagating in empty space. If each point on the wavefront is treated as the source of a new spherical wave, the new waves interfere destructively in all directions except forward, resulting in a planar wavefront again. In the center, the waves encounter an obstacle. The spherical waves at the edge of the obstacle have no waves to their right that destructively interfere with them, so some waves diffract or “leak” around the edge. To the right, a planar wavefront is reflected from a flat surface. The planar wavefront encounters surface points on the left earlier than points on the right, so the spherical waves emitting from surface points on the left have had more time to propagate and are therefore larger. The different sizes of spherical wavefronts interfere constructively along the edge of the reflected planar wavefront, and destructively in other directions.

When waves encounter an obstacle, the Huygens-Fresnel principle shows that they will bend slightly around corners, which is an example of diffraction. This phenomenon cannot be predicted by geometrical optics. In the case of light incident on a planar surface, geometrical optics does correctly predict that light will be reflected in a single direction. That said, the Fresnel-Huygens principle provides additional insight. It shows that the spherical waves on the surface line up just right to create the reflected wavefront, with waves in all other directions being eliminated through destructive interference. This insight becomes important when we look at a surface with nanometer irregularities. Due to the different heights of the surface points, the spherical waves on the surface no longer line up so neatly. See Figure 9.45.

image

Figure 9.45. On the left we see planar wavefronts incident to a surface with rough nanogeometry. In the center we see the spherical waves formed on the surface according to the Fresnel-Huygens principle. On the right we see that after constructive and destructive interference has occurred, some of the resulting waves (in red) form a planar reflected wave. The remainder (in purple) are diffracted, with different amounts of light propagating in each direction, depending on wavelength.

As the figure shows, light is scattered in different directions. Some portion of it is specularly reflected, i.e., adds up to a planar wavefront in the reflection direction. The remaining light is diffracted out in a directional pattern that depends on certain properties of the nanogeometry. The division between specularly reflected and diffracted light depends on the height of the nanogeometry bumps, or, more precisely, on the variance of the height distribution. The angular spread of diffracted light around the specular reflection direction depends on the width of the nanogeometry bumps relative to the light wavelength. Somewhat counter-intuitively, wider irregularities cause a smaller spread. If the irregularities are larger than 100 light wavelengths, the angle between the diffracted light and the specularly reflected light is so small as to be negligible. Irregularities of decreasing size cause a wider spread of diffracted light, until the irregularities become smaller than a light wavelength, at which point no diffraction occurs.

Diffraction is most clearly visible in surfaces with periodic nanogeometry, since the repeating patterns reinforce the diffracted light via constructive interference, causing a colorful iridescence. This phenomena can be observed in CD and DVD optical disks and certain insects. While diffraction also occurs in non-periodic surfaces, the computer graphics community has assumed for many years that the effect is slight. For this reason, with a handful of exceptions [89,366,686,1688], the computer graphics literature has mostly ignored diffraction for many years.

However, recent analysis of measured materials by Holzschuch and Pacanowski [762] has shown that significant diffraction effects are present in many materials, and may explain the continuing difficulty of fitting these materials with current models. Follow-up work by the same authors [763] introduced a model combining microfacet and diffraction theory, via the use of the general microfacet BRDF (Equation 9.26) with a micro-BRDF that accounts for diffraction. In parallel, Toisoul and Ghosh [1772,1773] presented methods for capturing the iridescent diffraction effects resulting from periodic nanogeometry, and for rendering them in real time with point light sources as well as image-based lighting.

9.11.2. Models for Thin-Film Interference

Thin-film interference is a wave optics phenomenon that occurs when light paths reflecting from the top and bottom of a thin dielectric layer interfere with each other. See Figure 9.46.

image

Figure 9.46. Light incident to a thin film on top of a reflective substrate. Besides the primary reflection, there are multiple paths of light refracting, reflecting from the substrate, and either reflecting from the inside of the top thin film surface or refracting through it. These paths are all copies of the same wave, but with short phase delays caused by difference in path length, so they interfere coherently with each other.

The different wavelengths of light either interfere constructively or destructively, depending on the relationship between the wavelength and the path length difference. Since the path length difference changes with angle, the end result is an iridescent color shift as different wavelengths transition between constructive and destructive interference.

The reason that the film needs to be thin for this effect to occur is related to the concept of coherence length. This length is the maximum distance by which a copy of a light wave can be displaced and still interfere coherently with the original wave. This length is inversely proportional to the bandwidth of the light, which is the range of wavelengths over which its spectral power distribution (SPD) extends. Laser light, with its extremely narrow bandwidth, has an extremely long coherence length. It can be miles, depending on the type of laser. This relationship makes sense, since a simple sine wave displaced by many wavelengths will still interfere coherently with the original wave. If the laser was truly monochromatic, it would have an infinite coherence length, but in practice lasers have a nonzero bandwidth. Conversely, light with an extremely broad bandwidth will have a chaotic waveform. It makes sense that a copy of such a waveform needs to be displaced only a short distance before it stops interfering coherently with the original.

In theory, ideal white light, which is a mixture of all wavelengths, would have a coherence length of zero. However, for the purposes of visible-light optics, the bandwidth of the human visual system (which senses light only in the 400–700 nm range) determines the coherence length, which is about 1 micrometer. So, in most cases the answer to the question “how thick can a film get before it no longer causes visible interference?” is “about 1 micrometer.”

Similarly to diffraction, for many years thin-film interference was thought of as a special case effect that occurs only in surfaces such as soap bubbles and oil stains. However, Akin [27] points out that thin-film interference does lend a subtle coloration to many everyday surfaces, and shows how modeling this effect can increase realism. See Figure 9.47. His article caused the level of interest in physically based thin-film interference to increase considerably, with various shading models including RenderMan’s PxrSurface [732] and the Imageworks shading model [947] incorporating support for this effect.

image

Figure 9.47. A leather material rendered without (on the left) and with (on the right) thin-film interference. The specular coloration caused by thin-film interference increases the realism of the image. (Image by Atilla Akin, Next Limit Technologies [27].)

Thin-film interference techniques suitable for real-time rendering have existed for some time. Smits and Meyer [1667] proposed an efficient method to account for thin-film interference between the first- and second-order light paths. They observe that the resulting color is primarily a function of the path length difference, which can be efficiently computed from the film thickness, viewing angle, and index of refraction. Their implementation requires a one-dimensional lookup table with RGB colors. The contents of the table can be computed using dense spectral sampling and converted to RGB colors as a preprocess, which makes the technique quite fast. In the game Call of Duty: Infinite Warfare a different fast thin-film approximation is used as part of a layered material system [386]. These techniques do not model multiple bounces of light in the thin film, as well as other physical phenomena. A more accurate and computationally expensive technique, yet still targeted at real-time implementation, is presented by Belcour and Barla [129].

9.12 Layered Materials

In real life, materials are often layered on top of one another. A surface may be covered with dust, water, ice, or snow; it may be painted with lacquer or some other coating for decorative or protective reasons; or it may have multiple layers as part of its basic construction, such as many biological materials.

One of the simplest and most visually significant cases of layering is a clear coat, which is a smooth transparent layer over a substrate of some different material. An example is a smooth coat of varnish over a rough wood surface. The Disney principled shading model [214] includes a clear-coat term, as do the Unreal Engine [1802], RenderMan’s PxrSurface material [732], and the shading models used by Dreamworks Animation [1937] and Imageworks [947], among others.

The most notable visual result of a clear-coat layer is the double reflection resulting from light reflecting off both the clear-coat and the underlying substrate. This second reflection is most notable when the substrate is a metal, since then the difference between the indices of refraction of the dielectric clear coat and the substrate is largest. When the substrate is a dielectric, its index of refraction is close to that of the clear coat, causing the second reflection to be relatively weak. This effect is similar to underwater materials, shown in Table 9.4 on page 325.

The clear-coat layer can also be tinted. From a physical point of view, this tinting is the result of absorption. The amount of absorbed light depends on the length of the path that light travels through the clear-coat layer, according to the Beer-Lambert law (Section ). This path length depends on the angles of the view and light, as well as the index of refraction of the material. The simpler clear-coat implementations, such as those in the Disney principled model and the Unreal Engine, do not model this view-dependence. Others do, such as the implementations in PxrSurface and the Imageworks and Dreamworks shading models. The Imageworks model further allows for concatenating an arbitrary number of layers of different types.

In the general case, different layers could have different surface normals. Some examples include rivulets of water running over flat pavement, a smooth sheet of ice on top of bumpy soil, or wrinkled plastic wrap covering a cardboard box. Most layered models used by the movie industry support separate normals per layer. This practice is not common in real-time applications, though the Unreal Engine’s clear-coat implementation supports it as an optional feature.

Weidlich and Wilkie [1862,1863] propose a layered microfacet model, with the assumption that the layer thickness is small compared to the size of the microfacets. Their model supports an arbitrary number of layers, and tracks reflection and refraction events from the top layer down to the bottom and back up again. It is simple enough for real-time implementation [420,573], but does not account for multiple reflections between layers. Jakob et al. [811,812] present a comprehensive and accurate framework for simulating layered materials, including multiple reflections. Although not suitable for real-time implementation, the system is useful for ground-truth comparisons, and the ideas used may suggest future real-time techniques.

The game Call of Duty: Infinite Warfare uses a layered material system [386] that is especially notable. It allows users to composite an arbitrary number of material layers. It supports refraction, scattering, and path-length-based absorption between layers, as well as different surface normals per layer. Combined with a highly efficient implementation, this system enables real-time materials of unprecedented complexity, particularly impressive for a game running at 60 Hz. See Figure 9.48.

image

Figure 9.48. Test surface showing various features of the Call of Duty: Infinite Warfare

9.13 Blending and Filtering Materials

Material blending is the process of combining the properties, i.e., the BRDF parameters, of multiple materials. For example, to model a sheet of metal with rust spots, we could paint a mask texture to control the rust spot locations and use it to blend between the material properties (specular color F0 , diffuse color ρss , and roughness α ) of rust and metal. Each of the materials being blended can also be spatially varying, with parameters stored in textures. Blending can be done as a preprocess to create a new texture, often referred to as “baking,” or on the fly in the shader. Although the surface normal n is technically not a BRDF parameter, its spatial variation is important for appearance, so material blending typically includes normal map blending as well.

Material blending is critical to many real-time rendering applications. For example, the game The Order: 1886 has a complex material blending system [1266,1267,1410] that allows users to author arbitrarily deep stacks of materials drawn from an extensive library and controlled by various spatial masks. Most of the material blending is done as an offline preprocess, but certain compositing operations can be deferred to runtime as needed. This runtime processing is typically used for environments, to add unique variations to tiled textures. The popular material authoring tools Substance Painter and Substance Designer use a similar approach for material compositing, as does the Mari texture painting tool.

Blending texture elements on the fly provides a diverse set of effects while conserving memory. Games employ material blending for various purposes, such as:

  • Displaying dynamic damage on buildings, vehicles, and living (or undead) creatures [201,603,1488,1778,1822].
  • Enabling user customization of in-game equipment and clothing [604,1748].
  • Increasing visual variety in characters [603,1488] and environments [39,656,1038]. See Figure on page 891 for an example.

Sometimes one material is blended on top of another with less than 100% opacity, but even fully opaque blends will have pixels (or texels, if baking into textures) on mask boundaries where a partial blend needs to be performed. In either case, the strictly correct approach would be to evaluate the shading model for each material and blend the results. However, blending the BRDF parameters and then evaluating the shading once is much faster. In the case of material properties that have a linear or nearly linear relationship to the final shaded color, such as the diffuse and specular color parameters, little or no error is introduced by such interpolation. In many cases, even for parameters with a highly nonlinear relationship to the final shaded color (such as specular roughness), the errors introduced along mask boundaries are not objectionable.

Blending normal maps requires special consideration. Often good results can be achieved by treating the process as a blend between height maps from which the normal maps are derived [1086,1087]. In some cases, such as when overlaying a detail normal map on top of a base surface, other forms of blending are preferable [106].

Material filtering is a topic closely related to material blending. Material properties are typically stored in textures, which are filtered via mechanisms such as GPU bilinear filtering and mipmapping. However, these mechanisms are based on the assumption that the quantity being filtered (which is an input to the shading equation) has a linear relationship to the final color (the output of the shading equation). Linearity again holds for some quantities, but not in general. Artifacts can result from using linear mipmapping methods on normal maps, or on textures containing nonlinear BRDF parameters, such as roughness. These artifacts can manifest as specular aliasing (flickering highlights), or as unexpected changes in surface gloss or brightness with a change in the surface’s distance from the camera. Of these two, specular aliasing is much more noticeable; techniques for mitigating these artifacts are often referred to as specular antialiasing techniques. We will now discuss several of these methods.

9.13.1. Filtering Normals and Normal Distributions

The lion’s share of material filtering artifacts (primarily from specular aliasing), as well as the most frequently used solutions for them, are related to the filtering of normals and normal distribution functions. Because of its importance, we will discuss this aspect in some depth.

To understand why these artifacts occur and how to solve them, recall that the NDF is a statistical description of subpixel surface structure. When the distance between the camera and surface increases, surface structures that previously covered multiple pixels may be reduced to subpixel size, moving from the realm of bump maps into the realm of the NDF. This transition is intimately tied to the mipmap chain, which encapsulates the reduction of texture details to subpixel size.

image

Figure 9.49. On the left, the cylinder is rendered with the original normal map. In the center, a much lower-resolution normal map containing averaged and renormalized normals is used, as shown in the bottom left of Figure 9.50. On the right, the cylinder is rendered with textures at the same low resolution, but containing normal and gloss values fitted to the ideal NDF, as shown in the bottom right of Figure 9.50. The image on the right is a significantly better representation of the original appearance. This surface will also be less prone to aliasing when rendered at low resolution. (Image courtesy of Patrick Conran, ILM.)

Consider how the appearance of an object, such as the cylinder at the left in Figure 9.49, is modeled for rendering. Appearance modeling always assumes a certain scale of observation. Macroscale (large-scale) geometry is modeled as triangles, mesoscale (middle-scale) geometry is modeled as textures, and microscale geometry, smaller than a single pixel, is modeled via the BRDF.

Given the scale shown in the image, it is appropriate to model the cylinder as a smooth mesh (macroscale) and to represent the bumps with a normal map (mesoscale). A Beckmann NDF with a fixed roughness αb is chosen to model the microscale normal distribution. This combined representation models the cylinder appearance well at this scale. But, what happens when the scale of observation changes?

image

Figure 9.50. Part of the surface from Figure 9.49. The top row shows the normal distributions (the mean normal shown in red) and the implied microgeometry. The bottom row shows three ways to average the four NDFs into one, as done in mipmapping. On the left is the ground truth (averaging the normal distributions), the center shows the result of averaging the mean (normal) and variance (roughness) separately, and the right shows an NDF lobe fitted to the averaged NDF.

Study Figure 9.50. The black-framed figure at the top shows a small part of the surface, covered by four normal-map texels. Assume that we are rendering the surface at a scale such that each normal map texel is covered by one pixel on average. For each texel, the normal (which is the average, or mean, of the distribution) is shown as a red arrow, surrounded by the Beckmann NDF, shown in black. The normals and NDF implicitly specify an underlying surface structure, shown in cross section. The large hump in the middle is one of the bumps from the normal map, and the small wiggles are the microscale surface structure. Each texel in the normal map, combined with the roughness, can be seen as collecting the distribution of normals across the surface area covered by the texel.

Now assume that the camera has moved further from the object, so that one pixel covers all four of the normal map texels. The ideal representation of the surface at this resolution would exactly represent the distribution of all normals collected across the larger surface area covered by each pixel. This distribution could be found by averaging the NDFs in the four texels of the top-level mipmap. The lower left figure shows this ideal normal distribution. This result, if used for rendering, would most accurately represent the appearance of the surface at this lower resolution.

The bottom center figure shows the result of separately averaging the normals, the mean of each distribution, and the roughness, which corresponds to the width of each. The result has the correct average normal (in red), but the distribution is too narrow. This error will cause the surface to appear too smooth. Worse, since the NDF is so narrow, it will tend to cause aliasing, in the form of flickering highlights.

We cannot represent the ideal normal distribution directly with the Beckmann NDF. However, if we use a roughness map, the Beckmann roughness αb can be varied from texel to texel. Imagine that, for each ideal NDF, we find the oriented Beckmann lobe that matches it most closely, both in orientation and overall width. We store the center direction of this Beckmann lobe in the normal map, and its roughness value in the roughness map. The results are shown on the bottom right. This NDF is much closer to the ideal. The appearance of the cylinder can be represented much more faithfully with this process than with simple normal averaging, as can be seen in Figure 9.49.

For best results, filtering operations such as mipmapping should be applied to normal distributions, not normals or roughness values. Doing so implies a slightly different way to think about the relationship between the NDFs and the normals. Typically the NDF is defined in the local tangent space determined by the normal map’s per-pixel normal. However, when filtering NDFs across different normals, it is more useful to think of the combination of the normal map and roughness map as defining a skewed NDF (one that does not average to a normal pointing straight up) in the tangent space of the underlying geometrical surface.

Early attempts to solve the NDF filtering problem [91,284,658] used numerical optimization to fit one or more NDF lobes to the averaged distribution. This approach suffers from robustness and speed issues, and is not used much today. Instead, most techniques currently in use work by computing the variance of the normal distribution. Toksvig [1774] makes a clever observation that if normals are averaged and not renormalized, the length of the averaged normal correlates inversely with the width of the normal distribution. That is, the more the original normals point in different directions, the shorter the normal averaged from them. He presents a method to modify the NDF roughness parameter based on this normal length. Evaluating the BRDF with the modified roughness approximates the spreading effect of thefiltered normals.

Toksvig’s original equation was intended for use with the Blinn-Phong NDF:

(9.76)

αp=||ˉn||αp||ˉn||+αp(1-||ˉn||),

where αp is the original roughness parameter value, αp is the modified value, and ||ˉn|| is the length of the averaged normal. The equation can also be used with the Beckmann NDF by applying the equivalence αp=2α-2b-2 (from Walter et al. [1833]), since the shapes of the two NDFs are quite close. Using the method with GGX is less straightforward, since there is no clear equivalence between GGX and Blinn-Phong (or Beckmann). Using the αb equivalence for αg gives the same value at the center of the highlight, but the highlight appearance is quite different. More troubling, the variance of the GGX distribution is undefined, which puts this variance-based family of techniques on shaky theoretical ground when used with GGX. Despite these theoretical difficulties, it is fairly common to use Equation 9.76 with the GGX distribution, typically using αp=2α-2g-2 . Doing so works reasonably well in practice.

Toksvig’s method has the advantage of accounting for normal variance introduced by GPU texture filtering. It also works with the simplest normal mipmapping scheme, linear averaging without normalization. This feature is particularly useful for dynamically generated normal maps such as water ripples, for which mipmap generation must be done on the fly. The method is not as good for static normal maps, since it does not work well with prevailing methods of compressing normal maps. These compression methods rely on the normal being of unit length. Since Toksvig’s method relies on the length of the average normal varying, normal maps used with it may have to remain uncompressed. Even then, storing the shortened normals can result in precision issues.

Olano and Baker’s LEAN mapping technique [1320] is based on mapping the covariance matrix of the normal distribution. Like Toksvig’s technique, it works well with GPU texture filtering and linear mipmapping. It also supports anisotropic normal distributions. Similarly to Toksvig’s method, LEAN mapping works well with dynamically generated normals, but to avoid precision issues, it requires a large amount of storage when used with static normals. A similar technique was independently developed by Hery et al. [731,732] and used in Pixar’s animated films to render subpixel details such as metal flakes and small scratches. A simpler variant of LEAN mapping, CLEAN mapping [93], requires less storage at the cost of losing anisotropy support. LEADR mapping [395,396] extends LEAN mapping to also account for the visibility effects of displacement mapping.

The majority of normal maps used in real-time applications are static, rather than dynamically generated. For such maps, the variance mapping family of techniques is commonly used. In these techniques, when the normal map’s mipmap chain is generated, the variance that was lost through averaging is computed. Hill [739] notes that the mathematical formulations of Toksvig’s technique, LEAN mapping, and CLEAN mapping could each be used to precompute variance in this way, which removes many of the disadvantages of these techniques when used in their original forms. In some cases the precomputed variance values are stored in the mipmap chain of a separate variance texture. More often, these values are used to modify the mipmap chain of an existing roughness map. For example, this method is employed in the variance-mapping technique used in the game Call of Duty: Black Ops [998]. The modified roughness values are computed by converting the original roughness values to variance values, adding in the variance from the normal map, and converting the result back to roughness. For the game The Order: 1886, Neubelt and Pettineo [1266,1267] use a technique by Han [658] in a similar way. They convolve the normal map NDF with the NDF of their BRDF’s specular term, convert the result to roughness, and store it in a roughness map.

For improved results at the cost of some extra storage, variance can be computed in the texture-space x- and y-directions and stored in an anisotropic roughness map [384,740,1823]. By itself this technique is limited to axis-aligned anisotropy, which is typical in man-made surfaces but less so in naturally occurring ones. At the cost of storing one more value, oriented anisotropy can be supported as well [740].

Unlike the original forms of Toksvig, LEAN, and CLEAN mapping, variance mapping techniques do not account for variance introduced by GPU texture filtering. To compensate for this, variance mapping implementations often convolve the top-level mip of the normal map with a small filter [740,998]. When combining multiple normal maps, e.g., detail normal mapping [106], care needs to be taken to combine the variance of the normal maps correctly [740,960].

Normal variance can be introduced by high-curvature geometry as well as normal maps. Artifacts resulting from this variance are not mitigated by the previously discussed techniques. A different set of methods exists to address geometry normal variance. If a unique texture mapping exists over the geometry (often the case with characters, less so with environments) then the geometry curvature can be “baked” into the roughness map [740]. The curvature can also be estimated on the fly, using pixel-shader derivative instructions [740,857,1229,1589,1775,1823]. This estimation can be done when rendering the geometry, or in a post-process pass, if a normal buffer is available.

The approaches discussed so far focus on specular response, but normal variance can affect diffuse shading as well. Taking account of the effect of normal variance on the n·l term can help increase accuracy of both diffuse and specular shading since both are multiplied by this factor in the reflectance integral [740].

Variance mapping techniques approximate the normal distribution as a smooth Gaussian lobe. This is a reasonable approximation if every pixel covers hundreds of thousands of bumps, so that they all average out smoothly. However, in many cases a pixel many cover only a few hundred or a few thousand bumps, which can lead to a “glinty” appearance. An example of this can be seen in Figure 9.25 on page 328, which is a sequence of images showing a sphere with bumps that diminish in size from image to image. The bottom right image shows the result when the bumps are small enough to average into a smooth highlight, but the images on the bottom left and bottom center show bumps that are smaller than a pixel but not small enough to average smoothly. If you were to observe an animated rendering of these spheres, the noisy highlight would appear as glints that sparkle in and out from frame to frame.

image

Figure 9.51. On the left is the NDF of a small patch (a few dozen bumps on a side) of a random bumpy surface. On the right is a Beckmann NDF lobe of approximately the same width. (Image courtesy of Miloš Hašan.)

If we were to plot the NDF of such a surface, it would look like the left image in Figure 9.51. As the sphere animates, the h vector moves over the NDF and crosses over bright and dark areas, which causes the “sparkly” appearance. If we were to use variance mapping techniques on this surface, it would effectively approximate this NDF with a smooth NDF similar to the one on the right of Figure 9.51, losing the sparkly details.

In the film industry this is often solved with extensive supersampling, which is not feasible in real-time rendering applications and undesirable even in offline rendering. Several techniques have been developed to address this issue. Some are unsuitable for real-time use, but may suggest avenues for future research [84,810,1941,1942]. Two techniques have been designed for real-time implementation. Wang and Bowles [187,1837] present a technique that is used to render sparkling snow in the game Disney Infinity 3.0. The technique aims to produce a plausible sparkly appearance rather than simulating a particular NDF. It is intended for use on materials such as snow that have relatively sparse sparkles. Zirr and Kaplanyan’s technique [1974] simulates normal distributions on multiple scales, is spatially and temporally stable, and allows for a wider variety of appearances.

We do not have space to cover all of the extensive literature on material filtering, so we will mention a few notable references. Bruneton et al. [204] present a technique for handling variance on ocean surfaces across scales from geometry to BRDF, including environment lighting. Schilling [1565] discusses a variance mapping-like technique that supports anisotropic shading with environment maps. Bruneton and Neyret [205] provide a thorough overview of earlier work in this area.

Further Reading and Resources

McGuire’s Graphics Codex [1188] and Glassner’s Principles of Digital Image Synthesis [543,544] are good references for many of the topics covered in this chapter. Some parts of Dutré’s Global Illumination Compendium [399] are a bit dated (the BRDF models section in particular), but it is a good reference for rendering mathematics (e.g., spherical and hemispherical integrals). Glassner’s and Dutré’s references are both freely available online.

For the reader curious to learn more about the interactions of light and matter, we recommend Feynman’s incomparable lectures [469] (available online), which were invaluable to our own understanding when writing the physics parts of this chapter. Other useful references include Introduction to Modern Optics by Fowles [492], which is a short and accessible introductory text, and Principles of Optics by Born and Wolf [177], a heavier (figuratively and literally) book that provides a more in-depth overview. The Physics and Chemistry of Color by Nassau [1262] describes the physical phenomena behind the colors of objects in great thoroughness and detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset