Many BRDF models are based on a mathematical analysis of the effects of microgeometry on reflectance called microfacet theory. This tool was first developed by researchers in the optics community [124]. It was introduced to computer graphics in 1977 by Blinn [159] and again in 1981 by Cook and Torrance [285]. The theory is based on the modeling of microgeometry as a collection of microfacets.
许多BRDF模型基于被称为微界面理论的微几何对反射率的影响的数学分析。该工具最初是由光学领域的研究人员开发的[124]。它在1977年由Blinn [159]引入计算机图形学,1981年由Cook和Torrance [285]再次引入。该理论基于作为微相集合的微几何建模。
Each of these tiny facets is flat, with a single microfacet normal m. The microfacets individually reflect light according to the micro-BRDF fμ(l, v,m), with the combined reflectance across all the microfacets adding up to the overall surface BRDF. The usual choice is for each microfacet to be a perfect Fresnel mirror, resulting in a specular microfacet BRDF for modeling surface reflection. However, other choices are possible.Diffuse micro-BRDFs have been used to create several local subsurface scattering models [574, 657, 709, 1198, 1337]. A diffraction micro-BRDF was used to create a shading model combining geometrical and wave optics effects [763].
这些微小刻面中的每一个都是平坦的,具有单个微面法线m。微面根据微BRDF fμ(l,v,m)单独反射光,所有微面的组合反射率加起来就是整个表面BRDF。通常的选择是每个微表面都是完美的菲涅耳镜,从而产生用于模拟表面反射的镜面微表面BRDF。然而,其他选择也是可能的。漫射微型BRDFs已用于创建多个局部次表面散射模型[574,657,709,1198,1337]。衍射微型BRDF用于创建结合几何和波动光学效应的阴影模型[763]。
An important property of a microfacet model is the statistical distribution of the microfacet normals m. This distribution is defined by the surface’s normal distribution function, or NDF. Some references use the term distribution of normals to avoid confusion with the Gaussian normal distribution. We will use D(m) to refer to the NDF in equations.
微表面模型的一个重要属性是微表面法线m的统计分布。该分布由表面的法线分布函数或NDF定义。一些参考文献使用术语法线分布来避免与高斯正态分布混淆。我们将使用D(m)来表示等式中的NDF。
The NDF D(m) is the statistical distribution of microfacet surface normals over the microgeometry surface area [708]. Integrating D(m) over the entire sphere of microfacet normals gives the area of the microsurface. More usefully, integrating D(m)(n ·m), the projection of D(m) onto the macrosurface plane, gives the area of the macrosurface patch that is equal to 1 by convention, as shown on the left side of Figure 9.31. In other words, the projection D(m)(n ·m) is normalized:
NDF D(m)是微几何表面积上微表面法线的统计分布[708]。在微表面法线的整个球面上积分D(m)给出了微表面的面积。更有用的是,积分D(m)(n·m),即D(m)在宏曲面平面上的投影,给出的宏曲面面积按惯例等于1,如图9.31左侧所示。换句话说,投影D(m)(n m)是归一化的:
Figure 9.31. Side view of a microsurface. On the left, we see that integrating D(m)(n ·m), the microfacet areas projected onto the macrosurface plane, yields the area (length, in this side view) of the macrosurface, which is 1 by convention. On the right, integrating D(m)(v · m), the microfacet areas projected onto the plane perpendicular to v, yields the projection of the macrosurface onto that plane, which is cos θo or (v · n). When the projections of multiple microfacets overlap, the negative projected areas of the backfacing microfacets cancel out the “extra” frontfacing microfacets. (After a figure by Matej Drame.)
图9.31。微曲面的侧视图。在左边,我们看到对投影到宏观表面平面上的微表面面积D(m)(n·m)进行积分,得到宏观表面的面积(长度,在这个侧视图中),按照惯例是1。在右边,对投影到垂直于v的平面上的微表面面积D(m)(v m)进行积分,得到宏观表面在该平面上的投影,即cos θo或(v · n)。当多个微相的投影重叠时,背面微相的负投影面积抵消了“额外的”正面微相。(源自Matej Drame的一幅图。)
The integral is over the entire sphere, represented here by , unlike previous spherical integrals in this chapter that integrated over only the hemisphere centered on n, represented by
. This notation is used in most graphics publications, though some references [708] use
to denote the complete sphere. In practice, most microstructure models used in graphics are heightfields, which means that D(m) = 0 for all directions m outside
. However, Equation 9.21 is valid for non-heightfield microstructures as well.
积分是在整个球面上进行的,这里用表示,不像本章前面的球面积分只在以n为中心的半球上积分,用
表示。虽然一些参考文献[708]使用这种符号来表示完整的球体,但大多数图形出版物都使用
这种符号。实际上,图形中使用的大多数微结构模型都是高度场,这意味着对于m
以外的所有方向,D(m) = 0。然而,方程9.21对非高场微结构也是有效的。
More generally, the projections of the microsurface and macrosurface onto the plane perpendicular to any view direction v are equal:
更一般地,微表面和宏观表面在垂直于任何观察方向v的平面上的投影是相等的:
The dot products in Equations 9.21 and 9.22 are not clamped to 0. The right side of Figure 9.31 shows why. Equations 9.21 and 9.22 impose constraints that the function D(m) must obey to be a valid NDF.
等式9.21和9.22中的点积没有箝位到0。图9.31的右边显示了原因。等式9.21和9.22施加了约束,函数D(m)必须遵守这些约束才能成为有效的NDF。
Intuitively, the NDF is like a histogram of the microfacet normals. It has high values in directions where the microfacet normals are more likely to be pointing. Most surfaces have NDFs that show a strong peak at the macroscopic surface normal n. Section 9.8.1 will cover several NDF models used in rendering.
直观地说,NDF就像微法法线的直方图。它在微法法线更可能指向的方向上具有高值。大多数表面的NDF在宏观表面法线n处显示出一个强峰值。第9.8.1节将介绍渲染中使用的几种NDF模型。
Take a second look at the right side of Figure 9.31. Although there are many microfacets with overlapping projections, ultimately for rendering we care about only the visible microfacets, i.e., the microfacets that are closest to the camera in each overlapping set. This fact suggests an alternative way of relating the projected microfacet areas to the projected macrogeometry area: The sum of the projected areas of the visible microfacets is equal to the projected area of the macrosurface. We can express this mathematically by defining the masking function G1(m, v), which gives the fraction of microfacets with normal m that are visible along the view vector v. The integral of G1(m, v)D(m)(v · m)+ over the sphere then gives the area of the macrosurface projected onto the plane perpendicular to v:
再看一下图9.31的右边。尽管有许多具有重叠投影的微面,但最终为了渲染,我们只关心可见的微面,即在每个重叠集合中最靠近相机的微面。这一事实表明了将投影微相面积与投影宏观几何面积相关联的另一种方式:可见微相的投影面积之和等于宏观表面的投影面积。我们可以通过定义掩蔽函数G1(m,v)来数学地表达这一点,该函数给出了沿视图向量v可见的法线为m的微面相的分数。G1(m,v)D(m)(v · m)+在球体上的积分则给出了投影到垂直于v的平面上的宏观表面的面积:
as shown in Figure 9.32. Unlike Equation 9.22, the dot product in Equation 9.23 is clamped to zero. This operation is shown with the x+ notation introduced in Section 1.2. Backfacing microfacets are not visible, so they are not counted in this case. The product G1(m, v)D(m) is the distribution of visible normals [708].
如图9.32所示。与方程9.22不同,方程9.23中的点积被箝位为零。这个操作用1.2节中介绍的x+符号表示。背面微相不可见,因此在这种情况下不计算在内。乘积G1(m,v)D(m)是可见法线的分布[708]。
Figure 9.32. Integrating the projected areas of the visible microfacets (in bright red) yields the projected area of the macrosurface onto the plane perpendicular to v.
图9.32。对可见微表面(亮红色)的投影面积进行积分,得到宏观表面在垂直于v的平面上的投影面积。
While Equation 9.23 imposes a constraint on G1(m, v), it does not uniquely determine it. There are infinite functions that satisfy the constraint for a given microfacet normal distribution D(m) [708]. This is because D(m) does not fully specify the mi crosurface. It tells us how many of the microfacets have normals pointing in certain directions, but not how they are arranged.
虽然方程9.23对G1(m,v)施加了一个约束,但它并不唯一地决定它。对于给定的微法正态分布D(m) [708],存在满足约束的无限个函数。这是因为D(m)不能完全说明微观表面。它告诉我们有多少微面相具有指向特定方向的法线,但不知道它们是如何排列的。
Although various G1 functions have been proposed over the years, the dilemma as to which one to use has been solved (at least for now) in an excellent paper by Heitz [708]. Heitz discusses the Smith masking function, which was initially derived for Gaussian normal distributions [1665] and later generalized to arbitrary NDFs [202]. Heitz shows that out of the masking functions proposed in the literature, only two—the Smith function and the Torrance-Sparrow “V-cavity” function [1779]—obey Equation 9.23 and are thus mathematically valid. He further shows that the Smith function is a much closer match to the behavior of random microsurfaces than the TorranceSparrow function. Heitz also proves that the Smith masking function is the only possible function that both obeys Equation 9.23 and possesses the convenient property of normal-masking independence. This means that the value of G1(m, v) does not depend on the direction of m as long as m is not backfacing i.e., as long as m· v ≥ 0. The Smith G1 function has the following form:
尽管多年来已经提出了各种各样的G1函数,但是关于使用哪一个的难题已经在Heitz [708]的一篇优秀论文中解决了(至少目前如此)。Heitz讨论了史密斯掩蔽函数,该函数最初是针对高斯正态分布[1665]推导出来的,后来推广到任意NDF[202]。Heitz指出,在文献中提出的掩蔽函数中,只有两个Smith函数和Torrance-Sparrow“V型腔”函数[1779]——符合方程9.23,因此在数学上是有效的。他进一步表明,与TorranceSparrow函数相比,Smith函数更接近随机微曲面的行为。Heitz还证明了Smith掩蔽函数是唯一可能的函数,它既服从方程9.23,又具有正常掩蔽独立性的便利性质。这意味着只要m不是背向的,即只要m· v ≥ 0,G1(m,v)的值就不依赖于m的方向。史密斯·G1函数具有以下形式:
where χ+(x) is the positive characteristic function
其中χ+(x)是正特征函数
The (lambda) function differs for each NDF. The procedure to derive
for a given NDF is described in publications by Walter et al. [1833] and Heitz [708].
每个NDF的(λ)函数不同。Walter等人[1833]和Heitz [708]的出版物描述了
推导给定NDF的程序。
The Smith masking function does have some drawbacks. From a theoretical standpoint, its requirements are not consistent with the structure of actual surfaces [708], and may even be physically impossible to realize [657]. From a practical standpoint, while it is quite accurate for random surfaces, its accuracy is expected to decrease for surfaces with a stronger dependency between normal direction and masking, such as the surface shown in Figure 9.28, especially if the surface has some repetitive structure (as do most fabrics). Nevertheless, until a better alternative is found, it is the best option for most rendering applications.
史密斯掩蔽函数确实有一些缺点。从理论角度来看,其要求与实际表面的结构不一致[708],甚至可能在物理上无法实现[657]。从实用的观点来看,虽然它对于随机表面是相当精确的,但是对于法线方向和遮蔽之间有更强依赖性的表面,它的精度预计会降低,如图9.28所示的表面,特别是如果表面有一些重复的结构(大多数织物都是这样)。然而,在找到更好的选择之前,它是大多数渲染应用程序的最佳选择。
Given a microgeometry description including a micro-BRDF fμ(l, v,m), normal distribution function D(m), and masking function G1(m, v), the overall macrosurface BRDF can be derived [708, 1833]:
给定包括微BRDF fμ(l,v,m)的微几何描述,正常 分布函数D(m),掩蔽函数G1(m,v),整体宏观面 可以推导出BRDF[708,1833]:
This integral is over the hemisphere centered on n, to avoid collecting light contributions from under the surface. Instead of the masking function G1(m, v), Equation 9.26 uses the joint masking-shadowing function G2(l, v,m). This function, derived from G1, gives the fraction of microfacets with normal m that are visible from two directions: the view vector v and the light vector l. By including the G2 function, Equation 9.26 enables the BRDF to account for masking as well as shadowing, but not for interreflection between microfacets (see Figure 9.27 on page 329). The lack of microfacet interreflection is a limitation shared by all BRDFs derived from Equation 9.26. Such BRDFs are somewhat too dark as a result. In Sections 9.8.2 and 9.9, we will discuss some methods that have been proposed to address this limitation.
这个积分是在以n为中心的半球上进行的,以避免从表面下收集光的贡献。代替掩蔽函数G1(m,v),方程9.26使用联合掩蔽-遮蔽函数G2(l,v,m)。该函数源于G1,给出了从两个方向可见的法线为m的微相的分数:视图向量v和光线向量l。通过包含G2函数,方程9.26使BRDF能够考虑掩蔽和阴影,但不能考虑微相之间的相互反射(见图9.27)。从方程9.26导出的所有BRDFs都有一个共同的限制,就是缺少微界面互反射。因此,这种BRDFs有些太暗。在9.8.2和9.9节中,我们将讨论一些已经提出的解决这一限制的方法。
Heitz [708] discusses several versions of the G2 function. The simplest is the separable form, where masking and shadowing are evaluated separately using G1 and multiplied together:
Heitz [708]讨论了G2函数的几种版本。最简单的是可分离形式,其中掩蔽和阴影使用G1分别计算,然后相乘:
This form is equivalent to assuming that masking and shadowing are uncorrelated events. In reality they are not, and the assumption causes over-darkening in BRDFs using this form of G2.
这种形式相当于假设掩蔽和遮蔽是不相关的事件。实际上它们不是,这种假设导致使用这种G2形式的BRDFs过暗。
As an extreme example, consider the case when the view and light directions are the same. In this case G2 should be equal to G1, since none of the visible facets are shadowed, but with Equation 9.27 G2 will be equal to G21 instead.
作为一个极端的例子,考虑视角和光线方向相同的情况。在这种情况下,G2应该等于G1,因为没有可见的小平面被遮蔽,但是根据等式9.27,G2将等于G21。
If the microsurface is a heightfield, which is typically the case for microsurface models used in rendering, then whenever the relative azimuth angle φ between v and l is equal to 0◦, G2(l, v,m) should be equal to min(G1(v,m),G1(l,m)). See Figure 9.17 on page 311 for an illustration of φ. This relationship suggests a general way to account for correlation between masking and shadowing that can be used with any G1 function:
如果微表面是高度场,这通常是渲染中使用的微表面模型的情况,则每当v和l之间的相对方位角φ等于0时,G2(l,v,m)应该等于min(G1(v,m),G1(l,m))。关于φ的图示,见图9.17。这种关系提出了一种通用方法来说明掩蔽和遮蔽之间的相关性,该方法可用于任何G1函数:
where λ(φ) is some function that increases from 0 to 1 as the angle φ increases.Ashikhmin et al.[78] suggested a Gaussian with a standard deviation of 15◦ (∼ 0.26 radians):
其中λ(φ)是随着角度φ增加而从0增加到1的某个函数。Ashikhmin等人[78]建议使用标准偏差为15 度(∾0.26弧度)的高斯分布:
A different λ function was proposed by van Ginneken et al. [534]:
van Ginneken等人提出了不同的λ函数【534】:
Regardless of the relative alignment of the light and view directions, there is another reason that masking and shadowing at a given surface point are correlated. Both are related to the point’s height relative to the rest of the surface. The probability of masking increases for lower points, and so does the probability of shadowing. If the Smith masking function is used, this correlation can be precisely accounted for by the Smith height-correlated masking-shadowing function:
不考虑光线和视图方向的相对对齐,另一个原因是给定曲面点处的遮罩和阴影是相关的。两者都与点相对于表面其余部分的高度有关。对于较低的点,掩蔽的概率增加,阴影的概率也增加。如果使用史密斯掩蔽函数,这种相关性可以通过史密斯高度相关掩蔽-遮蔽函数来精确说明:
Heitz also describes a form of Smith G2 that combines direction and height correlation:
Heitz还描述了一种结合方向和高度相关性的Smith G2形式:
where the function λ(v, l) could be an empirical function such as the ones in Equations
9.29 and 9.30, or one derived specifically for a given NDF [707].
其中函数λ(v,l)可以是经验函数,例如等式中的函数 9.29和9.30,或专门为给定NDF导出的一个[707]。
Out of these alternatives, Heitz [708] recommends the height-correlated form of the Smith function (Equation 9.31) since it has a similar cost to the uncorrelated form and better accuracy. This form is the most widely used in practice [861, 947, 960], though some practitioners use the separable form (Equation 9.27) [214, 1937].
在这些备选方案中,Heitz [708]推荐了史密斯函数的高度相关形式(方程9.31),因为它具有与不相关形式相似的成本和更好的精度。这种形式是实践中最广泛使用的[861,947,960],尽管一些从业者使用可分形式(方程9.27) [214,1937]。
The general microfacet BRDF (Equation 9.26) is not used directly for rendering. It is used to derive a closed-form solution (exact or approximate) given a specific choice of micro-BRDF fμ. The first example of this type of derivation will be shown in the next section.
一般的微界面BRDF(方程9.26)不直接用于渲染。在给定特定选择的微型BRDF fμ的情况下,它用于推导闭合形式的解(精确或近似)。这种类型推导的第一个例子将在下一节中给出。