HAL Id: hal-00996995
https://inria.hal.science/hal-00996995v1
Submitted on 27 May 2014 (v1), last revised 16 Jun 2014 (v2)
HAL is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entic research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.
L’archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diusion de documents
scientiques de niveau recherche, publiés ou non,
émanant des établissements d’enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.
Importance Sampling Microfacet-Based BSDFs using
the Distribution of Visible Normals
Eric Heitz, Eugene d’Eon
To cite this version:
Eric Heitz, Eugene d’Eon. Importance Sampling Microfacet-Based BSDFs using the Distribution of
Visible Normals. Computer Graphics Forum, 2014. �hal-00996995v1�
Eurographics Symposium on Rendering 2014
Wojciech Jarosz and Pieter Peers
(Guest Editors)
Volume 33 (2014), Number 4
Importance Sampling Microfacet-Based BSDFs using the
Distribution of Visible Normals
E. Heitz
1
and E. d’Eon
2
1
INRIA ; CNRS ; Univ. Grenoble Alpes
2
Jig Lab, Wellington, New Zealand
Previous: BSDF Importance sampling using the
distribution of normals. 64 spp (10.0s)
Our: BSDF Importance sampling using the
distribution of visible normals. 58 spp (10.4s)
Figure 1: A dielectric glass plate (n = 1.5) with anisotropic GGX roughness (α
x
= 0.05, α
y
= 0.4) on all faces (with the Smith
masking function). For a similar sample budget and the same render time, our method (right) significantly reduces the variance
and converges faster than the common technique used in previous work (left).
Abstract
We present a new approach to microfacet-based BSDF importance sampling. Previously proposed sampling
schemes for popular analytic BSDFs typically begin by choosing a microfacet normal at random in a way that is
independent of direction of incident light. To sample the full BSDF using these normals requires arbitrarily large
sample weights leading to possible fireflies. Additionally, at grazing angles nearly half of the sampled normals
face away from the incident ray and must be rejected, making the sampling scheme inefficient. Instead, we show
how to use the distribution of visible normals directly to generate samples, where normals are weighted by their
projection factor toward the incident direction. In this way, no backfacing normals are sampled and the sample
weights contain only the shadowing factor of outgoing rays (and additionally a Fresnel term for conductors). Ar-
bitrarily large sample weights are avoided and variance is reduced. Since the BSDF depends on the microsurface
model, we describe our sampling algorithm for two models: the V-cavity and the Smith models. We demonstrate
results for both isotropic and anisotropic rough conductors and dielectrics with Beckmann and GGX distributions.
Categories and Subject Descriptors (according to ACM CCS): I.3.7 [Computer Graphics]: Three-Dimensional
Graphics and Realism—Keywords: Microfacet BSDF, Importance Sampling
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John
Wiley & Sons Ltd. Published by John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
1. Introduction
Rendering realistic surfaces requires the use of complex ma-
terial models. The most common way to define surface re-
flectance is the Bidirectional Scattering Distribution Func-
tions (BSDF), which incorporates light transports at a sur-
face’s interface such as reflection, described by a Bidi-
rectionnal Reflectance Distribution Functions (BRDF), or
transmission, described by a Bidirectional Transmittance
Distribution Functions (BTDF). Microfacet theory is the
most common theoretical framework for deriving analytic
physically-based BSDFs for rough surfaces. For Monte
Carlo rendering algorithms to make images efficiently using
BSDFs, an efficient importance sampling must be provided.
In this paper we present a new strategy for deriving impor-
tance sampling for analytic microfacet BSDFs. In constrast
to previous approaches, we exploit the structure of the mi-
crofacet theory to directly sample from the distribution of
visible normals, which produces higher quality and lower
variance samples in comparison to previous approaches.
A key element of our approach is to move away from nor-
mal distributions directly and use, instead, the distribution
of slopes for the microsurface. In slope space, we note two
key invariance relationships that produce an optimal sam-
pling strategy for any surface roughness or anisotropy, pro-
vided the optimal strategy for an isotropic surface with unit
roughness is known.
In Section
2, we review the microfacet-based BSDF
model and we explain why the common associated impor-
tance sampling scheme is not optimal. In Section 3, we show
that importance sampling the BSDF with the distribution of
visible normals makes a better use of the sampling space
and produces sample weights in [0,1]. This method does
not create firefly artifacts and leads to a significative vari-
ance reduction (Figure
2). To make this practical, in Sec-
tion 4, we show how to importance sample the distribution of
visible normals analytically with the V-cavity microsurface
model. In Section 5, we show how to importance sample the
distribution of visible normals with the Smith microsurface
model. We propose analytic sampling procedures for Beck-
mann and GGX distributions in the associated supplemen-
tal material. For other distributions, if an analytic sampling
procedure is not available we propose to use precomputed
data. Thanks to the shape invariance property of the dis-
tribution of visible slopes, we can do the precomputations
for only one BSDF with roughness α = 1 and we use the
same data with arbitrary roughness (α 6= 1) and anisotropy
(α
x
6= α
y
). In this way, we importance sample an entire class
of anisotropic parametric BSDFs with a small amount of pre-
computed data.
2. Background and Previous Work
2.1. Microfacet Theory
Microfacet theory was originally developed in the early work
of Torrance et al. [
TS67, CT82]. Several alternative models
previous
our
Figure 2: An isotropic rough conductor with GGX distribu-
tion (α = 0.05) and the Smith masking function (64 samples
per pixel).
or approximations are built on top of this theory [
War92,
vGSK98, AS00, KSK01]. This paper is built on the top of
two major previous works:
The extension of microfacet theory to transmittance by
Stam [
Sta01]. Closely related, Walter et al. [WMLT07]
describe BSDF importance sample strategies for different
distribution of normals.
Heitz’ investigation of the properties of the masking-
shadowing function in microfacet-based BRDFs [Hei14].
He shows how the masking function is related to the mi-
crosurface model and to the correct normalization of the
BRDF.
In the following, we review microfacet theory as presented
in these two previous works.
Figure 3: The physically-based BSDF model is constructed
by applying the operators reflect and transmit on the distri-
bution of visible normals. The ratio of reflection and trans-
mission is given by the Fresnel term F.
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
ω
g
= (0,0,1) geometric normal
ω
m
= (x
m
,y
m
,z
m
) microfacet normal
ω
i
= (x
i
,y
i
,z
i
) incident direction
(ω
i
·ω
g
> 0)
ω
o
= (x
o
,y
o
,z
o
) outgoing direction
D(ω
m
) distribution of normals
D
ω
i
(ω
m
)
distribution of visible normals
G
1
(ω
i
,ω
m
) masking function
G
2
(ω
i
,ω
o
,ω
m
) masking-shadowing function
ω
1
·ω
2
dot product
|ω
1
·ω
2
| absolute value of the dot product
hω
1
,ω
2
i clamped dot product
χ
+
(a)
Heaviside function:
1 if a > 0 and 0 if a 0
Table 1: Notation.
The Distribution of Normals D describes the statistical
distribution of the normals ω
m
of which the microsurface
is made. The area of the microsurface projected onto the ge-
ometric normal ω
g
is the unit area of the geometric surface:
Z
(ω
m
·ω
g
)D(ω
m
)dω
m
= 1. (1)
Parametric models typically specify roughness parameters
α
x
and α
y
in two orthogonal tangent directions (α
x
= α
y
for isotropic BSDFs). When these parameters need to be in-
cluded explicitly we write D(ω
m
,α
x
,α
y
) instead of D(ω
m
).
The Distribution of Visible Normals D
ω
i
describes the
statistical distribution of normals ω
m
visible from the inci-
dent direction
ω
i
and is defined by
D
ω
i
(ω
m
) =
G
1
(ω
i
,ω
m
)|ω
i
·ω
m
|D(ω
m
)
|ω
i
·ω
g
|
, (2)
where the term |ω
m
·ω
i
| is the projected area of the normal
ω
m
in direction ω
i
, |ω
i
·ω
g
| is the projected area of the ge-
ometric surface in direction ω
i
, and G
1
is the masking func-
tion. The relation between D and D
ω
i
is illustrated in Fig-
ure
3. Heitz [Hei14] shows that in a mathematically well-
defined BSDF model, the masking function G
1
should be
such that the distribution is normalized:
Z
D
ω
i
(ω
m
)dω
m
= 1.
Our approach is to use the knowledge of the BSDF model to
improve the sampling strategy. We can do it only for math-
ematically well-defined models. Two common microsurface
models have masking functions G
1
that satisfy this criteria:
the V-cavity and the Smith models.
To ease the notation, we assume that the incident direction ω
i
is
located in the upper part of the hemisphere, i.e. ω
i
· ω
g
> 0.
The V-cavity Microsurface Model was introduced by Tor-
rance et al. [TS67, CT82]. It assumes a continuous distribu-
tion of separate microsurfaces rather than just one micro-
surface [Hei14]. Each microsurface is composed of two nor-
mals ω
m
= (x
m
,y
m
,z
m
) and ω
m
= (x
m
,y
m
,z
m
) (see Fig-
ure
11 in Appendix B) and the contribution of each surface is
weighted by PDF (ω
m
·ω
g
)D(ω
m
) in the BSDF. The mask-
ing function of a V-cavity microsurface is given by
G
1
(ω,ω
m
) = χ
+
ω ·ω
m
ω ·ω
g
min
1,2
|ω
m
·ω
g
||ω ·ω
g
|
|ω,ω
m
|
,
(3)
where the heaviside function ensures that backfacing mi-
crofacets are discarded for the correct side of the microsur-
face. The traditional masking-shadowing function accounts
for height correlation in the BRDF: ω
o
is in the upper hemi-
sphere (ω
o
·ω
g
> 0) and masking and shadowing occur on
the same side of the microfacet and are correlated. We gen-
eralize this to the BTDF: ω
o
is in the lower side of the mi-
crosurface and masking and shadowing occur on opposite
sides of the microfacet and are anticorrelated. The masking-
shadowing function is
G
2
(ω
i
,ω
o
,ω
m
) =
min(G
1
(ω
i
,ω
m
),G
1
(ω
o
,ω
m
)), if ω
o
·ω
g
> 0,
max(G
1
(ω
i
,ω
m
) + G
1
(ω
o
,ω
m
) 1,0), otherwise.
Kelemen et al. proposed a simplified version of this
masking-shadowing function to aid improve efficiency and
permit importance sampling [
KSK01]. However, their func-
tion does not satisfy Equation (2), which makes their model
physically ill-defined. In Section 4, we will show that using
the V-cavitity function can actually lead to a simple impor-
tance sampling scheme, which we find to be more efficient
than the Kelemen model.
The Smith Microsurface Model. The Smith masking func-
tion was originally derived from a raytracing formula-
tion [
Smi67] for Beckmann distributions D and general-
ized to other distributions by Brown [Bro80]. Recently,
Heitz showed that the Smith masking function can be de-
rived from the equation of the conservation of the projected
area [Hei14]. The Smith microsurface model is the most ac-
curate model for compactly describing geometrical-optics
reflectance and transmission from explicit random height
fields (such as an ocean surface), and is better than the
V-cavity model for approximating reflectance of measured
material [Hei14] . However, specific masking functions G
1
must be derived for each new distribution of normals. An-
alytic solutions are available for Beckmann [
Smi67] and
GGX [WMLT07]. Heitz showed that the same formulas
can be used with the anisotropic extensions of D [Hei14].
Different forms of the Smith masking-shadowing function
are available, the most simple is the non-correlated form:
G
2
(ω
i
,ω
o
,ω
m
) = G
1
(ω
i
,ω
m
)G
1
(ω
o
,ω
m
).
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
The Scattering Model is given by the local illumination
equation:
L(ω
i
) =
Z
L(ω
o
)|ω
o
·ω
g
| f (ω
i
,ω
o
)dω
o
, (4)
where f is the BSDF and L(ω
o
) is the radiance in
the outgoing direction. The construction of the BSDF
model is detailed by Walter et al. [
WMLT07] and is il-
lustrated in Figure 3(b): the distribution of visible nor-
mals is transformed into a distribution of outgoing di-
rections ω
o
by reflection and transmission. The BSDF
f (ω
i
,ω
o
) = f
r
(ω
i
,ω
o
) + f
t
(ω
i
,ω
o
) is the sum of the BRDF
f
r
(ω
i
,ω
o
) =
F(ω
i
,ω
h
r
)G
2
(ω
i
,ω
o
,ω
h
r
)D(ω
h
)
4|ω
i
·ω
g
||ω
o
·ω
g
|
,
and the BTDF
f
t
(ω
i
,ω
o
) =
|ω
i
·ω
h
t
||ω
o
·ω
h
t
|
|ω
i
·ω
g
||ω
o
·ω
g
|
n
2
0
(1 F(ω
i
,ω
h
t
))G
2
(ω
i
,ω
o
,ω
h
t
)D(ω
h
t
)
(n
i
(ω
i
·ω
h
t
) + n
o
(ω
o
·ω
h
t
))
2
,
where ω
h
r
and ω
h
t
are the half vectors of reflection and
transmission respectively, and n
i
and n
o
are the indices of
refraction of the incident and transmitted sides respectively
(we refer the reader to [
WMLT07] for more details).
2.2. Importance Sampling the BSDF
Typically, importance sampling is used to solve Equa-
tion (4). The most common importance sampling strategy
for parametric BSDFs uses the distribution of normals to
generate the samples [War92,AS00,APS00,KSK01,Ash07,
WMLT07]. In this paper, we call it the “previous method”
and it is illustrated in Algorithm 1. In order to importance
sample the cosine weighted BSDF |ω
o
·ω
g
| f (ω
i
,ω
o
), pre-
vious algorithms start by generating normals ω
m
with the
PDF (ω
m
·ω
g
)D(ω
m
) rather than sampling outgoing direc-
tions ω
o
directly. Then, a light transport operator is applied
on the sampled normal to generate the outgoing direction.
The transport operators, reflect
ω
o
= 2|ω
i
·ω
m
|ω
m
ω
i
,
and transmit
ω
o
=
nc sign(ω
i
·ω
g
)
q
1 + n(c
2
1)
ω
m
nω
i
,
with c = (ω
i
·ω
m
), and n =
n
i
n
o
,
are chosen randomly and with a probability depending on the
Fresnel term: F(ω
i
,ω
m
) is the reflection probability and 1
F(ω
i
,ω
m
) is the transmission probability. The PDF resulting
from this procedure is the PDF used to generate the normals
multiplied by the Jacobian of the chosen operator:
∂ω
h
r
∂ω
i
=
1
4|ω
i
·ω
h
r
|
,
∂ω
h
t
∂ω
i
=
n
2
o
|ω
o
·ω
h
t
|
(n
i
(ω
i
·ω
h
) + n
o
(ω
o
·ω
h
))
2
.
Since the same Jacobians are present in the sampling PDF
and in the BRDF/BTDF expressions, they simplify out in the
sample weight expression. Also, since reflection and trans-
mission are sampled randomly according to the Fresnel term,
the value of Fresnel is present in the sampling PDF as well as
in the BRDF/BTDF, and simplifies out in the sample weight
expression. In both cases the final expression for the sample
weight reduces to
weight(ω
o
) =
|ω
i
·ω
m
|G
2
(ω
i
,ω
o
,ω
m
)
|ω
i
·ω
g
||ω
m
·ω
g
|
.
Discussion This sampling algorithm is almost perfect at
normal incidence but we can see in Figure
4 that it has
two main problems at grazing angles. The first problem is
that up to half of the generated normals ω
m
are backfacing
(ω
i
·ω
m
< 0). The associated weights are 0 and so half of
the sample space is wasted. The second problem at graz-
ing angles is that the sample weights can be arbitrarily high
with the Smith model leading to unwanted variance, espe-
cially for paths with multiple surface interactions (though
the sample weights are at most 2 with the V-cavity model).
This is responsible for the firefly artifacts in Figure
2. Wal-
ter et al. [WMLT07] notice this problem and propose using a
BSDF with a slightly different roughness α
for sampling the
NDF at grazing angles: α
= (1.20.2
p
|ω
i
·ω
m
|α). This is
denoted as “Walter’s trick” in Figure 4. Walter’s trick signi-
ficatively reduces the maximal weight with Beckmann dis-
tributions but does not help much with GGX (in our experi-
ence, despite trying offset values greater than 1.2) and also
does not alleviate the problem of wasted samples.
Algorithm 1 Sample ω
o
(previous)
ω
m
Sample (ω
m
·ω
g
)D(ω
m
)
if U < F(ω
i
,ω
m
) then
ω
o
reflect(ω
i
,ω
m
)
else
ω
o
transmit(ω
i
,ω
m
)
end if
weight(ω
o
)
|ω
i
·ω
m
|G
2
(ω
i
,ω
o
,ω
m
)
|ω
i
·ω
g
| |ω
m
·ω
g
|
Algorithm 2 Sample ω
o
(our)
ω
m
Sample D
ω
i
(ω
m
) Algorithm
3 or 4
if U < F(ω
i
,ω
m
) then
ω
o
reflect(ω
i
,ω
m
)
else
ω
o
transmit(ω
i
,ω
m
)
end if
weight(ω
o
)
G
2
(ω
i
,ω
o
,ω
m
)
G
1
(ω
i
,ω
m
)
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
previous our
PDF(ω
m
) (ω
m
·ω
g
)D(ω
m
) D
ω
i
(ω
m
)
weight(ω
o
)
|ω
i
·ω
m
| G
2
(ω
i
,ω
o
,ω
m
)
|ω
i
·ω
g
||ω
m
·ω
g
|
G
2
(ω
i
,ω
o
,ω
m
)
G
1
(ω
i
,ω
m
)
V-cavities G weight(ω
o
) [0,2] weight(ω
o
) [0,1]
Smith G weight(ω
o
) [0,[ weight(ω
o
) [0,1]
Table 2: Properties of the importance sampling techniques.
previous
(ω
m
·ω
g
)D(ω
m
)
previous
(Walter’s trick)
our
D
ω
i
(ω
m
)
V-cavity Beckmann (α = 0.3)
Smith Beckmann (α = 0.3)
Smith GGX (α = 0.1)
Figure 4: The sampling weights with different PDFs
at grazing angle (θ
i
= 1.5). The sampling space is
parametrized by the two random numbers (U
1
,U
2
) used to
generate ω
m
. Our sampling scheme completely fills the sam-
ple space with weights very near 1.0. (The plot of our method
with the V-cavity model is noisy because we use a supple-
mental random number U
3
, see Section
4).
3. Our Importance Sampling Scheme
The core idea behind our new sampling scheme is to use
the distribution of visible normals D
ω
i
as the sampling PDF
rather than the view-independent PDF (ω
m
·ω
g
)D(ω
m
), as
shown in Algorithms
2. The differences with the previous
method are highlighted in red. By doing this we are directly
simulating what is illustrated in Figure 3(b): an incident ray
ω
i
intersects a random normal chosen within the distribution
of visible normals for this ray and is reflected or transmitted.
Only shadowing needs to be added, since it does not directly
emerge from this model but is there to enforce single
scattering on the microsurface [
Hei14]. The value of the
weight
G
2
(ω
m
,ω
i
,ω
g
)
G
1
(ω
m
,ω
i
)
is the amount of visible shadowing.
Note that when masking and shadowing are not cor-
related, i.e. G
2
(ω
i
,ω
o
,ω
m
) = G
1
(ω
i
,ω
m
)G
1
(ω
o
,ω
m
),
then the weight comes down to shadowing alone
G
2
(ω
i
,ω
o
,ω
m
)/G
1
(ω
i
,ω
m
) = G
1
(ω
o
,ω
m
). This makes
sense, because if masking and shadowing are not correlated,
then the visible shadowing is simply the shadowing.
Table
2 compares the previous importance sampling
method with our method for the V-cavity and the Smith mi-
crosurface models. Since G
1
G
2
the weight in our method
is always less than 1: firefly artifacts do not appear (see Fig-
ure 2). This can be observed in Figure 4. We also see that
our method does not waste the sampling space like previ-
ous methods. This is because we never generate backfacing
normals.
Sections
4 and 5 are dedicated to implement method
Sample D
ω
i
(ω
m
) for the V-cavity and the Smith microsur-
face models, respectively.
4. Sampling D
ω
i
(ω
m
) with the V-cavity Model
Importance sampling D
ω
i
(ω
m
) with the V-cavity model is
summarized in Algorithm
3. We start by sampling from the
PDF (ω
m
·ω
g
)D(ω
m
) as in the previous method. This gives
us a random microsurface with dual normals ω
m
and ω
m
(see Figure
11). Then, we choose randomly between ω
m
or
ω
m
using selection probabilities proportional to hω
i
,ω
m
i
and hω
i
,ω
m
i respectively, which correspond to their pro-
jected areas toward ω
i
. This random choice, weighted by the
projected area, is what transforms the PDF (ω
m
·ω
g
)D(ω
m
)
into D
ω
i
(ω
m
). In practice, we implement this by a random
swap of ω
m
by ω
m
with probability
hω
i
,ω
m
i
hω
i
,ω
m
i+hω
i
,ω
m
i
.
Algorithm 3 Sampling D
ω
i
(ω
m
) (V-cavity model)
ω
m
Sample (ω
m
·ω
g
)D(ω
m
) 1. choose microsurface
if U <
hω
i
,ω
m
i
hω
i
,ω
m
i+hω
i
,ω
m
i
then 2. choose normal
ω
m
ω
m
end if
Figure 5: Illustration of Algorithm 3.
Figure
5 illustrates how the algorithm works. When the
incident ray approaches the geometric surface, it starts
by choosing a V-cavitity microsurface. Since the V-cavity
model assumes separate microsurfaces, they have all the
same visibility and can be chosen with the view-independent
PDF (ω
m
·ω
g
)D(ω
m
). Then, on the chosen V-cavity micro-
surface, the ray must choose between ω
m
and ω
m
with a
probability weighted by their respective visibilities. We in-
corporate this second choice in the final PDF with a random
swap between the two normals. Thus, Our algorithm requires
an additional random number U. The formal proof for this
algorithm is given in Appendix
B.
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
5. Sampling D
ω
i
(ω
m
) with the Smith Model
In
5.1 we show that we can sample from the distribution of
visible normals D
ω
i
by sampling from the distribution of vis-
ible slopes P
22
ω
i
. Then, in 5.2, we will show that the shape of
P
22
ω
i
is stretch invariant. In practice, this means that a single
analytic or tabulated inversion can be used with any rough-
ness and anisotropy. These computations are detailed in
5.3.
The complete algorithm we use to sample D
ω
i
is summa-
rized and discussed in
5.4.
5.1. Formulation in Slope Space
In Equation (2) we have already defined D
ω
i
, but in this sec-
tion we use an alternative equivalent formulation:
D
ω
i
(ω
m
) =
hω
i
,ω
m
iD(ω
m
)
R
hω
i
,ω
m
iD(ω
m
)dω
m
=
1
c
hω
i
,ω
m
iD(ω
m
), (5)
where c =
R
hω
i
,ω
m
iD(ω
m
)dω
m
is the normalization fac-
tor of the PDF. This normalization factor does not appear in
Equation (
2) but is implicitly contained in the masking func-
tion G
1
[Hei14]. In the following, we use Heitz’s [Hei14]
formulation of Equation (5) in slope space. We recall that
˜m = (x
˜m
,y
˜m
) = (
x
n
z
n
,
y
n
z
n
) are the slopes associated to the
normal ω
m
= (x
n
,y
n
,z
n
) and reciprocally ω
m
=
(x
˜m
,y
˜m
,1)
x
2
˜m
+y
2
˜m
+1
.
If the microsurface is a heightfield, the distribution of nor-
mals is linked to the distribution of slopes P
22
(x
˜m
,y
˜m
) by
(ω
m
·ω
g
)D(ω
m
) =
˜m
ω
m
P
22
( ˜m = (x
˜m
,y
˜m
)),
where
˜m
ω
m
=
1
(ω
m
·ω
g
)
3
is the Jacobian of the slope to nor-
mal transformation. The distributions of visible normals and
of visible slopes are linked in the same way by
D
ω
i
(ω
m
) =
˜m
∂ω
m
P
22
ω
i
( ˜m = (x
˜m
,y
˜m
)). (6)
In slope space, Equation (
5) is written:
P
22
ω
i
(x
˜m
,y
˜m
) =
1
c
χ
+
(x
i
x
˜m
+ y
i
y
˜m
+ z
i
)(x
i
x
˜m
+ y
i
y
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
), (7)
where the normalization factor in slope space is:
c =
R R
χ
+
(x
i
x
˜m
+ y
i
y
˜m
+ z
i
)(x
i
x
˜m
+ y
i
y
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
)dx
˜m
dy
˜m
.
If we sample P
22
ω
i
and transform the output slope into a
normal ω
m
, the resulting PDF is D
ω
i
. This is the first idea of
Algorithm
4.
5.2. Stretch Invariance
Stretching a microsurface is illustrated in Figure
6. The
slopes of the microsurface are divided by the stretching co-
efficients: (x
˜m
,y
˜m
) becomes (
x
˜m
λ
x
,
y
˜m
λ
y
). The stretching opera-
tor S
λ
x
,λ
y
() that transforms the normalized incident vector
ω
i
= (x
i
,y
i
,z
i
) into another normalized incident vector
is
defined as
S
λ
x
,λ
y
(ω
i
) =
(λ
x
x
i
,λ
y
y
i
,z
i
)
q
(λ
x
x
i
)
2
+ (λ
y
y
i
)
2
+ z
2
i
.
Heitz [
Hei14] calls P
22
shape-invariant if it has the same
shape after stretching, i.e. if for any λ
x
,λ
y
> 0
P
22
(x
˜m
,y
˜m
,α
x
,α
y
) =
1
λ
x
λ
y
P
22
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
x
,
α
y
λ
y
, (8)
where P
22
(x
˜m
,y
˜m
) is written P
22
(x
˜m
,y
˜m
,α
x
,α
y
) to specify
the roughness parameters explicitly. This is usually the case
when the distribution comes from a distribution of slopes.
Heitz showed that if P
22
is shape-invariant, then the mask-
ing function G
1
is stretch-invariant. We introduce a stronger
property: if the distribution of slopes P
22
is shape-invariant,
then the distribution of visible slopes P
22
ω
i
is also shape-
invariant. This is written
P
22
ω
i
(x
˜m
,y
˜m
,α
x
,α
y
) =
1
λ
x
λ
y
P
22
S
λ
x
,λ
y
(ω
i
)
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
x
,
α
y
λ
y
,
(9)
and is illustrated in Figure
7. The formal proof of this re-
sult is provided in Appendix A. A practical consequence of
Equation (9) is that the distribution of visible slopes can al-
ways be expressed with an isotropic roughness α (we choose
arbitrarily α = 1):
P
22
ω
i
(x
˜m
,y
˜m
,α
x
,α
y
) =
1
α
x
α
y
P
22
S
α
x
,α
y
(ω
i
)
x
˜m
α
x
,
y
˜m
α
y
,1,1
.
The factor
1
α
x
α
y
in the right-hand side is the Jacobian of the
transformation from
x
˜m
α
x
,
y
˜m
α
y
to (x
˜m
,y
˜m
).
If a sampling algorithm is available for (
x
˜m
α
x
,
y
˜m
α
y
)
with PDF P
22
S
α
x
,α
y
(ω
i
)
(
x
˜m
α
x
,
y
˜m
α
y
,1,1), we can use it to sample
(x
˜m
,y
˜m
) with PDF P
22
ω
i
(x
˜m
,y
˜m
,α
x
,α
y
). This is the second
idea of Algorithm
4.
We note that a similar observation was made by Becker
and Max [
BM93]: they show that the distribution of visi-
ble normals is invariant to height-stretching, which is equiv-
alent to scaling the slope amplitude k ˜mk, where the slope
coordinates x
˜m
and y
˜m
are scaled by the same factor. This al-
lows for isotropic roughness changes only. Instead of height-
stretching we use slope-stretching, where x
˜m
and y
˜m
can be
scaled separately, which permits fully anisotropic roughness
changes.
Note that the normals are not modified in the same way because
they are not vectors but covectors. The normals after stretching are
given by the new slopes: ω
m
=
(
x
˜m
λ
x
,
y
˜m
λ
x
,1)
s
x
˜m
λ
x
2
+
y
˜m
λ
y
2
+1
.
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
Figure 6: Stretching the configuration.
P
22
(x
˜m
,y
˜m
,
3
5
,
4
5
) × stretching P
22
(x
˜m
,y
˜m
,1,1)
P
22
ω
i
(x
˜m
,y
˜m
,
3
5
,
4
5
) × stretching P
22
S
5
3
,
5
4
(ω
i
)
(x
˜m
,y
˜m
,1,1)
Figure 7: Stretch invariance in slope space of P
22
and P
22
ω
i
(Beckmann distribution).
5.3. Sampling P
22
ω
i
(x
˜m
,y
˜m
,1,1)
After stretching the configuration, the distribution of visible
slopes is P
22
ω
i
(x
˜m
,y
˜m
,1,1). In order to sample (x
˜m
,y
˜m
) with
PDF P
22
ω
i
(x
˜m
,y
˜m
,1,1), we first assume that the frame is such
as ω
i
= (x
i
,0,z
i
). This is possible since we are now using an
isotropic distribution of normals (α
x
,α
y
= 1). The expres-
sion of Equation (
7) simplifies to
P
22
ω
i
(x
˜m
,y
˜m
,1,1) =
1
c
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
).
This expression emphasizes that the projection factor
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
) is not related to the slope compo-
nent y
˜m
. We use this property to sample P
22
ω
i
in two steps a.
and b.
5.3.1. a. Sampling P
2
ω
i
(x
˜m
,1,1)
We start by sampling the marginalized random variable x
˜m
given by the PDF
P
2
ω
i
(x
˜m
,1,1)
=
1
c
Z
+
−∞
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
,1,1) dy
˜m
=
1
c
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)
Z
+
−∞
P
22
(x
˜m
,y
˜m
,1,1) dy
˜m
=
1
c
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)P
2
(x
˜m
,1,1), (10)
where P
2
(x
˜m
,1,1) is the marginalized PDF of x
˜m
. We in-
vert
U
1
=
Z
x
˜m
−∞
P
2
ω
i
(x
˜m
,1,1) dx
˜m
x
˜m
= C
2
ω
i
1
(U
1
,1,1), (11)
where C
2
ω
i
is the cumulative distribution fonction (CDF) as-
sociated to the marginalized PDF P
2
ω
i
.
This equation can be solved analytically for Beckmann
and GGX distributions (see our supplemental material). For
other distributions, if an analytic solution is not available,
we propose to precompute the solutions and store them in a
2D table x
˜m
= T
x
˜m
[θ
i
,U
1
]. Indeed, x
˜m
depends only on two
variables: θ
i
(because x
i
= sinθ
i
and z
i
= cosθ
i
) and U
1
.
5.3.2. b. Sampling P
2|2
(y
˜m
|x
˜m
,1,1)
Then, we sample the conditional random variable y
˜m
|x
˜m
given by the PDF
P
2|2
ω
i
(y
˜m
|x
˜m
,1,1)
=
1
c
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
,1,1)
R
+
−∞
1
c
χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
,1,1) dy
˜m
=
P
22
(x
˜m
,y
˜m
,1,1)
R
+
−∞
P
22
(x
˜m
,y
˜m
,1,1) dy
˜m
= P
2|2
(y
˜m
|x
˜m
,1,1). (12)
This shows that the sampling of y
˜m
does not depend on the
incident direction ω
i
. Hence, we invert
U
2
=
Z
y
˜m
−∞
P
2|2
(y
˜m
|x
˜m
,1,1) dy
˜m
y
˜m
= C
2|2
1
(U
2
|x
˜m
,1,1), (13)
where C
2|2
(y
˜m
|x
˜m
,1,1) the CDF associated to the view-
independent conditional PDF P
2|2
.
This equation can be solved analytically for Beckmann
and GGX distributions (see our supplemental material). For
other distributions, if an analytic solution is not available, we
propose to precompute the solutions and store them in a 2D
table y
˜m
= T
y
˜m
[x
˜m
,U
2
]. Indeed, y
˜m
|x
˜m
depends only on two
variables: x
˜m
and U
2
.
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
5.4. Sampling D
ω
i
(ω
m
)
In Algorithm
4, we sample (x
˜m
,y
˜m
) with PDF
P
22
S
α
x
,α
y
(ω
i
)
(x
˜m
,y
˜m
,1,1) by sampling x
˜m
with marginal-
ized PDF P
2
ω
i
(x
˜m
,1,1) and y
˜m
with conditional
PDF P
2|2
(y
˜m
|x
˜m
,1,1). Then, we transform this
slope vector back to the canonical frame where
ω
i
= (cosφ
i
sinθ
i
,sinφ
i
sinθ
i
,cosθ
i
) by applying a ro-
tation of angle φ
i
and we unstretch the slopes by multiplying
by respectively α
x
and α
y
. The sampled PDF at this point is
P
22
ω
i
(x
˜m
,y
˜m
,α
x
,α
y
). Finally, we transform the slopes into a
normal. The sampled PDF is D
ω
i
(ω
m
,α
x
,α
y
).
Algorithm 4 Sample D
ω
i
(ω
m
) (Smith profile)
ω
i
S
α
x
,α
y
(ω
i
) 1. stretch
x
˜m
C
2
ω
i
1
(U
1
,1,1) 2.a. sample P
2
ω
i
(x
˜m
,1, 1)
y
˜m
C
2|2
1
(U
2
|x
˜m
,1,1) 2.b. sample P
2|2
(y
˜m
|x
˜m
,1, 1)
x
˜m
y
˜m
cosφ
i
sinφ
i
sinφ
i
cosφ
i
x
˜m
y
˜m
3. rotate
x
˜m
y
˜m
α
x
x
˜m
α
y
y
˜m
4. unstretch
ω
m
(x
˜m
,y
˜m
,1)
x
2
˜m
+y
2
˜m
+1
5. compute normal
Figure 8: Illustration of Algorithm 4.
Analytic Computation of C
2
ω
i
1
and C
2|2
1
The corner-
stone of Algorithm
4 is the inversion of the CDFs C
2
ω
i
and
C
2|2
. We found this to be possible analytically for Beckmann
and GGX distributions, for which we provide the detailed
derivations of the inversion procedures and their C++ imple-
mentations in the associated supplemental material.
Precomputation of C
2
ω
i
1
and C
2|2
1
If an analytic in-
version procedure of the CDFs C
2
ω
i
and C
2|2
is not avail-
able, we propose to use precomputed data T
x
˜m
[θ
i
,U
1
] and
T
y
˜m
[x
˜m
,U
2
] parametrized in slope space. One advantage of
the slope space is that the equation of P
22
ω
i
becomes sepa-
rable: χ
+
(x
i
x
˜m
+ z
i
)(x
i
x
˜m
+ z
i
) does not depend on y
i
and
thus can be pulled out one of the two integrals. This prop-
erty is used in Equations (
10) and (12) and makes the pre-
computations easier than they would have been with spheri-
cal coordinates. The problem of using spherical coordinates
was discussed by Becker and Max [BM93]: they store ta-
bles parametrized in (θ,φ) and they either assume that θ and
φ can be sampled independently, which is approximate and
leads to biased sampling, or they need to store a 3D table
to sample θ for a given φ (or the reciprocal). This would
require an enormous 3D table and would be impractical
(>1GB). However, in slope space, Equation (12) shows that
P
2|2
ω
i
(y
˜m
|x
˜m
,1,1) = P
2|2
(y
˜m
|x
˜m
,1,1) and the inversion does
not depend on θ
i
, which allows us to use a 2D precomputed
table indexed by x
˜m
and U
2
. Thus, we need to precompute
only two 2D tables T
x
˜m
[θ
i
,U
1
] and T
y
˜m
[x
˜m
,U
2
]. More im-
portantly, thanks to the invariance property in slope space,
we can use the same data with different roughnesses and
anisotropy. In our implementation, T
x
˜m
and T
y
˜m
are both of
size 1024
2
. Popular heavy-tailed distributions of slopes like
GGX have very long tails but also a very sharp peak at the
same time, and so require a 1024
2
table to capture them well.
The total memory footprint for every parametric anisotropic
BSDF with the same shape is then 32MB.
Limitation Note that this technique works only when the
distribution of normals D is built from a shape-invariant dis-
tribution of slopes P
22
. For instance, this is the case for
the Beckmann [
Smi67] and GGX [WMLT07], but not for
the Phong distribution (which lacks a Smith masking func-
tion [
WMLT07]).
6. Results and Validation
In Figure 1 we show a dielectric glass plate with anisotropic
GGX roughness (Smith masking) on all faces. The illumi-
nant is constant uniform distant white radiance from all di-
rections (a white environment map). In all renders we use
forward path tracing with unbounded path lengths. Multi-
ple importance sampling (MIS) mixes BSDF and next-event-
estimation (light sampling) at each path vertex. Figure 1 uses
64 independent samples per pixel. Our new BSDF sampling
scheme runs in roughly the same time as prior work and pro-
vides a significant reduction in variance. Figure
9 shows a
configuration where fireflies are still present with the previ-
ous method even with 4000 samples per pixel. Due to the de-
fault Gaussian filter in Mitsuba, a single bright sample may
contribute significantly to several pixels (appearing as a 2x2
bright pixel block).
Figure 10 compares the convergence of importance sam-
pling with the previous method to our method in a config-
uration shown in Figure 2, i.e. a rough conductor lit by an
environment map. The plot shows that both methods con-
verge to the same value, which was expected because the
previous method and our method are both mathematically
well-defined. However, the convergence rate is not the same.
In the two first rows we used the Smith model. We see
that the convergence rate is very sensitive to the fact that
the sampling weight can be arbitrary high with the previous
method. This produces firefly artifacts that take a long time
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
to disappear. In contrary, our method does not produce these
artifacts since all BSDF sample weights are bounded to 1.
In the two last rows we compare the methods used with the
V-cavity model. While the previous method does not suffer
from very high sampling weights (they are bounded to 2),
the convergence of our method is faster. This is because we
do not waste the sampling space by generating backfacing
normals with weight 0.
More results and more convergence comparisons are
available in the associated supplemental material.
Previous (Walter’s trick) Our
4000spp, 12min 3844spp, 12min
Figure 9: A dielectric glass plate (n = 1.5) with isotropic
Beckmann roughness (α = 0.1) on all faces (with the Smith
masking function). Fireflies are persistent with the previ-
ous method even with a large number of samples (4000 per
pixel).
7. Conclusion
We have presented a new importance sampling scheme for
microfacet-based BSDFs. The scope of our scheme is broad,
encompassing many popular isotropic and anisotropic ana-
lytic BRDF and BSDF models and allows a variety of nor-
mal distribution functions. The performance of our scheme
is comparable to previous methods and is suitable for both
offline and GPU rendering. We have shown that importance
sampling the BSDF using the distribution of visible normals
rather than the distribution of normals is practical and makes
convergence faster, significantly reducing artifacts at grazing
incidence angles, especially for significant roughness levels.
With the V-cavity microsurface model, this is implemented
with a simple one conditional swap of the normal. With the
much more accurate Smith microsurface model, we provide
analytic sampling algorithms for Beckmann and GGX dis-
tributions in our supplemental material. Otherwise, we have
shown that a small set of precomputed data can be used to
sample BSDFs with any roughness and anisotropy, due to
key shape invariance properties of the distribution of visible
slopes.
Importance Sampling - Smith GGX (α = 0.05)
previous
our
Multiple Importance Sampling - Smith GGX (α = 0.05)
previous
our
Importance Sampling - V-cavity GGX (α = 0.05)
previous
our
Multiple Importance Sampling - V-cavity GGX (α = 0.05)
previous
our
Figure 10: Comparisons of our importance sampling tech-
nique to previous methods (with and without MIS). The im-
ages are computed with 8 samples per pixel. The plots shows
the convergence of several running estimates of the same
pixel of the pedestal for both techniques. The pixel variance
is seen directly in the spread of the various estimates.
References
[APS00] ASHIKMIN M., PREMOŽE S., SHIRLEY P.: A
microfacet-based brdf generator. In Proceedings of the 27th
annual conference on Computer graphics and interactive tech-
niques (2000), SIGGRAPH ’00, pp. 65–74.
4
[AS00] ASHIKHMIN M., SHIRLEY P.: An anisotropic phong brdf
model. Journal of Graphics Tools 5 (2000), 25–32.
2, 4
[Ash07] ASHIKHMIN M.: Distribution-based BRDFs. Tech. rep.,
2007.
4
[BM93] BECKER B. G., MAX N. L.: Smooth transitions between
bump rendering algorithms. In Proceedings of the 20th Annual
Conference on Computer Graphics and Interactive Techniques
(1993), SIGGRAPH ’93, pp. 183–190.
6, 8
[Bro80] BROWN G.: Shadowing by non-gaussian random sur-
faces. IEEE Trans. on Antennas and Propagation 28, 6 (Nov
1980), 788–790.
3
[CT82] COOK R. L., TORRANCE K. E.: A reflectance model for
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.
E. Heitz & E. d’Eon / Importance Sampling Microfacet-Based BSDFs using the Distribution of Visible Normals
computer graphics. ACM Trans. Graph. 1, 1 (Jan. 1982), 7–24.
2, 3
[Hei14] HEITZ E.: Understanding the masking-shadowing func-
tion in microfacet-based brdfs. Journal of Computer Graphics
Techniques (JCGT) 3, 2 (2014). To appear.
2, 3, 5, 6
[KSK01] KELE MEN C., SZI RMAY-KALOS L.: A microfacet
based coupled specular-matte brdf model with importance sam-
pling. In Eurographics Short Presentations (2001).
2, 3, 4
[Smi67] SMITH B.: Geometrical shadowing of a random rough
surface. IEEE Trans. on Antennas and Propagation 15 (1967),
668–671.
3, 8
[Sta01] STA M J.: An illumination model for a skin layer bounded
by rough surfaces. In Rendering Techniques (2001), pp. 39–52.
2
[TS67] TORRANCE K. E., SPARROW E. M. : Theory for off-
specular reflection from roughened surfaces. J. Opt. Soc. Am. 57,
9 (Sep 1967), 1105–1112.
2, 3
[vGSK98] VAN GINNE KEN B., STAVRI DI M., KOENDERINK
J. J.: Diffuse and specular reflectance from rough surfaces. Jour-
nal of Appl. Opt. 37, 1 (Jan 1998), 130–139.
2
[War92] WARD G . J.: Measuring and modeling anisotropic re-
flection. SIGGRAPH Comput. Graph. 26, 2 (July 1992), 265–
272.
2, 4
[WMLT07] WALTER B., MARSCHNER S. R., LI H., TORRANCE
K. E.: Microfacet models for refraction through rough sur-
faces. In Proc. Eurographics Symposium on Rendering (2007),
EGSR’07, pp. 195–206.
2, 3, 4, 8
Appendix A: Shape Invariance of P
22
ω
i
We demonstrate the result of Equation (
9):
P
22
ω
i
(x
˜m
,y
˜m
,α
x
,α
y
)
=
χ
+
(x
i
x
˜m
y
i
y
˜m
+ z
i
)(x
i
x
˜m
y
i
y
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
,α
x
,α
y
)
Z Z
χ
+
(x
i
x
˜m
y
i
y
˜m
+ z
i
)(x
i
x
˜m
y
i
y
˜m
+ z
i
)P
22
(x
˜m
,y
˜m
,α
x
,α
y
)dx
˜m
dy
˜m
=
χ
+
(λ
x
x
i
x
˜m
α
x
λ
y
y
i
y
˜m
λ
y
+z
i
) (λ
x
x
i
x
˜m
λ
x
λ
y
y
i
y
˜m
λ
y
+z
i
)
(λ
x
x
i
)
2
+(α
y
y
i
)
2
+z
2
i
1
λ
x
λ
y
P
22
(
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
y
,
α
y
λ
y
)
Z Z
χ
+
(λ
x
x
i
x
˜m
λ
x
λ
y
y
i
y
˜m
λ
y
+ z
i
)(λ
x
x
i
x
˜m
α
x
λ
y
y
i
y
˜m
λ
y
+ z
i
)
q
(λ
x
x
i
)
2
+ (λ
y
y
i
)
2
+ z
2
i
1
λ
x
λ
y
P
22
(
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
y
,
α
y
λ
y
)dx
˜m
dy
˜m
=
χ
+
(λ
x
x
i
x
˜m
α
x
λ
y
y
i
y
˜m
λ
y
+z
i
) (λ
x
x
i
x
˜m
λ
x
λ
y
y
i
y
˜m
λ
y
+z
i
)
(λ
x
x
i
)
2
+(α
y
y
i
)
2
+z
2
i
1
λ
x
λ
y
P
22
(
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
y
,
α
y
λ
y
)
Z Z
χ
+
(λ
x
x
i
x
˜m
λ
x
λ
y
y
i
y
˜m
λ
y
+ z
i
)(λ
x
x
i
x
˜m
α
x
λ
y
y
i
y
˜m
λ
y
+ z
i
)
q
(λ
x
x
i
)
2
+ (λ
y
y
i
)
2
+ z
2
i
P
22
(
y
˜m
λ
y
,
y
˜m
λ
y
,
α
x
λ
y
,
α
y
λ
y
)d
x
˜m
λ
x
d
y
˜m
λ
y
=
1
λ
x
λ
y
P
22
S
λ
x
,λ
y
(ω
i
)
x
˜m
λ
x
,
y
˜m
λ
y
,
α
x
λ
x
,
α
y
λ
y
,
where we start to write Equation (
7). In the second step we
develop by applying Equation (8) and by multiplying the
numerator and the denominator by
1
(λ
x
x
i
)
2
+(α
y
y
i
)
2
+z
2
i
. In
the thrid step, at the denominator we make the change of
variable:
1
λ
x
λ
y
dx
˜m
dy
˜m
= d
x
˜m
λ
x
d
y
˜m
λ
y
.
Appendix B: Proof for Algorithm
3
To verify that Algorithm 3 samples PDF D
ω
i
(ω
m
), we will
expand G
1
from Equation (
3) in the definition of D
ω
i
(ω
m
)
from Equation (
2). The min in Equation (3) is used to differ-
entiate between 2 cases illustrated in Figure
11.
Case (a) If ω
m
is backfacing, then the shadowing occuring
on ω
m
is G
1
(ω
i
,ω
m
) = 2
(ω
m
·ω
g
) (ω
i
·ω
g
)
hω
i
,ω
m
i
, and by using the fact
that hω
i
,ω
m
i = 0 and |ω
i
·ω
m
| > 0 we get
D
ω
i
(ω
m
) = 2
|ω
m
·ω
g
||ω
i
·ω
g
|
|ω
i
,ω
m
|
|ω
i
,ω
m
|D(ω
m
)
|ω
i
·ω
g
|
= 2
|ω
i
·ω
m
|
|ω
i
·ω
m
|
|ω
m
·ω
g
|D(ω
m
)
= 2
hω
i
,ω
m
i
hω
i
,ω
m
i+ 0
|ω
m
·ω
g
|D(ω
m
)
= 2
hω
i
,ω
m
i
hω
i
,ω
m
i+ hω
i
,ω
m
i
(ω
m
·ω
g
)D(ω
m
).
Case (b) If ω
m
and ω
m
are both not backfacing for ω
i
, then
there is no masking (G
1
= 1) and Equation (
2) becomes
D
ω
i
(ω
m
) =
hω
i
,ω
m
iD(ω
m
)
|ω
i
·ω
g
|
= 2
hω
i
,ω
m
i
hω
i
,ω
m
i+ hω
i
,ω
m
i
(ω
m
·ω
g
)D(ω
m
),
because |ω
i
·ω
g
| =
hω
i
,ω
m
i+hω
i
,ω
m
i
2hω
m
,ω
g
i
.
Conclusion In either case the distribution of visible
normals is given by the same expression. The factor
hω
i
,ω
m
i
hω
i
,ω
m
i+hω
i
,ω
m
i
represents the repartition of visibility be-
tween ω
m
and ω
m
. In Algorithm
3, the conditional re-
placement of ω
m
by ω
m
multiplies the original PDF (ω
m
·
ω
g
)D(ω
m
) by the factor
hω
i
,ω
m
i
hω
i
,ω
m
i+hω
i
,ω
m
i
, and the factor 2 is
present in the sampled PDF because ω
m
can be chosen for 2
microsurfaces (the one associated to himself and the one to
ω
m
) and reciprocally for ω
m
.
Figure 11: Masking configurations with the V-cavity model.
Either one microfacet is backfacing and completely masked
(a) or the two microfacets are completely visible (b).
c
2014 The Author(s)
Computer Graphics Forum
c
2014 The Eurographics Association and John Wiley & Sons Ltd.