Eric Heitz

Understanding the Masking-Shadowing Function in Microfacet-Based BRDFs

Keywords: microfacet theory, physically based rendering théorie des micro-facettes, rendu physiquement réaliste

We give a new presentation of the masking-shadowing functions in microfacet-based BRDFs and answer some common questions about their applications. We use the fact that the masking function (or geometric attenuation factor) is constrained by the visible projected area of the microsurface onto the outgoing direction to derive the properties of the exact masking function. We introduce the distribution of visible normals from the microsurface, whose normalization factor is the masking function, and we show how the common form of microfacet-based BRDFs emerges from this distribution. The consequence of this is that only exact masking functions ensure correct normalization of microfacet-based BRDFs. However, the exact masking function that satisfies these properties can be determined only if a microsurface profile is chosen. Our derivation emphasizes that under the assumptions of their respective microsurface profiles, Smith's and the historical V-cavity masking functions are both exact. However, we show that the V-cavity microsurface is closer to a normal map than a displacement map. This intuition explains why this non-realistic model is responsible for wrong specular highlights at grazing view angles. The insights gained from these observations motivate new research directions in the field of microfacet theory. For instance, we show that masking functions are stretch invariant and we show how this property can be used to derive the masking function for anisotropic microsurfaces in a straightforward way. We also discuss future work such as the incorporation of multiple scattering on the microsurface into BRDF models.

Key-words:

Introduction

Microfacet theory was originally developed in the field of optical physics to study scattering on statistical surfaces [START_REF] Beckmann | The scattering of electromagnetic waves from rough surfaces[END_REF]. In the graphics community, we use it to derive physically based BRDFs [CT82, ON94, WMLT07], which are now widely used in both real-time and production rendering. Nowadays, microfacet theory is a fundamental background in computer graphics. For instance, each year at SIGGRAPH, the course on physically based rendering starts with an introduction to microfacet theory [MHH + 12, MHM + 13]. The goal of a typical microfacet course is to provide the main intuitions derived from the underlying physics as well as other considerations such as flexibility for artistic direction and computational efficiency. The combination of different components of microfacet-based BRDFs offers a wide range of possibilities and the best choice is not always obvious.

What This Document Is About The purpose of this document is to provide new insights and answer longstanding questions concerning the choice of the masking-shadowing function for microfacet-based BRDFs. These questions are answered in the summary-sections 2.5, 3.6, and 4.3. We advise the reader who wants to be spared technical details and go straight to the point to jump directly to these three sections. The rest of the document is dedicated to the reader willing to develop his intuition and understanding of microfacet theory.

What This Document Is Not About We do not introduce new BRDF models; we only discuss commonly used models. We don't advise the reader to use a model rather than another; we aim at providing knowledge on these models to help understand where they come from, what they are doing, and what we can expect from them. We don't recall their implementation or usage with specific rendering techniques since they are already used in the CG community; we focus on understanding their physical properties.

Ideas and Organization

The ideas presented in this document were strongly inspired by two previous works:

• Ashikhmin et al. observe that the visible projected area is a quantity that is conserved from the macrosurface to the microsurface [START_REF] Michael Ashikmin | A microfacet-based brdf generator[END_REF]. They use this knowledge to derive the general equation for an exact masking term, which ensures correct normalization and energy conservation. Their masking term is presented in its integral form and they do not derive a closed form. Instead, they precompute it numerically and store it in a look-up table.

• Ross et al. propose a study of the reflectance of the sea [START_REF] Ross | Detailed analytical approach to the gaussian surface bidirectional reflectance distribution function specular component applied to the sea surface[END_REF]. They model the sea with a Gaussian rough surface (Beckmann distribution) and compute a normalized BRDF incorporating Smith's masking and shadowing functions [START_REF] Smith | Geometrical shadowing of a random rough surface[END_REF]. During the derivation, they observe that on Gaussian surfaces, the normalization coefficients of the BRDF and Smith's functions have similar expressions and simplify out. They note that this property is convenient for computational purposes, but they do not provide a physical reason as to why this is.

We provide a full analytical derivation of Ashikhmin et al.'s equation, whose solution turns out to be the generalized form of Smith's masking function, as observed by Ross et al. in the special case of Gaussian surfaces. This generalized form was already derived by Brown [START_REF] Brown | Shadowing by non-gaussian random surfaces[END_REF] and recently introduced into the CG community by Walter et al. [START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF]. While our derivation does not provide a new result, it has the advantage of emphasizing that the result is exact rather Inria than approximate, and shows how masking is related to the concept of the visible projected area on arbitrary stochastic surfaces.

In Section 2, we introduce the microfacet statistical quantities and derive Ashikhmin et al.'s equation, that is satisfied by exact masking functions.

In Section 3, we introduce the distribution of visible normals and we show how common BRDF models can be derived from this distribution. We recall that the reason why these models require shadowing is that they only model the first scattering event occuring on the microsurface. Common microfacet-based BRDFs do not model multiple scattering and are not normalized for this reason, i.e. they do not integrate to exactly 1. Starting from this observation, we propose a normalization test that we call the Weak White Furnace Test, that can be used to verify that common microfacet-based BRDFs are well designed, even if they only model the first scattering event.

In Section 4, we instantiate the equations derived in the previous sections with Smith's and the V-cavity microsurface profiles and compare the properties of their respective BRDFs.

In Section 5, we demonstrate for the first time the stretch invariance property of the masking function. We show how it can be used to make a trivial derivation of the masking functions for several anisotropic distributions of normals. This eases generalization to anisotropy of several previous results and spares heavy mathematical derivations.

In Section 6, we discuss the properties of Smith's function used for shadowing and we recall several masking-shadowing models that handle different types of correlation.

Finally, in Section 7, we discuss some of the limitations of the current microfacet framework and we propose possibilities for promising future work based on the insights gained in this investigation.

Derivation of the Masking Function

In this section we recall how the projected area of the microsurface can be used to derive the exact masking function [START_REF] Michael Ashikmin | A microfacet-based brdf generator[END_REF]. We start by defining the concept of projected area (2.1) and show why it is essential to the measure of radiance. Then, we define the statistical framework of microfacet theory (2.2). The conservation of the projected area (2.3) gives a new microfacet equation that we use to constraint the masking function (2.4). This constraint, associated to the choice of a microsurface profile, leads to the derivation of the exact masking function. Radiance L is the energy density traveling through a surface from a solid angle and is expressed in watts per steradian per square meter (W.sr -1 .m -2 ). The radiance L(ω o , S) going out from a surface S in direction ω o , is the sum of the radiances L(ω o , p) going out from each point p of the surface in direction ω o weighted by their projected-area fractions towards direction ω o (as shown in Figure 1):

Measuring Radiance on a Surface

L(ω o , S) = S projected area(x) S projected area(p) dp L(ω o , p) dp.
(1)

The area of each surface point projected in the outgoing direction is a view-dependent weighting factor and the sum S projected area(p) dp, is the normalization coefficient of the projected-area fractions. Dividing by this sum is essential for the unit to be correct and ensures that the density of energy is preserved.

In the following sections we will see that, in accordance with microfacet theory, the microfacets are also weighted by their projected area, and that the masking function (or geometric attenuation factor) is the normalization coefficient required for energy preservation.

Inria

Microfacet Statistics

We consider a planar region of a surface, we call it the "geometric surface" G, whose area is 1 by convention: G dp g = 1. The microfacet model imagines that the true surface is offset from this in the form of a bunch of microfacets, we call it the "microsurface" M. To be precise: if ω g is the normal to the geometry G, then M is the set of microfacet points near G that project to M along ω g . Each point p m of the microsurface M is assumed to have a normal vector ω m (p m ). 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 Ω.

G

geometric surface ω g = (0, 0, 1)

geometric normal M microsurface ω m = (x m , y m , z m ) microsurface normal θ m normal angle (cos θ m = z n ) ω o = (x o , y o , z o ) outgoing direction θ o angle of incidence (cos θ o = z o ) D(ω m ) distribution of normals G 1 (ω o , p m ) spatial masking function at point p m (binary value) G 1 (ω o , ω m ) statistical masking function of normal ω m (in [0, 1]) Ω spherical domain (4π steradian) ω 1 • ω 2 dot product |ω 1 • ω 2 | absolute value of the dot product ω 1 , ω 2 = χ + (ω 1 • ω 2 ) clamped dot product χ + (a)
Heaviside function:

1 if a > 0 and 0 if a ≤ 0 Table 1: Notation.
The Distribution of Normals The distribution of normals measures, for a given direction ω, the area of the region of the microsurface that is orthogonal to this direction. It is defined by:

D(ω) = M δ ω (ω m (p m )) dp m .

RR n°8468

Spatial and Statistical Equations If f (ω m ) is a function of the normals of the microsurface, the spatial integration of f can be replaced by a statistical integration:

Ω f (ω m ) D(ω m ) dω m = M f (ω m (p m )) dp m ,
where the left-hand side is the statistical integral and the right-hand side is the spatial integral.

In Table 2(a), we use this property where f is the dot product. This equation can be applied for instance to compute the integral of the distribution of normals:

Ω D(ω m ) dω m = M dp m = microsurface area.
The integral of the distribution of normals is the area of the microsurface.

Statistical Functions If g(p m

) is a spatial function defined on the microsurface, we define the statistical function g(ω m ):

g(ω) = Ω δ ω (ω m (p m )) g(p m ) dp m Ω δ ω (ω m (p m )) dp m .
The statistical functions can be used in statistical integrals in the following way:

Ω g(ω m ) D(ω m ) dω m = M g(p m ) dp m .
In Table 2(c), we use this property where g is the masking function G 1 .

Microfacet Projections

(a) Projection onto the Geometry The area of the microsurface projected onto the geometric normal is the area of the geometric surface (Table 2(a)), whose area is 1 by convention. Hence, the projection of the distribution of normals onto the geometry is normalized:

