Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs
http://jcgt.org/published/0003/02/03/
abstract
we provide a new presentation of the masking-shadowing functions (or geometric attenuation factors) in microfacet-based BRDFs and answer some common questions about their applications. our main motivation is to define a correct (geometrically indicated), physically based masking function for application in microfacet models, as well as the properties that function should exhibit. indeed, several different masking functions are often presented in the literature and making the right choice is not always obvious. we start by showing that physically based masking functions are constrained by the projected area of the visible microsurface onto the outgoing direction. we use this property to derive the distribution of visible normals from the microsurface, whose normalization factor is the masking function. we then show how the common form of microfacet-based BRDFs emerges from this distribution. as a consequence, the masking function is related to the correct normalization of microfacet-based BRDFs. however, while the correct masking function satisfies these normalization constrains, its explicit form is can only be determined for a given microsurface profile.
2.1 measuring radiance on a surface
M——代表的是micro-surface
Wo——o,代表out
Figure 1. The outgoing radiance of surface M is the average of the radiances from each point of the surface, weighted by their projected-area fractions towards the outgoing direction.
radiance is the energy density traveling through an area from a solid angle. it is measured in watts per steradian per square meter (W/sr/m^2). The outgoing radiance L(ωo,M) of a given surface M in direction ωo, is the integral of the radiances L(ωo, pm) from each patch with center point pm on the surface, measured from outgoing direction ωo, and weighted by its projected area observed from that outgoing direction (as shown in Figure 1):
The area of each surface point projected in the outgoing direction is a view-dependent weighting factor and the integral ∫M projected area(pm)d pm, is the normalization coefficient of the projected-area fractions. 投射面积的单位化系数。
Note that this normalization coefficient gives the entire expression radiance units; without it, the result would be missing the area units in the denominator 分母.
in the following sections we will see that, in accordance with microfacet theory, the microfacets are also weighted by their projected areas, and that the masking function (or geometric attenuation factor) is the normalization term required for energy preservation.
2.2 microfacet statistics
we consider a planar region of a surface, which we call the “geometric surface” G, whose area is 1m^2 by convention:
the microfacet model assumes that the true surface is offset from this in the form of a collection of microfacets, which we call the “microsurface” M. 我之前的猜测是对的,就是microsurface的首字母缩写, to be precise: if wg is the normal of the geometry G, then M is the set of microfacet points that project onto G along wg. each point pm of the microsurface M has a normal vector wm(pm), i.e. wm:M->Ω is a function from a point on the microsurface to the surface normal vector at that point. we express the three coordinates of this vector as (xm, ym, zm).
figure 2. the geometric surface and the microsurface.
microfacet theory is a statistical model of the scattering properties of the microsurface. thus, writing statistical rather than spatial equations is more convenient for this study. in microfacet theory, the statistics are defined in the space of the normals, which is the spherical domain Ω.
微表面理论是一个统计模型,什么统计模型呢?是关于微表面的散射属性的统计模型。因此,书写统计而不是空间的等式要简单的点。
the distribution of normals to relate integrals over the microsurface to integrals over the sphere——i.e., to convert from spatial to statistical integrals——we need a tool that measures the change-of-area as we switch domains. the distribution of normals provides this. it is expressed in square meters per steradian (m^2/sr) and defined as
注意这里给出了法线分布函数D的定义:
where the units of the Dirac delta distribution are 1/sr, the inverse of those of its argument. consider some region Ω’⊂Ω of the unit sphere. now consider the subset M’⊂M of the microsurface that contains all of the points pm∈M where the normal wm(pm) is an element of Ω’, such that
we use this somewhat awkward phrase because “normal distribution” is widely used to mean the distribution function for a gaussian random variable. also, note that D is actually the distribution of normals per square meter of the geometric surface and this is why it is measured in m^2/sr and not in 1/sr, contrary to what is staged in [Walter et al. 2007].
the distribution of normals has the property that its integral, over any region Ω’⊂Ω of the unit sphere, gives the area of the set of all points M’⊂M whose normals lie in Ω’:
as a consequence, the integral of the distribution of normals is the area of the microsurface:
Spatial and Statistical Equations As a consequence of the definition of D, if f(wm) is any function of the microsurface normals, then the spatial integration of f can be replaced by a statistical integration:
where the left-hand side is the spatial integral and the right-hand side is the statistical integral. this property is used in figure 3(a), where f is the dot product.
Statistical functions if g(pm) is a spatial function defined on the microsurface, we can define the related statistical function g(wm) as
the statistical functions can be used in statistical integrals in the following way:
this property is used in figure 3©, where g is the masking function G1, which we introduce in section 2.3.
2.3. microfacet projections 微表面投影
(a) projected area of the microsurface onto the geometric normal wg the area of the microsurface projected onto the geometric normal is the area of the geometric surface (figure 3(a)), whose area is 1m^2 by convention. hence, the projection of the distribution of normals onto the geometry is normalized:
(b) projected area of the geometric surface onto the outgoing direction wo the geometric surface area is 1m^2 and its provided area onto the outgoing direction (figure 3(b)) is the area multiplied by the cosine of the angle of incidence 入射角 θo:
© projected area of the visible microsurface onto the outgoing direction wo we now show that the projected area of the geometric surface onto the outgoing direction is also the projected area of the visible microsurface (figure 3©). it is the sum of the projected area of each visible microfacet. The projected area of a microfacet with normal wm is the geometric projection factor (wo;wm). Note that here we use the clamped dot product <-;-> because backfacing microfacets are not visible. Also, microfacets occluded by the microsurface do not contribute to the projected area and must be removed from the sum. This is achieved by multiplying by a spatial masking function G1(wo; pm) that has binary values: it evaluates to 0 if point pm is masked and to 1 if it is visible. this gives
The statistical masking function G1(wo;wm) 统计形式的遮蔽函数范围在[0;1]之间。has the range [0;1] and gives the fraction of microfacets with normal wm that are visible along the outgoing direction wo:
The statistical equation is given by
2.4. a constraint on the masking function
firgure 3 emphasizes a fundamental property of microfacet theory: the projected area of the visible microsurface from equation (13) is exactly the projected area of the geometric surface given in Equation (10). This equivalence imposes a constraint on the statistical masking function, which is formalized by the following equation:
Physically based masking functions G1 should always satisfy this constraint. However, this constraint does not entirely determine G1, since for a fixed outgoing direction wo, the masking function is two-dimensional—G1(wo;wm) is defined for each normal—and there are an infinite 无限 number of functions for G1 that satisfy the equation.
In order to reduce the number of solutions to one, we introduce a second constraint:
we choose a microsurface profile.
An intuitive way to think about this is that the distribution of normals is like a histogram, describing only the proportion of each normal on the microsurface. It does not provide information on how they are organized, however—for this, we need a microsurface profile. Furthermore, as Figure 4 illustrates, the choice of profile can have a strong impact on the shape of the resulting BRDF. Once the microsurface profile has been chosen, the masking function is completely determined, and its exact form can be derived. This is covered Section 4, which reviews the exact form of G1 obtained with the Smith and V-cavity microsurface profiles.
2.5. Summary
A frequently asked question concerning the masking function is: “Among the different masking functions (or geometric attenuation factors), which one should I use? Are they all physically based?”
In this section, we have shown that:
The projected area of the visible microsurface is equal to the projected area of the geometric surface onto any projection direction.
The masking function is constrained by this equality. More formally, physically based masking functions always satisfy Equation (14).
The masking function is not entirely determined by this contraint, however.
The masking function is entirely determined once the microsurface profile has been chosen.
The microsurface profile impacts the shape of the BRDF.
Wm的m是microsurface/microfacet的首字母。
3.1 distribution of visible normals
in this section, we will show that equation (1) can be formulated in a microfacet paradigm 范式 as
where L(wo;M) is the outgoing radiance from the microsurface, L(wo,wm) is the outgoing radiance from the microfacets with normal wm, and the factor 1/cosθo is here to normalize the integral by the projected area of geometric surface.
cosθo 是透视的面积。
We can see that the outgoing radiance from the microsurface is the sum of the outgoing radiance from each microfacet weighted by what we call the distribution of visible normals, as illustrated in figure 5. it is the distribution of normals weighted by the projected area of each normal (the clamped cosine,
It is important that the distribution of visible normals Dwo(wm) is normalized, because we use it as a weighting function to average radiances:
Dwo(wm) 是除以了cosθo,进行单位化的之后的分布函数。我们用这个作为缩放量,缩放的是辐射率。对辐射率取平均值,如下:
and, as explained in Section 2.1 and Figure 1, averaging radiances is only valid if the weighting function is normalized. This last equation is well defined because the integral in the denominator of Equation (1), which ensured correct normalization, is now represented in the masking function G1. Indeed, by using the result of Equation (14), we can replace cosθo in Equation (16) and verify that the distribution of normals is normalized:
and the average outgoing radiance from Equations (15) and (17) can thus be expressed in the same form as Equation (1), emphasizing the correct normalization:
3.2. construction of the BRDF
we now construct the BRDF upon the distribution of visible normals. the radiance L(wo,wm) of each microfacet can be expressed in terms of the micro-BRDF ρM(wo;wi;wm) associated with each microfacet and integrated with the incident radiance L(wi) over the domain of the incident directions Ωi (we reserve Ω for the space of the normals):
next, we differentiate equation (17) with respect to the incoming irradiance and substitute dl(wo,wm) via equation (21):