Ω (ω m • ω g ) D(ω m ) dω m = M (ω m (p m ) • ω g ) dp m = G dp g = 1.
(b) Projected Area of the Geometric Surface The geometric surface is a unit planar element and its projected area onto the outgoing direction (Table 2(b)) is the cosine of the angle of incidence θ o :

projected area = ω o • ω g = cos θ o . (2)
(c) Visible Projected Area of the Microsurface The projected area of the geometric surface onto the outgoing direction is also the visible projected area of the microsurface (Table 2

(c)).
It is the sum of the visible projected area of each microfacet. The projected area of a microfacet with normal ω m is the geometric projection factor ω m , ω o . Note that here we use the clamped dot product -, -because backface-culled 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 G 1 (ω o , p m ) that has binary values: it evaluates to 0 if point p m is masked and to 1 if it is visible:

projected area = M G 1 (ω o , p m ) ω o , ω m (p m ) dp m .
Inria (a) Projected area of the microsurface onto the geometric normal Spatial equation:

M (ω m (p m ) • ω g ) dp m = G dp g = 1
Statistical equation:

Ω (ω m • ω g ) D(ω m ) dω m = 1 (b)
Projected area of the geometric surface onto the outgoing direction

projected area = ω o • ω g = cos θ o (c)
The visible projected area of the microsurface onto the outgoing direction Spatial equation:

projected area = M G 1 (ω o , p m ) ω o , ω m (p m ) dp m
Statistical equation:

projected area = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m
Table 2: Projections in microfacet theory.

The statistical masking function G 1 (ω o , ω m ) ranges in [0, 1] and gives the fraction of microfacets with normal ω m that are visible in the outgoing direction ω o :

G 1 (ω o , ω) = Ω δ ω (ω m (p m )) G 1 (ω o , p m ) dp m Ω δ ω (ω m (p m )) dp m .
The statistical equation is given by:

projected area = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m . (3)

A Constraint on the Masking Function

cos θ o = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m . (4)
The masking function G 1 should always satisfy this constraint. However, this is still not sufficient to entirely determine G 1 , since for a fixed outgoing direction ω o , the masking function is a 2D function (G 1 (ω o , ω m ) is defined for each normal) and there is an infinite number of functions for G 1 that satisfy this equation. In order to reduce the number of solutions to 1, we introduce another constraint: we choose a microsurface profile. Indeed, the distribution of normals is a histogram: it describes the proportion of each normal on the microsurface but does not provide information about how they are organized. Their organization is described by the microsurface profile. While the choice of the microsurface profile is arbitrary, the masking function is completely determined once it is chosen and its exact form can be derived. The profile of the microsurface has an important impact on the shape of the resulting BRDF, as illustrated in Figure 3. In Section 4, we review the exact form of G 1 obtained with Smith's and the V-cavity microsurface profiles.

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 correct? " In this section, we showed that:

• The projected visible area of the microsurface equals the projected area of the macrosurface onto any projection direction.

• The masking function is constrained by this equality. Physically correct masking functions always satisfy Equation (4).

• The masking function is not entirely determined by Equation (4), though.

• The masking function is entirely determined once the microsurface profile is chosen.

• The microsurface profile impacts the shape of the BRDF.

Inria

Microfacet-Based BRDFs

In this section, we define the distribution of visible normals (3.1) and we show how microfacet models are constructed upon this distribution in the general case (3.2), and in the specific cases of specular (3.3) and diffuse (3.4) microfacets. We show that the masking function is the normalization coefficient of the distribution of visible normals and we discuss the link with energy conservation for BRDFs constructed from this distribution (3.5).

Distribution of Visible Normals

In this section, we will show that Equation (1) can be formulated in a microfacet paradigm as:

L(ω o ) = 1 cos θ o Ω L(ω o , ω m ) G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m , (5)
where L(ω o , ω m ) is the outgoing radiance from the microfacets with normal ω m , and the factor 1 cos θo is here to normalize the integral by the projected area of the geometric surface. We can see that the outgoing radiance from the surface is the sum of the outgoing radiance from each microfacet weighted by what we call the distribution of visible normals illustrated in Figure 4. It is the distribution of normals weighted by the projected area (the clamped cosine) of each normal and by the masking function:

D ωo (ω m ) = G 1 (ω o , ω m ) ω o , ω m D(ω m ) cos θ o , (6)

Inria

It is important that the distribution of visible normals D ωo (ω m ) is normalized, because we use it as a weighting function to average radiances:

L(ω o ) = Ω L(ω o , ω m ) D ωo (ω m ) dω m , (7)
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 G 1 . Indeed, by using the result of Equation ( 4) we can substitute cos θ o in Equation ( 6) and verify that the distribution of normals is normalized:

Ω D ωo (ω m ) dω m = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) cos θ o dω m = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m = 1, (8)
and the average outgoing radiance from Equations ( 5) and (7) can thus be expressed in the same form as Equation (1), emphasizing the correct normalization:

L(ω o ) = Ω L(ω o , ω m ) G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m .

Construction of the BRDF

We now construct the BRDF upon the distribution of visible normals. The radiance L(ω o , ω m ) of each microfacet can be expressed in terms of the micro-BRDF ρ µ (ω o , ω i , ω m ) associated with each microfacet, by integrating over the domain of the incident directions Ω i (we keep Ω for the space of the normals):

L(ω o , ω m ) = Ωi dL(ω o , ω m ) = Ωi ρ µ (ω o , ω i , ω m ) ω i , ω m L(ω i ) dω i ,
where the micro-BRDF is defined as the ratio of the differential outgoing radiance to the differential incoming irradiance:

dL(ω o , ω m ) = ρ µ (ω o , ω i , ω m ) ω i , ω m L(ω i ) dω i .
We can use the definition of the micro-BRDF to differentiate Equation (7):

dL(ω o ) = Ω dL(ω o , ω m ) D ωo (ω m ) dω m = L(ω i ) dω i Ω ρ µ (ω o , ω i , ω m ) ω i , ω m D ωo (ω m ) dω m , (9)
where L(ω i ) dω i can be moved outside the integral because it does not depend on ω m . Since the macro-BRDF is defined by equation:

dL(ω o ) = ρ(ω o , ω i ) cos θ i L(ω i ) dω i ,
we arrive at the following:

ρ(ω o , ω i ) = dL(ω o ) cos θ i L(ω i ) dω i = 1 cos θ i Ω ρ µ (ω o , ω i , ω m ) ω i , ω m D ωo (ω m ) dω m .
By substituting D ωo (ω m ) from Equation (6) we get:

ρ(ω o , ω i ) = 1 cos θ o cos θ i Ω ρ µ (ω o , ω i , ω m ) ω o , ω m ω i , ω m G 1 (ω o , ω m ) D(ω m ) dω m = 1 |ω g • ω o | |ω g • ω i | Ω ρ µ (ω o , ω i , ω m ) ω o , ω m ω i , ω m G 1 (ω o , ω m ) D(ω m ) dω m .
An important observation is that this equation models only how rays are reflected just after the first bounce before leaving the surface (Table 3(b)). However, a BRDF model must describe instead how rays are distributed after leaving the surface. The distribution before and after leaving the surface is not the same because some reflected rays hit the microsurface again and are reflected in another direction before leaving (

ρ(ω o , ω i ) = 1 |ω g • ω o | |ω g • ω i | Ω ρ µ (ω o , ω i , ω m ) ω o , ω m ω i , ω m G 2 (ω o , ω i , ω m ) D(ω m ) dω m . (10)
We instantiate this equation for the specific cases where the microfacets are perfect mirrors (3.3) and perfect diffusers (3.4).

Construction of the BRDF with specular microfacets

The micro-BRDF for mirror-like microfacets is:

ρ µ (ω o , ω i , ω m ) = ∂ω h ∂ω i F (ω o , ω h ) δ ω h (ω m ) |ω i • ω h | = F (ω o , ω h ) δ ω h (ω m ) 4 |ω i • ω h | 2 , ( 11
)
where

∂ω h ∂ωi = 1 4 |ωi•ω h | is the Jacobian of the reflection transformation [WMLT07]
, and F is the Fresnel term. In Equation (10), by substituting ρ µ (ω o , ω i , ω m ) from Equation (11) and D ωo (ω m ) from Equation (6) we get:

ρ(ω o , ω i ) = 1 |ω g • ω o | |ω g • ω i | Ω F (ω o , ω h ) δ ω h (ω m ) 4 |ω i • ω h | 2 ω o , ω m ω i , ω m G 2 (ω o , ω i , ω m ) D(ω m ) dω m .
The delta function δ ω h (ω m ) allows us to replace the integral by the integrand evaluated at ω m = ω h , and the fact that

ω o • ω h = ω i • ω h reduces the expression to: ρ(ω o , ω i ) = F (ω o , ω h ) G 2 (ω o , ω i , ω h ) D(ω h ) 4 |ω g • ω o | |ω g • ω i | . ( 12
)
We arrived at the well-known equation of specular microfacet-based BRDFs [START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF].

Inria

Construction of the BRDF with diffuse microfacets

The micro-BRDF for diffuse microfacets is constant:

ρ µ (ω o , ω i , ω m ) = 1 π . (13)
In Equation (10), by substituting ρ µ (ω o , ω i , ω m ) from Equation ( 13) and D ωo (ω m ) from Equation (6) we get:

ρ(ω o , ω i ) = 1 π 1 |ω g • ω o | |ω g • ω i | Ω ω o , ω m ω i , ω m G 2 (ω o , ω i , ω m ) D(ω m ) dω m . (14)
This equation has no analytical solution. Oren and Nayar [START_REF] Oren | Generalization of Lambert's reflectance model[END_REF] propose an analytical fit of this function in the case where D is a spherical Gaussian (not to be confused with Beckmann distribution) and where G 2 is the V-cavity masking and shadowing function.

The BRDF Normalization Test

The White Furnace Test The bidirectional scattering distribution function (BSDF) s is the sum of the bidirectional reflectance distribution function (BRDF) ρ defined on the upper hemisphere and the bidirectional transmittance distribution function (BTDF) t defined on the lower hemisphere:

s(ω o , ω i ) = ρ(ω o , ω i ) + t(ω o , ω i ).
If we had a perfect surface that never dissipates energy into heat, then the energy of the rays would be perfectly preserved. Thus, an important property that should be verified by microfacetbased scattering models is that, when the surface absorption is 0, the distribution of scattered rays is perfectly normalized:

Ω s(ω o , ω i ) |ω g • ω i | dω i = 1.
If the Fresnel term is always 1, then rays are never transmitted (they never penetrate the surface), the BTDF evaluates to t = 0, and the scattering model is then entirely defined by the BRDF (i.e., s = ρ). In this case, the rays are all reflected without energy loss and their distribution is normalized. This is modeled by the White Furnace Test equation:

Ω ρ(ω o , ω i ) |ω g • ω i | dω i = 1.
Intuitively, it represents the fact that rays cast from the outgoing direction (Table 3(a)) would be scattered one or more times and eventually leave the surface (Table 3(d)). However, common analytical BRDFs do not model multiple scattering on the microsurface; the rays that bounce multiple times are removed from the BRDF by the shadowing function, as shown in Table 3(c) and described in Section 3.2. This is why common BRDF models do not integrate to 1 and do not satisfy the White Furnace Test equation.

The Weak White Furnace Test The White Furnace Test cannot be used to validate common BRDF models, which incorporate only the first scattering event. However, we can design another less restrictive test that must be satisfied by common microfacet-based BRDFs. We can verify that the distribution of rays reflected just after the first bounce and before leaving the surface is normalized (Table 3(b)). This can be achieved by replacing masking-shadowing by masking alone

(G 2 (ω o , ω i , ω h ) = G 1 (ω o , ω h ))
. Without Fresnel and shadowing, the BRDF from Equation (12) becomes:

ρ(ω o , ω i ) = G 1 (ω o , ω h ) D(ω h ) 4 |ω g • ω o | |ω g • ω i | ,
and after cancellation of |ω g • ω i |, the Weak White Furnace Test equation is given by:

Ω G 1 (ω o , ω h ) D(ω h ) 4 |ω g • ω o | dω i = 1. ( 15
)
This condition is only met with an appropriate masking function G 1 that satisfies Equation (4).

In Appendix C, we provide MATLAB code to numerically compute Equation ( 15) with Beckmann and GGX distributions and their associated Smith masking functions. We define the same test for BRDFs with diffuse microfacets, by substituting 14) and by integrating over the incident directions:

G 2 (ω o , ω i , ω h ) = G 1 (ω o , ω h ) in Equation (
Ω 1 π 1 |ω g • ω o | |ω g • ω i | Ω ω o , ω m ω i , ω m G 1 (ω o , ω m ) D(ω m ) dω m |ω g • ω i | dω i = 1 π 1 |ω g • ω o | Ω Ω ω o , ω m ω i , ω m G 1 (ω o , ω m ) D(ω m ) dω m dω i = 1. (16)

Summary

A frequently asked question concerning BRDF normalization is: "Microfacet-based BRDFs do not integrate to 1. Shouldn't they be perfectly normalized? "

In this section we answered this question by developing the following ideas:

• The BRDF is constructed from the distribution of visible normals.

• The distribution of visible normals has to be normalized to ensure that the BRDF conserves energy.

• The normalization coefficient of the distribution of visible normals is the masking function.

• Microfacet-based BRDFs should theoretically be normalized and integrate exactly to 1.

• The shadowing function in microfacet-based BRDFs is used to separate the first scattering events from the multiple scattering events on the microsurface. Shadowing sets to 0 the scattering events of order greater than 1 and leaves the BRDF artificially unnormalized in the absence of a term to model multiple scattering events.

• The standard form of microfacet-based BRDFs is normalized by the masking function and without Fresnel and shadowing. Physically correct masking functions always satisfy Equations ( 15) and ( 16) . This is what we call the "Weak White Furnace Test".

Note that the Weak White Furnace Test, in which shadowing is not incorporated, is a simple way to verify that the masking function is well defined. It is important to note that this does not mean that common BRDF models should be used without shadowing. Shadowing is what separates energy reflected after the first bounce from energy reflected after multiple bounces, which is not incorporated into common BRDF models. ⇒ The distribution of reflected rays is normalized.

Ω ρ(ω o , ω i ) |ω g • ω i | dω i = Ω G 1 (ω h , ω o ) D(ω h ) 4 |ω g • ω o | dω i = 1
(c) Shadowing in the BRDF models the fact that rays occluded by the microsurface are discarded.

⇒ The distribution of reflected rays is NOT normalized.

Ω ρ(ω o , ω i ) |ω g • ω i | dω i = Ω G 2 (ω o , ω i , ω h ) D(ω h ) 4 |ω g • ω o | dω i < 1 (d)
In the real world, rays are not discarded but scatter several times before leaving the surface.

⇒ A complete BRDF model should incorporate multiple scattering and would be normalized.

Ω ρ(ω o , ω i ) |ω g • ω i | dω i = 1
Table 3: Normalization of specular microfacet-based BRDFs.

RR n°8468

4 Choosing a Microsurface Profile

In Sections 2 and 3 we derived general results on the masking function, Equations (4), ( 8) and (15), without making any assumption on the kind of microsurface. In this section, we review Smith's (4.1) and the V-cavity (4.2) microsurface profiles, derive the closed form of their respective masking functions, and discuss their properties.

Smith's Microsurface Profile

Normal/Masking Independence Smith's microsurface profile assumes that the microsurface is not autocorrelated. This implies a random 3D set of microfacets rather than a continuous surface-as shown in Figure 5, where the heights and the normals of the microsurface are independent random variables. The consequence of this model is that the probability G 1 (ω o , ω m ) given by the masking function is independent of the normal orientation ω m for normals that are not backface-culled ( ω o , ω m > 0). The intuition is that the normal ω m is a local property of the microfacet, while the potential occlusion responsible for masking occurs elsewhere on the microsurface and is thus a distant property of the microfacet. Since the microsurface is not autocorrelated, local properties are independent of distant properties and the masking function can be expressed in the separable form:

G 1 (ω o , ω m ) = G local 1 (ω o , ω m ) G dist 1 (ω o ),
where the local masking function is the binary backface-culling due to the orientation of the microfacet:

G local 1 (ω o , ω m ) = χ + (ω o • ω m ),
and the distant masking function G dist 1 (ω o ) is the probability of occlusion by another distant point of the microsurface, which is independent of the local orientation ω m .

Inria

Derivation of the Masking Function By expanding this in Equation (4), we get:

cos θ o = Ω G 1 (ω o , ω m ) ω o , ω m D(ω m ) dω m = Ω χ + (ω o • ω m ) G dist 1 (ω o ) ω o , ω m D(ω m ) dω m = G dist 1 (ω o ) Ω ω o , ω m D(ω m ) dω m ,
where we take G dist 1 (ω o ) out of the integral since it does not depend on ω m and we remove χ + (ω o • ω m ), which is redundant with the clamped dot product that already evaluates to 0 when ω o • ω m < 0. The masking function for the nonbackface-culled normals from outgoing direction ω o is then given by:

G dist 1 (ω o ) = cos θ o Ω ω o , ω m D(ω m ) dω m , (17)
and the masking function is:

G 1 (ω o , ω m ) = χ + (ω o • ω m ) cos θ o Ω ω o , ω m D(ω m ) dω m . ( 18
)
This is the integral form of the exact masking function under normal/masking independence presented by Ashikhmin et al. [START_REF] Michael Ashikmin | A microfacet-based brdf generator[END_REF]. They use this integral expression to precompute the masking function and store it in a look-up table, for rendering.

Smith's Masking Function By changing the integration domain from normal to slope space (we provide the detailed derivation in Appendix A) Equation ( 17) becomes:

G dist 1 (ω o , ω m ) = 1 1 + Λ(ω o ) ,
and thus Equation (18) can be rewritten:

G 1 (ω o , ω m ) = χ + (ω o • ω m ) 1 + Λ(ω o ) , (19)
where 1 1+Λ(ωo) is the generalized form of Smith's masking function [START_REF] Brown | Shadowing by non-gaussian random surfaces[END_REF][START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF], for which closed-form solutions are available for many stochastic surfaces, as shown in Section 5. Therefore, under the normal/masking independence, Smith's masking function is exact.

Properties Still, if we were to compare the analytical function with measured data, we would find that the predictions of the model are accurate but not exact. Indeed, Smith compared his formula to real-world measurements and discovered that it was a good approximation, but an approximation nonetheless. However, the approximation does not reside in his derivation because, within the framework of his model, his formula is exact. Instead, it resides in the description of real-world surfaces with statistical models (e.g. Gaussian statistics), and in the assumption of normal/masking independence.

The uncorrelated microsurface assumed by Smith's model is reminiscent of "metal flakes", which can be found in some metallic car paints [RMS + 08], but real-world continuous surfaces have wider autocorrelation functions. Bourlier et al. compared Smith's masking function to the numerically measured masking function on random rough surfaces with different autocorrelation functions (Gaussian and Lorentzian) [START_REF] Bourlier | Effect of correlation between shadowing and shadowed points on the wagner and smith monostatic one-dimensional shadowing functions[END_REF]. The conclusion of their investigation was that the error introduced by neglecting correlation on random surfaces is, on average, small and noticeable only at observation angles such as tan(θ)/α > 0.5, where σ 2 = α 2 2 is the slope variance. Smith's masking function tends to produce slight overestimations in this case. Given that Smith's masking function is overall accurate even on correlated surfaces and given that there is no analytical solution to the correlated masking function, it seems reasonable to stick to Smith's masking function in a computer graphics context. However, as pointed out by Ashikhmin et al., the effect of correlation on non-random surfaces with repetitive or structured patterns (e.g. fabric) can be of high importance and must be incorporated into dedicated models [APS00].

Smith's Averaged Masking Functions Smith derived the masking function averaged over different quantities of the microsurface, such as the heights and the normals [START_REF] Smith | Geometrical shadowing of a random rough surface[END_REF]. The masking function G 1 (ω o , ω m ) presented in Equation ( 19) is the form averaged over the heights of the microsurface and is the one that must be used in the BRDF. Indeed, since the heights are independent from what matters in the BRDF, we would just average over them. However, the normals are not all processed in the same way: backface-culled normals are not considered. In a BRDF model, only what is visible to the external viewer matters, because only radiance that can be measured by this viewer matters. If something exists on the surface but is not visible, then it won't be included in the BRDF. In a BRDF problem we are actually interested in the question: "What proportion of nonbackface-culled normals are masked? " So why did Smith derive a normal-averaged form of his masking function if it is not useful for BRDFs? He actually wanted to answer the question: "What proportion of normals are masked? " The answer to this second question is important when studying properties intrinsic to the surface in other physics problems, but not with BRDFs.

The V-Cavity Microsurface Profile

In this section, we discuss the masking model based on V-cavities [CT82, ON94], which is the most common alternative to the Smith masking function. Figure 6 illustrates the scattering model with V-cavity microsurfaces. Rather than modeling the scattering on one microsurface with a distribution of normals, this model computes the scattering on separate microsurfaces and averages their contributions. Each microsurface is composed of two normals ω m = (x m , y m , z m ) and ω m = (-x m , -y m , z m ) and the contribution of each microsurface is weighted by ω m , ω g D(ω m ) in the final BRDF.

A geometric demonstration is usually presented to derive the masking function of a V-cavity microsurface. We can derive the same result without going through trigonometric calculus by applying the conservation of the visible projected area like in Section 2.3. V-cavity microsurfaces have only two symmetric normals ω m and ω m . The distribution of normals of this microsurface is: We verify that the normalization is correct:

D(ω) = 1 2 δ ωm (ω) ω m • ω g + 1 2 δ ωm (ω) ω m • ω g . Inria
Ω ω, ω g D(ω)dω = Ω ω, ω g 1 2 δ ωm (ω) ω m • ω g + 1 2 δ ωm (ω) ω m • ω g dω = 1 2 ω m • ω g ω m • ω g + 1 2 ω m • ω g ω m • ω g = 1 2 + 1 2 = 1.
To derive the masking term, we use the conservation of the visible projected area presented in Equation (4):

cos θ o = Ω G 1 (ω o , ω) ω o , ω D(ω)dω = 1 2 G 1 (ω o , ω m ) ω o , ω m ω m • ω g + 1 2 G 1 (ω o , ω m ) ω o , ω m ω m • ω g .
There are two possible configurations as shown in Figure 7. In the first case the two normals are visible and there is no masking (G 1 (ω o , ω m ) = 1 and G 1 (ω o , ω m ) = 1). Otherwise, ω m is backface-culled (G 1 (ω o , ω m ) = 0) and we have:

cos θ o = 1 2 G 1 (ω o , ω m ) ω o , ω m ω m • ω g ,
whose solution is:

G 1 (ω o , ω m ) = 2 cos θ o (ω m • ω g ) ω o , ω m = 2 (ω m • ω g )(ω o • ω g ) ω o , ω m .
The result of these two configurations can be expressed in a single formula:

G 1 (ω o , ω m ) = min 1, 2 (ω m • ω g )(ω o • ω g ) ω o , ω m , (20)
which is the well-known V-cavity masking function used by Cook and Torrance [START_REF] Cook | A reflectance model for computer graphics[END_REF].

Figure 7: Masking on a V-cavity microsurface. Either one of the two normal is backface-culled and the other is partially masked (a) or the two normals are visible and the masking function evaluates to 1.

Validation We verify that this model satisfies Equation (8), i.e. the distribution of visible normals is normalized. We substitute G 1 given in Equation 20:

D ωo (ω m ) = min 1, 2 (ω m • ω g )(ω o • ω g ) ω o , ω m ω o , ω m D(ω m ) cos θ o .
The form is complicated to study because of the min(1, -) term. However, we will see that the main difference introduced by the V-cavity model happens near the silhouettes. Thus, to simplify the study and go straight to the point we will focus the derivation only on what happens at grazing angles, where θ o ≈ π 2 . Indeed, at grazing angles, we are always in configuration (a) from Figure 7, where one of the two normals is backface-culled. In this case, we can drop the min(1, -):

D ωo (ω m ) = 2 (ω m • ω g )(ω o • ω g ) ω o , ω m ω o , ω m D(ω m ) cos θ o = 2 χ + (ω o • ω m ) (ω m • ω g ) D(ω m ) dω m . (21)
Note that the clamped dot product ω o , ω m simplifies out but the heaviside χ + (ω o • ω m ) is left to make sure that backface-culled normals are still removed from the distribution. We validate this result by verifying that the distribution of visible normals is normalized. We compute:

Ω D ωo (ω m ) dω m = 2 Ω χ + (ω o • ω m ) (ω m • ω g ) D(ω m )dω m .
Since the outgoing direction is almost orthogonal, the heaviside function truncates the integral almost at the middle of the distribution. Also, a V-cavity surface implies that the distribution of normals is symmetrical, i.e. D(ω m ) = D(ω m ). This implies that the heaviside function cuts the distribution of normals into two equal parts and we get:

Ω χ + (ω o • ω m ) (ω m • ω g ) D(ω m ) dω m = 1 2 Ω (ω m • ω g ) D(ω m ) dω m = 1 2 ,

Inria

where we use the fact that Ω (ω m • ω g ) D(ω m ) dω m = 1, i.e. the distribution of normals is normalized. We get:

Ω D ωo (ω m ) dω m = 2 Ω χ + (ω o • ω m ) (ω m • ω g ) D(ω m ) dω m = 2 1 2 = 1.
This shows that the distribution of visible normals from Equation 21 is normalized for grazing angles of incidence. A more technical derivation can show that the distribution is normalized for any angle of incidence. Another way to validate this model is to use the Weak White Furnace Test. We evaluate Equation 15 by using G 1 from Equation 20. The result of the integral is always 1 and the model with V-cavities is thus mathematically well designed and energy conserving.

Properties Nevertheless, while the distribution of visible normals of V-cavities is mathematically well defined, it is not physically plausible and models a non-realistic surface profile at grazing angles of incidence.

There are two kind of normals: the ones that are backface-culled are removed by the heaviside term and the ones that are not backface-culled are weighted by (ω m • ω g ) D(ω m ). Note that the factor (ω m • ω g ) is the Jacobian of the projection of a microfacet onto the macrosurface, as shown in Table 2(a). Thus, the microfacets are weighted exactly as if they were projected onto the geometric surface before being projected onto the outgoing direction. As a result, we are simulating a geometrically flat microsurface: the microfacets can perturbate the reflection of light but they don't exist geometrically. This microsurface model is not realistic because it behaves more like a normal map than a displacement map, as shown in Figure 8.

This effect was expected: rather than simulating one microsurface, the V-cavity model simulates one microsurface per pair of normals and averages the results of the simulation. On one single microsurface, highly visible normals would occupy more projected area than less visible normals and thus have more important weights. However, this does not happen with V-cavities because different normals are simulated separately and are weighted by the distribution of normals. There is no view dependence in the weighting (except for the backface culling). This is why the V-cavity model poorly incorporates the effect of visibility and ends up simulating something close to a normal map.

The more the angle of incidence is grazing, the more the surface profile tends to exhibit this normal map behavior. The consequence for the BRDF is that the reflected lobes tend to be too low: on a real microsurface, normals oriented toward the outgoing direction are more weighted in the BRDF because their projected area is more important. Because of this, the reflected lobe tends to be shifted toward the outgoing direction, as shown in Figure 8. This shifting effect is not present with normal maps because the microfacets have no geometrical existence: they all have the same projected area.

Table 4 shows the reflected lobes of an isotropic Beckmann BRDF with the V-cavity and Smith masking-shadowing functions, and with measured data. We see that, with the Smith masking function, the reflected lobe is shifted toward the outgoing direction as the roughness increases. For very high roughness values, the lobe is even mainly backscattering. This effect, present in the measured data, was expected, because the normals oriented toward the outgoing direction are the most visible. However, this effect does not emerge with V-cavities.

Figure 8: (top) V-cavity surfaces exhibit a normal map behavior at grazing angles: non-backfaceculled normals have the same visibility as the geometric surface, as if they had no geometrical existence. (bottom) At grazing incidence, the lobe reflected from the V-cavity surface is too low compared to the lobe reflected by physical surfaces.

Summary

In this section, we have shown that:

• Smith's and the V-cavity masking functions are both exact but assume different microsurface profiles.

• Both satisfy the conservation of the projected area from Equation (4).

• Both are the normalization coefficient of the distribution of visible normals, Equation (8).

• Both satisfy the Weak White Furnace Test given by Equations ( 15) and ( 16).

Smith's Masking Function A typical belief is that: "Smith's masking function is a good approximation, because it depends on the distribution of normals."

We showed that this answer is correct but the reason invoked is wrong, by developing the following ideas:

• Choosing Smith's model implies making the choice of assuming a microsurface on which the orientation of visible normals is independent of the probability of masking.

• Under this assumption, the masking function is completely determined; its exact form can be derived and is the generalized form of Smith's masking function.

The point here is that the reason why one would choose Smith's masking function is not because it is a physically plausible approximation parametrized by the distribution of normals. The real reason to choose it is that Smith's formula is the exact masking function under the assumption of the chosen microsurface profile (i.e., normal/masking independence). The fact that it is physically plausible and is parametrized by the distribution of normals are not directly the reasons to choose it, but are some of the expected side effects of making the right choice. The V-Cavity Masking Function Another frequently asked question concerning the masking function is: "Is the V-cavity masking function wrong? "

The typical answer to this question is: "It should be wrong because it does not depend on the distribution of normals."

In this section, we answered this question by developing the following ideas:

• The V-cavity masking function per-normal does not depend on the distribution of normals.

• However, the average of the V-cavity masking function does depend on the distribution of normals. This is because the masking function and the normals are not assumed to be independent, contrary to Smith's model. The more the surface roughness increases, the more the average masking of the BRDF increases.

• The V-cavity masking function can be used with any kind of symmetric distribution of normals and guarantees correct normalization.

• However, the surface profile assumed by the V-cavity model has a response close to a normal map with flat microfacets at grazing angles of incidence. It is not physically realistic.

• The consequence is that at grazing angles and with high roughness, the BRDF reflected lobe is too low compared to what is expected from a realistic material.

There is no definitive answer to the question of choosing V-cavities or Smith. Both are mathematically well defined. V-cavities are cheaper and generic, they mathematically work with any kind of distribution of normals, but are less realistic. In contrast, the Smith-based model is physically accurate but requires specific derivations and sometimes expensive evaluations. The choice is thus a matter of tradeoff between realism and complexity.

Inria 5 Stretch Invariance of the Masking Function

In this section we investigate the invariance property of the masking function and of the slope distribution when the configuration is stretched. We use this knowledge to derive Smith's masking function for shape-invariant anisotropic distributions.

Masking Probability Invariance

Figure 9 shows the effect of stretching a 1D configuration with masking on a microsurface for a given outgoing direction. Stretching the configuration is like stretching the picture, i.e. one dimension is multiplied by a constant factor. This operation does not change the topology of the configuration: after stretching, occluded rays are still occluded and non-occluded rays are still non-occluded. This is a key property: the masking probability is invariant to configuration stretching, where all the slopes involved in the configuration are scaled at the same time. This includes the slopes of the microsurface and the slope associated with the outgoing direction. They are all scaled by the inverse of the stretching factor. The slope distribution width is thus also stretched by the inverse stretching factor.

Figure 9: Stretching a 1D configuration by a factor 2 does not change masking probability G, but all the slopes of the configuration are downscaled by a factor 1 2 . This includes the slopes of the microsurface as well as the slope associated with the outgoing direction.

The Distribution of Slopes

If the microsurface is a heightfield, the distribution of normals is constructed from the distribution P 22 (x m, y m) of the slopes of the microsurface. We denote:

m = (x m, y m) = - x m z m , - y m z m ,
the slopes associated to normal ω m = (x m , y m , z m ) and reciprocally:

ω m = (-x m, -y m, 1) x 2 m + y 2 m + 1 .
The distribution of slopes is necessarily normalized:

∞ -∞ ∞ -∞ P 22 (x m, y m) dx mdy m = 1,
and the distribution of normals is defined by:

D(ω m ) = P 22 (x m, y m) cos 4 θ m .
When the roughness parameters must be explicit, we use the notation D(ω m , α) and P 22 (x m, y m, α) for isotropic distributions and D(ω m , α x , α y ) and P 22 (x m, y m, α x , α y ) for anisotropic distributions.

Isotropic Shape Invariant Slope Distributions

Shape Invariance Several isotropic parametric slope distributions P 22 depend on a roughness parameter α, where changing α is equivalent to stretching the distribution without changing its shape. This is the case when the slope distribution depends only on the ratio tan θm α = √

x 2 m +y 2 m α between the slope amplitude tan θ m = x 2 m + y 2 m of a normal of angle θ m and roughness parameter α:

P 22 (x m, y m, α) = 1 α 2 f x 2 m + y 2 m α = 1 α 2 f tan θ m α , ( 22
)
where f is a 1D function that defines the shape of the distribution. These slope distributions are shape invariant, because distributions that exhibit this property always have the same shape f and are only stretched and scaled by the roughness parameter:

P 22 (x m, y m, α) = 1 λ 2 P 22 ( x m λ , y m λ , α λ
), for any λ > 0.

As shown in Figure 9, with isotropic shape-invariant slope distributions, stretching the configuration is equivalent to scaling the roughness parameters α and the slope of the outgoing vector by the same factor. It implies that the masking function depends only on the ratio a = 1 α tan θo , where 1 tan θo is the slope of the outgoing direction 1 . Beckmann and GGX distributions are shape invariant and this is why their associated functions Λ depend only on a.

Beckmann Distribution

P 22 (x m, y m) = 1 π α 2 exp - x 2 m + y 2 m α 2 , D(ω m ) = χ + (ω m • ω g ) πα 2 cos 4 θ m exp - tan 2 θ m α 2 , Λ(ω o ) = erf(a) -1 2 + 1 2 a √ π exp -a 2 .
1 For a given direction with angle θ, the slope of the direction is 1 tan θo and should not be mistaken for the slope tan θ of a microfacet orthogonal to this direction.

Inria

where a = 1 α tan θo . Walter et al. [START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF] propose an accurate rational approximation for G 1 (ω o ) = 1 1+Λ(ωo) , which we can use to approximate Λ(ω o ) (via Λ(ω o ) = 1-G1(ωo) G1(ωo) ):

Λ(ω o ) ≈ 1-1.259a+0.396a 2 3.535a+2.181a 2 if a < 1.6 0 otherwise.

GGX Distribution

P 22 (x m, y m) = 1 πα 2 1 + x 2 m +y 2 m α 2 2 , D(ω m ) = χ + (ω m • ω g ) πα 2 cos 4 θ m 1 + tan 2 θm α 2 2 , Λ(ω o ) = -1 + 1 + 1 a 2 2 .
where a = 1 α tan θo .

Shape variant distributions Note that not all distributions are shape invariant. For instance, the Phong distribution is not because it cannot be expressed in the form of Equation ( 22). As the roughness changes, the shape of the Phong distribution changes.

Anisotropic Shape Invariant Slope Distributions

Shape Invariance The same shape-invariant distributions can be anisotropic if the shape is stretched with direction dependent factors. The slopes are weighted separately in each direction and Equation ( 22) is replaced by:

P 22 (x m, y m, α x , α y ) = 1 α x α y f x 2 m α 2 x + y 2 m α y = 1 α x α y f tan θ m cos 2 φ m α 2 x + sin 2 φ m α 2 y , (23)
where (tan θ m cos φ m , tan θ m sin φ m ) = (x m, y m) are the slopes and α x and α y are the stretching coefficients of the distribution in the x-and y-axis respectively. The shape invariance property is written:

P 22 (x m, y m, α x , α y ) = 1 λ x λ y P 22 ( x m λ x , y m λ y , α x λ x , α y λ y ), for any λ x , λ y > 0.
Derivation of the Masking Function Figure 10 shows how isotropic shape-invariant distributions can be transformed into anisotropic distributions by stretching the surface. Reciprocally, any configuration with an anisotropic distribution can be transformed back to a configuration with an isotropic distribution. We use this property to derive the masking functions of anisotropic distributions. We start from a configuration with a shape-invariant anisotropic distribution with parameters α x and α y and a outgoing vector ω o = (x o , y o , z o ). By stretching the x-axis direction by a factor αx αy the surface roughness becomes:

α x = α x α y α x = α y , α y = α y .
The stretched surface is isotropic with roughness α y and the outgoing vector and its slope after stretching are:

ω o = ( α x α y x o , y o , z o ) = ( α x α y cos φ o sin θ o , sin φ o sin θ o , cos θ o ), 1 tan θ o = z o α 2 x α 2 y x 2 o + y 2 o = 1 α 2 x α 2 y cos 2 φ o + sin 2 φ o tan θ o .
The masking function of an isotropic distribution depends only on the ratio a = 1 α tan θo and since α = α y the ratio of the stretched surface is:

a = 1 α y tan θ o = 1 α y cos 2 φ o α 2 x α 2 y + sin 2 φ o tan θ o = 1 cos 2 φ o α 2 x + sin 2 φ o α 2 y tan θ o = 1 α o tan θ o ,
where

α o = cos 2 φ o α 2 x + sin 2 φ o α 2 y , (24)
is the roughness projected in the outgoing direction. This shows that masking functions associated to anisotropic shape-invariant slope distributions are the masking function of the isotropic distributions parametrized by the roughness of the anisotropic surface projected in the outgoing direction. We use this property to derive the masking functions for the anisotropic Beckmann and GGX distributions.

Anisotropic Beckmann Distribution

P 22 (x m, y m) = 1 π α x α y exp - x 2 m α 2 x - y 2 m α 2 y , D(ω m ) = χ + (ω m • ω g ) πα x α y cos 4 θ m exp -tan 2 θ m ( cos 2 φ m α 2 x + sin 2 φ m α 2 y ) , Λ(ω o ) = erf(a) -1 2 + 1 2 a √ π exp -a 2 .
Inria where a = 1 αo tan θo and α o is defined in Equation 24. The approximation of Λ for the isotropic Beckmann distribution can be used as well.

Anisotropic GGX Distribution

P 22 (x m, y m) = 1 πα x α y 1 + x 2 m α 2 x + y 2 m α 2 y 2 , D(ω m ) = χ + (ω m • ω g ) πα x α y cos 4 θ m 1 + tan 2 θ m ( cos 2 φm α 2 x + sin 2 φm α 2 y ) 2 , Λ(ω o ) = -1 + 1 + 1 a 2 2 .
where a = 1 αo tan θo and α o is defined in Equation 24.

Figure 10: Stretching a 2D configuration by a factor 2. The coordinates of the outgoing vector are stretched as well.

More Generalization

Arbitrary Shape-Invariant Distributions An important property of shape-invariant distributions is that all of the information required for the masking function is contained in the same 1D function Λ for any roughness or anisotropy. Thus, if Λ is available, it can be used for an entire class of parametric distributions with varying roughness and anisotropy. One can easily design one's own shape-invariant anisotropic distribution of normals by choosing an arbitrary 1D function f and set:

D(ω m ) = c α x α y cos θ 4 m f tan 2 θ m cos 2 φ m α 2 x + sin 2 φ m α 2 y .
where c would be the constant normalization coefficient of the distribution. The associated 1D function Λ( 1 αo tan θo ) can be numerically precomputed and tabulated or fitted with a rational polynomial, as Walter et al. did for the Beckmann distribution.

Non Axis-Aligned Stretching The stretching operation does not need to be axis-aligned. The general stretching in slope space can be redefined with a quadric. Let Q be a symmetric positive-definite matrix2 :

Q -1 = α 2 x r xy α x α y r xy α x α y α 2 y ,
and r xy is the correlation coefficient of the stretching in the x-and y-axis. The quadric Q defines a scalar product and a norm in the 2D Euclidean space of the slopes:

|| m|| = m, m = mT Q m,
where the 2D vector m = (x m, y m) = tan θ m (cos φ m , sin φ m ) is the slope associated to a normal ω m . The norm of the slope || m|| describes the stretching that occurs in slope space and is the argument of the distribution D. We gave the formulas for the norm and the projected roughness in the outgoing direction in the case where r xy = 0:

|| m|| 2 = tan θ m (cos φ m , sin φ m ) T Q tan θ m (sin φ m , cos φ m ) = tan 2 θ m cos 2 φ m α 2 x + sin 2 φ m α 2 y , α 2 o = cos 2 φ o α 2 x + sin 2 φ o α 2 y .
In the general case with correlation where r xy = 0 we have instead: Vertical Shearing and Non-Centered Distributions Figure 11 shows that the masking function is also invariant under vertical shearing. Applying a vertical shear on the configuration is equivalent to increasing all of the slopes of the configuration by a constant value. As before, this includes the slopes of the microsurface and the slope associated to the outgoing direction. We call the mesosurface the average slope (x m, ȳ m) of the microsurface:

|| m|| = tan θ m (cos φ m , sin φ m ) T Q tan θ m (sin φ m , cos φ m ) = tan 2 θ m cos 2 φ m α 2 y + sin 2 φ m α 2 x -2 cos φ m sin φ m r xy α x α y α 2 x α 2 y -r 2 xy α 2 x α 2 y , α 2 o = cos 2 φ o α 2 x + sin 2 φ o α 2 y + 2 cos φ o sin φ o r xy α x α y . For instance, in
(x m, ȳ m) = +∞ -∞ +∞ -∞ (x m, y m) P 22 (x m, y m) dx mdy m,
which is represented in blue in the figure. It corresponds to where the distribution of slopes is centered around. To account for non-centering, one has to include the offset in the computation of the argument of distribution D and of the factor a for the masking function:

|| m|| = (tan θ m (cos φ m , sin φ m ) -(x m, ȳ m)) T Q(tan θ m (cos φ m , sin φ m ) -(x m, ȳ m)) = (tan θ m cos φ m -x m) 2 α 2 y α 2 x α 2 y -r 2 xy α 2 x α 2 y + (tan θ m sin φ m -ȳ m) 2 α 2 x α 2 x α 2 y -r 2 xy α 2 x α 2 y -2 (tan θ m cos φ m -x m)(tan θ m sin φ m -ȳ m)r xy α x α y α 2 x α 2 y -r 2 xy α 2 x α 2 y , a = 1 tan θo -(cos φ o x m + sin φ o ȳ m) α o , α 2 o = cos 2 φ o α 2 x + sin 2 φ o α 2 y + 2 cos φ o sin φ o r xy α x α y .
Note that vertical shearing does not affect the projected roughness α 2 o and the normalization factor of the distribution. This is intuitive because stretching changes the shape of the distribution, and thus the roughness, while shearing offsets the distribution without changing its shape. It's tempting to think that because the roughness and normalization factor are invariant under shearing-which alters all the slopes, and hence the normal vectors-these might also be invariant under a rotation of the normals. They are not, because the mapping from normal vector to facet slope does not transform rotations of vectors to translations of slope-values.

Typically, the distribution of slopes is centered around 0. It means that the mesosurface is aligned with the macrosurface. However, this assumption is wrong when the macrogeometry is amplified with another high-frequency representation. The very purpose of bump maps, normal maps or displacement maps is to generate a mesonormal by perturbating the macronormal. For instance, in Olano and Baker's LEAN mapping [START_REF] Olano | Lean mapping[END_REF], a multi-scale non-centered Gaussian slope distribution is used. In this case, the distribution of slopes is almost never centered around 0. If the rendering is physically based, one has to use a masking function extended to non-centered distributions to make sure that everything is still well-defined. Fortunately, the vertical shear invariance shows that the masking function of a non-centered microsurface is the same as the masking function of a centered microsurface with offsetted slopes. This property was used in LEADR mapping [DHI + 13] where microfacet theory is extended to non-centered distributions.

Another important thing for non-centered distributions is that the visible projected area has to be computed from the mesonormal. The factor cos θ o in the BRDF must be replaced by the projected area of the mesosurface, which is ω m•ωo ω m•ωg , where ω n is the normal of the mesosurface. In the case where the mesosurface is the macrosurface we have ω m = ω g and we get back to

ω m•ωo ω m •ωg = cos θo
1 , so this is consistent. More details are available in the LEADR mapping paper.

Figure 11: Vertical shearing of a 1D configuration. It does not change masking probability G 1 , but all the slopes of the configuration are increased by a constant factor x m. This includes the slopes of the microsurface as well as the slope associated with the outgoing direction. The slope distribution is shifted by an offset x m and is no longer centered around 0.

Inria 6 Smith's Joint Masking-Shadowing Function

In this section, we review the use of the Smith masking function with the light direction (i.e., as a shadowing function) and its joint form with the masking function. We recall four different forms of the joint masking-shadowing function. Each of these use the function Λ defined in Section 5evaluated for the outgoing (Λ(ω o )) and for the incident (Λ(ω i )) directions-and combine them in different ways, producing different properties as a result.

Separable Masking and Shadowing

The most simple and widely used variant of the maskingshadowing function is the separable form popularized by Walter et al. [START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF]. In this instance, masking and shadowing are supposed to be independent, and are computed separately and multiplied together:

G 2 (ω o , ω i , ω m ) = G 1 (ω o , ω m ) G 1 (ω i , ω m ) = χ + (ω o • ω m ) 1 + Λ(ω o ) χ + (ω i • ω m ) 1 + Λ(ω i ) . ( 25
)
This form does not model correlations between masking and shadowing, and therefore always overestimates shadowing since some correlation always exists, as explained in the next section.

Height-Correlated Masking and Shadowing A more accurate form of the masking-shadowing function models the correlation between masking and shadowing due to the height of the microsurface [START_REF] Ross | Detailed analytical approach to the gaussian surface bidirectional reflectance distribution function specular component applied to the sea surface[END_REF]. Intuitively, the more a microfacet is elevated within the microsurface, the more the probabilities of being visible for the outgoing direction (unmasked) and for the incident direction (unshadowed) increase at the same time. Thus, masking and shadowing are correlated because of the elevation of the microfacets. This correlation is accounted for in the following form of the joint masking-shadowing function:

G 2 (ω o , ω i , ω m ) = χ + (ω o • ω m ) χ + (ω i • ω m ) 1 + Λ(ω o ) + Λ(ω i ) . ( 26
)
This form is correct when the outgoing and incident directions are far away, but overestimates shadowing when the directions are close. We suggest to use Equation (26) in practice, because it is more accurate than the separable from of Equation (25) whilst having an equivalent computational complexity. We recall the derivation of this form in Appendix B.

Direction-Correlated Masking and Shadowing Masking and shadowing are also strongly correlated when the outgoing and incident directions are close. Typically, when ω o = ω i , masking and shadowing are totally correlated because microfacets visible from direction ω o are also visible from direction ω i . In this case, the shadowing should be removed from the BRDF because shadowed microfacets are not visible from direction ω i , and thus they are also not visible from ω o . This is known as the "hotspot effect": when the view and light directions are parallel, shadows disappear. This does not mean that shadows no longer exist, only that they are not visible from this specific view direction. Since the BRDF models the radiance measured in the outgoing direction, if shadowing exists on the surface but is not visible then it should not be part of the BRDF. On a surface, full correlation is reached when ω o and ω i have the same azimuthal angle. In this case, the masking-shadowing function can be replaced by the minimum of masking and shadowing. Ashikhmin et al. [START_REF] Michael Ashikmin | A microfacet-based brdf generator[END_REF] account for directional correlation by blending the separable form of Equation (25) with the case where both directions are fully correlated:

G 2 (ω o , ω i , ω m ) = λ(φ) G 1 (ω o , ω m ) G 1 (ω i , ω m ) + (1 -λ(φ)) min(G 1 (ω o , ω m ), G 1 (ω i , ω m )). ( 27
)
where λ(φ) is an empirical factor similar to Ginneken et al.'s, which is presented next. Because the authors do not have Smith's analytical expression for function Λ, they have to compute masking and shadowing separately. This is why they have to blend the separable and the fully uncorrelated forms and cannot incorporate height correlation into their model.

Height-Direction-Correlated Masking and Shadowing

The directional correlation between masking and shadowing can be modeled by adding a factor to the shadowing term in the height-correlated form:

G 2 (ω o , ω i , ω m ) = χ + (ω o • ω m ) χ + (ω i • ω m ) 1 + max (Λ(ω o ), Λ(ω i )) + λ(ω o , ω i ) min (Λ(ω o ), Λ(ω i )) . (28)
Here, masking and shadowing are fully correlated when the outgoing and incident directions are parallel and λ = 0. The correlation decreases as the angle between the directions increases, and as λ increases up to 1. In this case, masking and shadowing are no longer directionally correlated and the formula returns to the elevation-correlated form. Ginneken et al. [START_REF] Bram Van Ginneken | Diffuse and specular reflectance from rough surfaces[END_REF] proposed an empirical factor λ = 4.41 φ 4.41φ+1 -which depends on φ, the azimuthal angle difference between ω o and ω i -and is independent of the surface roughness. Heitz et al. recently presented a more in-depth study of this problem and an analytic approximation for λ(ω o , ω i ), which incorporates surface roughness when D is a Beckmann distribution [START_REF] Heitz | Correlation effect between transmitter and receiver azimuthal directions on the illumination function from a random rough surface[END_REF]. The result was given for isotropic Beckmann distributions only, but the stretch invariance presented in Section 5 can be used to easily generalize this result to anisotropic Beckmann. This form models exactly the correlation of masking and shadowing and is thus more accurate than the forms presented in Equations ( 25 In this section, we discuss several ideas resulting from the derivations presented in this paper, and provide some thoughts for possible future work.

Deriving the Smith Masking Function for Other Commonly Used Models We have seen that closed analytical forms of Smith's masking function can be derived for the Beckmann and GGX distributions, as reviewed in Section 2. However, the masking function does not always integrate analytically for other commonly used distributions of normals.

An important example is the Phong distribution. Walter et al. proposed to use Smith's masking function for the Beckmann distribution since they have a similar appearance for small roughnesses. However, the more that the roughness increases, the more the error becomes significant [START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF]. It would be interesting to derive an analytical approximation for function Λ dedicated to the Phong distribution. Walter et al. proposed such an approximation for Beckmann because it is cheaper than the analytical solution. It is easy to do so for Beckmann because the information contained in the distribution is only 1D, because Beckmann is shape invariant, as discussed in Section 5. Indeed, the Beckmann distribution depends only on the ratio a = tan(θ)/α. All of the information required for the distribution, and thus for the masking function, depends only on variable a. This is why the function Λ used in masking can be encoded as a 1D function of variable a, which is efficiently represented as a rational polynomial for the Beckmann distribution. Doing the same for the Phong distribution is less straightforward because it cannot be represented as a 1D function of a, because it is not shape invariant. However, it is certainly possible to merge θ and α into another intermediate quantity that the Phong Λ function would be a 1D function of, or find an accurate 2D fit instead.

Another example is the generalization of GGX distribution called GTR [START_REF] Burley | Physically-based shading at disney[END_REF], whose masking function has yet to be found.

Correlation of Masking-Shadowing

As we have seen in Section 6, multiplying masking and shadowing together is a very rough approximation because these effects can be correlated. Deriving accurate and practical forms of the correlated masking-shadowing function for arbitrary distributions of normals is an open problem.

Multiple Scattering Modeling multiple scattering is one possible way to introduce effects that are poorly represented by our common BRDF model. For instance, Beckmann, Phong and even GGX are known to have overly short "tails" compared to measured materials [START_REF] Burley | Physically-based shading at disney[END_REF]. The first reflex in the CG community is to keep the standard BRDF formulation and tweak the distribution of normals. For instance, Bagher et al. [START_REF] Bagher | Accurate fitting of measured reflectances using a shifted gamma micro-facet distribution[END_REF] use a shifted Gamma distribution to fit measured materials. This distribution is complicated to compute and to integrate, and furthermore, they have to tweak the Fresnel term to make their model fit the data. In the end, their model performs well as a fitting tool, but it no longer makes physical sense. In the same way, Burley [START_REF] Burley | Physically-based shading at disney[END_REF] generalizes GGX to GTR to create a BRDF with a longer tail, in order to more accurately represent measured materials. But the masking function is not available for GTR, so instead he uses a tweaked masking function, violating the fundamental link with the distribution of normals. It seems that we have almost reached the limit of what is feasible with this model. Yet, in the race for physical accuracy we keep pushing it further, sometimes even at the cost of violating the model's physical basis, which is counterproductive.

Rather than continuing to invent more complicated ways to parameterize the model, we should ask ourselves whether certain effects present in measured data are simply missing from the model, and therefore look to extend it instead. Modeling multiple scattering seems like a good candidate here, and in fact it has already been investigated in the physics literature [START_REF] Bourlier | Multiple scattering in the high-frequency limit with second-order shadowing function from 2d anisotropic rough dielectric surfaces[END_REF]. However, these models are quite complicated, because the physics community aims for accuracy rather than for ease of implementation. A first attempt to model it in a simple and practical way for computer graphics applications would be to combine the knowledge of energy conservation and empirical observations. In Section 3.2, we showed that shadowing is introduced in common microfacet BRDFs because they only model the first scattering event. An interesting future research avenue would be to introduce a BRDF model with multiple scattering:

ρ(ω o , ω i ) = ρ 1 (ω o , ω i ) + ρ 2 + (ω o , ω i ),
where ρ 1 (ω o , ω i ) would be the usual BRDF term modeling the first scattering that incorporates shadowing, and ρ 2 + (ω o , ω i ) would be a new multiple scattering term. We know that a multiple scattering BRDF model passes the White Furnace Test (when Fresnel is set to 1):

Ω ρ(ω o , ω i ) |ω g • ω i | dω i = Ω ρ 1 (ω o , ω i ) |ω g • ω i | dω i + Ω ρ 2 + (ω o , ω i ) |ω g • ω i | dω i = 1,
and that the energy present in the multiple scattering term would be completely determined by the energy loss due to shadowing in the first scattering term:

E 2 + = Ω ρ 2 + (ω o , ω i ) |ω g • ω i | dω i = 1 - Ω ρ 1 (ω o , ω i ) |ω g • ω i | dω i .
The shape of ρ 2 + could be investigated, for instance, by computing Monte-Carlo simulations on rough surface samples. If its shape turns out to be simple, then as a first approximation we could model ρ 2 + with an analytical function (e.g. like a single lobe) of norm E 2 + . When Fresnel is not 1 (when the surface transmits) then E 2 + should depend on F as well. As a first approximation, it could be multiplied by the average visible value of Fresnel, which could be precomputed via:

Fωo = Ω F (ω o , ω m ) D ωo (ω m ) dω m ,
and stored in a look-up table. Note that multiplying by Fωo would rescale the energy present in E 2 + according to the ratio of rays transmitted after the first bounce only. Perhaps the average Fresnel value after multiple bounces could be precomputed as well. In general, since multiple scattering tends to smooth out functions, one can reasonably expect it to be efficiently represented and stored with simple analytical functions or small precomputed look-up textures.

Conclusion

In this document, we recalled how the masking function is linked to the distribution of normals by the visible projected area. By using this knowledge and the usual normal/masking independence assumption, we have shown that the Smith masking function is the only valid one. We have shown that the masking function is stretch invariant and how this property can be used to generalize known results to anisotropic distributions of normals. Upon that, we defined the distribution of visible normals, which we used to derive the common form of the BRDF, emphasizing the link with normalization and energy conservation. During this derivation, we introduced shadowing and we reviewed different shadowing models. We have shown that shadowing has to be part of the common form of the BRDF model, which only incorporates the first scattering event that occurs on the microsurface. We introduced the Weak White Furnace Test, which can be used to verify that BRDFs of this kind are well defined. We reviewed the V-cavity model and we showed why it is mathematically well defined but not realistic.

In the last section, we discussed the limitations of the BRDF model from the 70's that the graphics community is still using today. Finally, we suggested that by extending the model, it should be possible to represent more effects present in measured materials in a simple and practical way instead of continuing to explore its parametrization by introducing new distributions of normals with growing complexity and less practicability.

A Derivation of the Masking Function

In this section, we derive where [-∞, +∞] 2 is the cartesian 2D space where the slopes are defined. Since ω g = (0, 0, 1), we get:

G dist 1 (ω o ) (denoted G dist
ω g • ω m ( m) = 1 x 2 m + y 2 m + 1 ,
The clamped dot product can be expanded as:

Inria

Without loss of generality, we can assume that the view direction is aligned to the x-axis (i.e., ω o = (sin θ 0 , 0, cos θ o )): By dividing by sin θ o on both sides, we get:

cot θ o = G dist 1 cot θo -∞ (-x m + cot θ o ) P 2-(x m) dx m.
Since microfacet distributions are centered, the average slope in any direction is zero ( +∞ -∞ P 2-(x m) dx m = 0) and we can introduce this term in the equation: By dividing by G dist 1 on each side, we get:

cot θ o = G dist 1 +∞ -∞ x m P 2-(x m) dx m + G dist
(1 -G dist 1 ) G dist 1 = 1 cot θ o ∞ cot θo (x m -cot θ o ) P 2-(x m) dx m,
which leads to the final form:

G dist 1 (ω o ) = 1 1 + Λ(ω o )
,

where function Λ is defined by:

Λ(ω o ) = 1 cot θ o ∞ cot θo (x m -cot θ o ) P 2-(x m) dx m.
Our derivation, based on the projected area, has lead us to the generalized form of Smith's masking term [START_REF] Brown | Shadowing by non-gaussian random surfaces[END_REF][START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF].

Inria

B Derivation of the Height-Correlated Masking and Shadowing Function

In this section, we recall the derivation of the height-correlated form of the joint maskingshadowing function [RDP05, HBP13, DHI + 13] presented in Equation (26):

G 2 (ω o , ω i , ω m ) = χ + (ω o • ω m ) χ + (ω i • ω m ) 1 + Λ(ω o ) + Λ(ω i ) .
The microsurface is defined by the distribution of normals D(ω m ), and the associated slope distribution is P 22 ( m) as presented in Appendix A. We introduce P 1 (h), the height distribution of the microsurface. Note that the slopes of the microsurface are simply the gradients of the heights: m = ∇h. Smith's derivation [START_REF] Smith | Geometrical shadowing of a random rough surface[END_REF][START_REF] Walter | Microfacet models for refraction through rough surfaces[END_REF] gives the probability that a point at height h with nonbackface-culled normal ω m is visible from direction ω o :

G 1 (ω o , ω m , h) = G local 1 (ω o , ω m ) G dist 1 (ω o , h),
where the local and distant masking functions, presented in Section 2.4, are given by:

G local 1 (ω o , ω m ) = χ + (ω o • ω m ), G dist 1 (ω o , h) = h -∞ P 1 (h ) dh Λ(ωo)
.

The height-averaged form is given by:

G 1 (ω o , ω m ) = G local 1 (ω o , ω m ) +∞ -∞
G dist 1 (ω o , h) P 1 (h) dh

= χ + (ω o • ω m ) +∞ -∞ h -∞ P 1 (h ) dh Λ(ωo) P 1 (h) dh = χ + (ω o • ω m ) 1 + Λ(ω o ) .
which is Smith's masking function from Equation (19). Now, if we suppose that there is no directional correlation for masking from directions ω o and ω i , then the probability that a point at height h is visible from both directions is just the product of the probabilities:

G 2 (ω o , ω i , ω m , h) = G 1 (ω o , ω m , h) G 1 (ω i , ω m , h) = G local 1 (ω o , ω m ) G dist 1 (ω o , h) G local 1 (ω i , ω m ) G dist 1 (ω i , h) = χ + (ω o • ω m ) h -∞ P 1 (h ) dh Λ(ωo) χ + (ω i • ω m ) h -∞ P 1 (h ) dh Λ(ωi) = χ + (ω o • ω m ) χ + (ω i • ω m ) h -∞ P 1 (h ) dh Λ(ωo)+Λ(ωi) , RR n°8468
and the height-averaged form is given by:

G 2 (ω o , ω i , ω m ) = +∞ -∞ G 2 (ω o , ω i , ω m ) P 1 (h) dh = +∞ -∞ χ + (ω o • ω m ) χ + (ω i • ω m ) h -∞
P 1 (h ) dh Λ(ωo)+Λ(ωi)

P 1 (h) dh

= χ + (ω o • ω m ) χ + (ω i • ω m ) +∞ -∞ h -∞ P 1 (h ) dh Λ(ωo)+Λ(ωi) P 1 (h) dh = χ + (ω o • ω m ) χ + (ω i • ω m ) 1 + Λ(ω o ) + Λ(ω i ) ,
which is the height-correlated masking-shadowing function presented in Equation (26).

Inria

Figure 1 :

 1 Figure1: The radiance going out from a surface is the average of the radiances going out from each point of the surface weighted by their projected-area fractions towards the outgoing direction.

Figure 2 :

 2 Figure 2: The geometric surface and the microsurface.

Figure 3 :

 3 Figure 3: Microsurfaces with the same distribution of normals but with different profiles result in different BRDFs.

Figure 4 :

 4 Figure 4: The distribution of microsurface normals (ω m • ω g ) D(ω m ) is an intrinsic surface property, while the distribution of visible normals D ωo (ω m ) is view-dependent.

Inria

  (a) Casting rays onto the microsurface (b) Without Fresnel and shadowing, the rays are always reflected somewhere and their energy does not change.

Figure 5 :

 5 Figure 5: Microsurfaces and their autocorrelation functions. (left) A real-world continuous microsurface with large autocorrelation distance. (right) A uncorrelated surface where each microfacet is not correlated to its neighborhood, as modeled Smith's model.

Figure 6 :

 6 Figure 6: The V-cavity scattering model. Instead of modeling the scattering on one microsurface, the model computes the scattering on separate microsurfaces and blends the results.

Inria

  Table 4: (left and middle) The reflected lobe of the BRDF with an isotropic Beckmann distribution and different masking functions at grazing incidence (θ o = 1.5). (right) Reference computed with Monte Carlo raytracing on a procedural surface.

  LEADR mapping, a correlated Beckmann distribution is used [DHI + 13]. Note that setting the correlation coefficient r xy ∈ [-1, 1] to non-zero values affects the constant normalization factor of distribution D.

  ), (26), and (27). The derivation of practical forms for λ and generalization non-Gaussian distributions are open problems. Inria 7 Discussion and Future Work

1

  for convenience) starting from Equation (17):cos θ o = G dist 1 Ω ω o , ω m D(ω m ) dω m .Slope/Normal Transformations The most complicated step consists of computing the integral, which is defined in the space of the normals. It is more convenient to solve this integral in slope space. We recall that the surface slope associated with a normal ω m = (x m , y m , z m ) is defined by:m(ω m ) = (x m, y m) = (-x m /z m , -y m /z m ),and reciprocally:ω m ( m) = (x m , y m , z m ) = 1 x 2 m + y 2 m + 1 (-x m, -y m, 1),and that the slope distribution P 22 is linked to the distribution of normals by the relationship:3 P 22 ( m) d m = (ω m • ω g ) D(ω m ) dω m .By using this change of variable in Equation (17), we write: Ω ω o , ω m D(ω m ) dω m = o , ω m ( m) ω g • ω m ( m) P 22 ( m) d m,

ω,χ3

  o , ω m ( m) = χ + (-x o x m -y o y m + z o ) (-x o x m -y o y m + z o )and so the integral becomes:Ω ω o , ω m D(ω m ) dω m + (-x o x m -y o y m + z o ) (-x o x m -y o y m + z o ) P 22 (x m,y m) dx mdy m. The Jacobian of the normal to slope transformation is ∂ωm ∂ m = |ωm • ωg| 3 and we use it to derive the slope distribution P 22 ( m) = |ωm • ωg| 4 D(ωm).

Ωχ

  ω o , ω m D(ω m ) dω m + (-sin θ o x m + cos θ o ) (-sin θ o x m + cos θ o ) P 22 (x m, y m) dx mdy m = +∞ -∞ χ + (-sin θ o x m + cos θ o ) (-sin θ o x m + cos θ o ) +∞ -∞ P 22 (x m, y m) dy m dx m = +∞ -∞ χ + (-sin θ o x m + cos θ o ) (-sin θ o x m + cos θ o ) P 2-(x m) dx m, where P 2-(x m) = +∞ -∞ P 22 (x m, y m)dy m is the 1D slope distribution in the view direction (aligned with the x-axis). Since:-sin θ o x m + cos θ o > 0 ⇒ x m < cot θ o ,we can drop the Heaviside function by changing the integration domain:+∞ -∞ χ + (-sin θ o x m + cos θ o ) (-sin θ o x m + cos θ o ) P 2-(x m) dx m = cot θo -∞ (-sin θ o x m + cos θ o ) P 2-(x m) dx m.Now we can return to Equation (17): cos θ o = G dist 1 cot θo -∞ (-sin θ o x m + cos θ o ) P 2-(x m) dx m.

  m + cot θ o ) P 2-(x m) dx m,and by using cotθ o = (1 -G dist 1 ) cot θ o + G dist 1 cot θ o : (1 -G dist 1 ) cot θ o + G dist 1 cot θ o = G dist 1 +∞ -∞ x m P 2-(x m) dx m + G dist m + cot θ o ) P 2-(x m) dx m (1 -G dist 1 ) cot θ o = G dist 1 +∞ -∞ x m P 2-(x m) dx m + G dist 1 cot θo -∞ (-x m + cot θ o ) P 2-(x m) dx m -G dist 1 cot θ o , RR n°8468and since P 2-integrates to 1 we have G dist1 cot θ o = G dist 1 +∞ -∞ cot θ o P 2-(x m) dx m: (1 -G dist 1 ) cot θ o = G dist 1 +∞ -∞ x m P 2-(x m) dx m + G dist m + cot θ o ) P 2-(x m) dx m θ o P 2-(x m) dx m m P 2-(x m) dx m -cot θo -∞ x m P 2-(x m) dx m θ o P 2-(x m) dx m -+∞ -∞ cot θ o P 2-(x m) dx m = G dist 1 +∞ cot θo x m P 2-(x m) dx m -G dist 1 +∞ cot θo cot θ o P 2-(x m) dx m = G dist 1 ∞ cot θo (x m -cot θ o ) P 2-(x m) dx m.

Table 2

 2

emphasizes a fundamental property of microfacet theory: the visible projected area of the microsurface from Equation (3) is exactly the projected area of the geometric surface given in Equation (2). This equivalence imposes a constraint on the masking function, which is formalized by the following equation:

  Table 3(d)). Since the BRDF model derived here only accounts for the first bounce on the surface, rays involving multiple bounces (shown in black in Table 3(c)) have to be removed from the model, which is achieved by introducing a shadowing function. We replace the masking function G 1 by a masking-shadowing function G 2 :

RR n°8468

In the specific case of the Beckmann distribution, Σ = 1 2 Q -1 is the covariance matrix of the Gaussian slope distribution.Inria

Inria

Acknowledgements

I would like to thank Sébastien Lagarde who encouraged me to write this report and gave the first feedback, Stephen Hill and Naty Hoffman for their numerous advices and corrections, and Jonathan Dupuy for our endless discussions about microfacet theory.

C MATLAB Code for the Weak White Furnace Test

In this section, we provide code to numerically compute the integral in Equation (15):

with Beckmann and GGX distributions and their associated Smith masking functions. § ¤ W arning! The values dtheta and dphi used to discretize the BRDF in the numerical integration are hardcoded. In practice, setting them to 0.05 works well for alpha > 0.2. If alpha is smaller than 0.2 then dtheta and dphi must be set to smaller values as well, in order to correctly capture the sharp BRDF lobe.

Inria

RESEARCH CENTRE GRENOBLE -RHÔNE-ALPES