### Control Keys

move to next slide (also Enter or Spacebar).
move to previous slide.
d  enable/disable drawing on slides
p  toggles between print and presentation view
CTRL  +  zoom in
CTRL  -  zoom out
CTRL  0  reset zoom

Slides can also be advanced by clicking on the left or right border of the slide.

### Notation

Type Font Examples
Variables (scalars) italics $a, b, x, y$
Functions upright $\mathrm{f}, \mathrm{g}(x), \mathrm{max}(x)$
Vectors bold, elements row-wise $\mathbf{a}, \mathbf{b}= \begin{pmatrix}x\\y\end{pmatrix} = (x, y)^\top,$ $\mathbf{B}=(x, y, z)^\top$
Matrices Typewriter $\mathtt{A}, \mathtt{B}= \begin{bmatrix}a & b\\c & d\end{bmatrix}$
Sets calligraphic $\mathcal{A}, B=\{a, b\}, b \in \mathcal{B}$
Number systems, Coordinate spaces double-struck $\mathbb{N}, \mathbb{Z}, \mathbb{R}^2, \mathbb{R}^3$

### List of Math Symbols

Symbol Meaning
$\Omega$ Solid angle
$\theta$ Polar angle in the spherical coordinate system
$\phi$ Azimuth angle in the spherical coordinate system
$\Phi$ Radiant flux
$I$ Radiant intensity
$E$ Irradiance
$L$ Radiance
$\mathrm{f}_r$ BRDF (Bidirectional Reflection Distribution Function)
$\mathrm{f}_d$ Diffuse part of the BRDF
$\mathrm{f}_s$ Specular part of the BRDF

### List of Math Symbols

Symbol Meaning
$\mathbf{n}$ Surface normal
$\mathbf{v}$ Unit vector in view direction
$\mathbf{l}$ Unit vector in light direction
$\eta$ Refractive index
$F$ Fresnel reflectance
$\mathbf{h}$ Halfway vector between light and view direction
$(\dots)_+$ Ramp function
$\langle \mathbf{a}\cdot \mathbf{b}\rangle$ Scalar product

### PBR Materials

• Physically-Based Rendering ("PBR") is widely used
• PBR material models [Walter et al. 2007] are nowadays used everywhere for real-time and offline rendering (industry standard)[Disney 2012] [Unreal Engine 2013] [Frostbite 2014]
• The BSDF consists of the following components [Disney 2015]:
• BRDF Dielectrics
• BRDF Metals
• BTDF
• Emission
• Clear Coat
• Sheen
• Subsurface Scattering
• By combining the individual components, a wide range of different materials can be represented

### Disney BSDF

BTDF
BRDF Dielectrics
BRDF Metals
BRDF = Bidrectional Reflection Distribution Function
BTDF = Bidrectional Transmission Distribution Function
BSDF = Bidrectional Scattering Distribution Function

## BRDF

### Microfacet BRDF

Microfacets
Macroscopic behavior
$\mathbf{v}$
$-\mathbf{l}$
$\mathbf{h}$
$\mathbf{n}$
• Mathematical modeling of the surface by microfacets (much smaller than a pixel). The rougher the surface, the larger is the variation of their orientation [Cook Torrance 1981]
• The BRDF consists of a diffuse and a specular part
$\mathrm{f}_r(\mathbf{v}, \mathbf{l}) = \mathrm{f}_d(\mathbf{v}, \mathbf{l}) + \mathrm{f}_s(\mathbf{v}, \mathbf{l})$
• Diffuse part is constant (or zero):
$\mathrm{f}_d(\mathbf{v}, \mathbf{l}) = \frac{\rho_d}{\pi}$
• The BRDF of the specular part is:
$\mathrm{f}_s(\mathbf{v}, \mathbf{l}) = \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l}, \mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle}$
with
• $\mathrm{F}$: Fresnel reflectance
• $\mathrm{D}$: Normal distribution function (NDF)
• $\mathrm{G}$: Geometry term

### Fresnel Reflectance

• The ratio of reflected and transmitted light depends on the angle of incidence of the light rays and the refractive indices of the materials
Image source: Blue Lounger Beside Swimming Pool, CC0, public domain

### Fresnel Reflectance: Dielectrics

• Light is either reflected, transmitted or absorbed with an angle-dependent relative frequency
• The reflected part is scattered on the microfacets. Macroscopically, this creates the specular part of the reflection.
• In opaque materials, the transmitted parted is randomly deflected below the surface, partially absorbed (wavelength dependent) and emitted at different angles. Macroscopically, this creates the diffuse part of the reflection.
• The more light is reflected, the less light is transmitted (and the diffuse part becomes smaller)
Microfacets
Macroscopic behavior
$\mathbf{n}$
Specular part
Diffuse part

### Fresnel Reflectance: Metals

• In metals, the transmitted portion is absorbed, i.e. there is no diffuse reflection
• The reflected part depends on the wavelength, so the specular part is colored
Microfacets
Macroscopic behavior
$\mathbf{n}$
Specular part

### Fresnel Equations

$\eta_1$
$\eta_2$
$\theta_1$
$\theta_1$
$\theta_2$
$\mathrm{F}$
$1-\mathrm{F}$
• Reflected part:
\begin{align} \mathrm{F}_{\tiny\mbox{para}} &= \frac{\eta_2 \cos \theta_1 - \eta_1 \cos \theta_2}{\eta_2 \cos \theta_1 + \eta_1 \cos \theta_2}\\ \mathrm{F}_{\tiny\mbox{perp}} &= \frac{\eta_2 \cos \theta_2 - \eta_1 \cos \theta_1}{\eta_2 \cos \theta_2 + \eta_1 \cos \theta_1}\\ \mathrm{F} &= \frac{1}{2} \left(\mathrm{F}_{\tiny \mbox{para}}^2 + \mathrm{F}_{\tiny\mbox{perp}}^2\right) \end{align}
• Refracted part: $1 - F$
• In case of a transition from an optically thinner to optically denser medium ($\eta_1 < \eta_2$), the ray is deviated towards the normal. In the other case, the ray is deviated away from the normal.
• The mathematical relationship between the angle of incidence $\theta_1$ and the angle of the refracted ray $\theta_2$ is:
$\eta_1 \sin(\theta_1) = \eta_2 \sin(\theta_2)$

### Fresnel Reflectance (Dielectrics)

Material Index of Refraction $\mathrm{F}_0$
Vacuum 1.0 0%
Air 1.000292 ≈ 0%
Water 1.333 2%
Glass 1.5 4%
Plastic 1.5 to 1.58 4% to 5%
Diamond 2.42 17.24%
• $\mathrm{F}_0$ is the reflectance for perpendicular incidence of light $\theta_1 = 0$:
$\mathrm{F}_0 = \frac{(\eta_2 - \eta_1)^2}{(\eta_2 + \eta_1)^2}$

### Fresnel Reflectance (Metals)

Metals $\mathrm{F}_0$ (Linear, Float) $\mathrm{F}_0$ (sRGB, 8-bit) Color
Titanium (0.542, 0.497, 0.449) (194, 187, 179)
Chrome (0.549, 0.556, 0.554) (196, 197, 196)
Iron (0.562, 0.565, 0.578) (198, 198, 200)
Nickel (0.660, 0.609, 0.526) (212, 205, 192)
Platinum (0.673, 0.637, 0.585) (214, 209, 201)
Copper (0.955, 0.638, 0.538) (250, 209, 194)
Palladium (0.733, 0.697, 0.652) (222, 217, 211)
Zinc (0.664, 0.824, 0.850) (213, 234, 237)
Gold (1.022, 0.782, 0.344) (255, 229, 158)
Aluminum (0.913, 0.922, 0.924) (245, 246, 246)
Silver (0.972, 0.960, 0.915) (252, 250, 245)
Source: Naty Hoffman: Physics and Math of Shading, SIGGRAPH 2015 Course: Physically Based Shading in Theory and Practice

### Fresnel Reflectance

• In the microfacet model, the angle $\theta_1$ is the angle between the viewing direction $\mathbf{v}$ and the halfway vector $\mathbf{h}$, because only those microfacets, which have the macroscopic halfway vector as normal, have a reflection in the viewing direction
• According to [Cook Torrance 1981] the reflectance for $\eta_1 = 1$ is calculated by:
\begin{align}c &= \langle\mathbf{v} \cdot \mathbf{h}\rangle \\ g &= \sqrt{\eta_2^2+ c^2 - 1}\\ F_{\tiny \mbox{Cook-Torrance}}(\mathbf{v}, \mathbf{h}) &= \frac{1}{2} \left( \frac{g - c}{g + c} \right)^2 \left( 1 + \left( \frac{ c\,(g + c) - 1 }{ c\,(g - c)+ 1 } \right)^2 \right) \end{align}
Microfacets
Macroscopic behavior
$\mathbf{v}$
$-\mathbf{l}$
$\mathbf{h}$
$\mathbf{n}$

### Fresnel Reflectance

• Alternatively, the Schlick approximation [Schlick 1994] of the Fresnel reflectance can be used, which is faster to compute:
$F_{\tiny \mbox{Schlick}}(\mathbf{v}, \mathbf{h}) = \mathrm{F}_0 + \left(1.0 − \mathrm{F}_0\right) \left(1.0 − \langle\mathbf{v} \cdot \mathbf{h}\rangle \right)^5$
• The figure shows the comparison for glass with $\mathrm{F}_0 = 0.04$
$F_{\tiny \mbox{Cook-Torrance}}$
$F_{\tiny \mbox{Schlick}}$
Angle in degree
Reflectance

### Normal Distribution Function (NDF)

• The distribution of the microfacet normals changes depending on the roughness of the surface
• For a rougher surface, the distribution around the surface normal is more scattered
• There are several suggestions for the normal distribution in the literature [Walter et al. 2007]:
$\mathrm{D}_{\tiny \mbox{Blinn}}(\mathbf{h}) = \frac{1}{ \pi \alpha^2 } \langle\mathbf{n} \cdot \mathbf{h}\rangle^{n_s}$   with  $n_s = 2\alpha^{-2} - 2$
$\mathrm{D}_{\tiny \mbox{Beckmann}}(\mathbf{h}) = \frac{1}{ \pi \alpha^2 \langle\mathbf{n} \cdot \mathbf{h}\rangle^4 } \exp{ \left( \frac{ \langle\mathbf{n} \cdot \mathbf{h}\rangle^2 - 1}{\alpha^2 \langle\mathbf{n} \cdot \mathbf{h}\rangle^2} \right) }$
$\mathrm{D}_{\tiny \mbox{GGX}}(\mathbf{h}) = \frac{\alpha^2}{\pi \left(\langle\mathbf{n} \cdot \mathbf{h}\rangle^2 (\alpha^2-1)+1\right)^2}$
• where $\alpha = r_p^2$ with the perceived roughness $r_p$ in range [0.0, 1.0]

### Geometry Term

• Depending on the direction of incidence of the light and the viewing direction of the observer, shadowing and masking effects occur at the microfacets
• [Blinn 1977] and [Cook Torrance 1981] assume the microfacets are V-shaped and derive a geometry factor $0 \le G \le 1$ from this model.
No interference
$\mathbf{n}$
$-\mathbf{l}$
$\mathbf{v}$
$\mathbf{h}$
$\mathbf{n}$
$-\mathbf{l}$
$\mathbf{v}$
$\mathbf{h}$
$\mathbf{n}$
$-\mathbf{l}$
$\mathbf{v}$
$\mathbf{h}$
$\mathrm{G}_{\tiny \mbox{Cook-Torrance}}(\mathbf{l}, \mathbf{v}) = \operatorname{min}\left( 1, \frac{ 2 \langle\mathbf{n} \cdot \mathbf{h}\rangle \langle\mathbf{n} \cdot \mathbf{v}\rangle }{ \langle\mathbf{v} \cdot \mathbf{h}\rangle}, \frac{ 2 \langle\mathbf{n} \cdot \mathbf{h}\rangle \langle\mathbf{n} \cdot \mathbf{l}\rangle }{ \langle\mathbf{v} \cdot \mathbf{h}\rangle} \right)$

### Geometry Term

• Another well-known model from [Smith 1967] combines the geometry factor from a component for light direction and one for the view direction:
$\mathrm{G}_{\tiny \mbox{Smith}}(\mathbf{l}, \mathbf{v}) = \mathrm{G}_1(\mathbf{l}) \mathrm{G}_1(\mathbf{v})$
• Different $\mathrm{G}_1$ according to [Walter et al. 2007] are:
$\mathrm{G}_{1\ \tiny \mbox{Beckmann}}(\mathbf{v}) =\left\{ \begin{array}{l l} \frac{ 3.535 \,c \,+ \,2.181 \,c^2 }{ 1 \,+ \,2.276 \,c \,+ \,2.577 \,c^2 } & : \,\, c < 1.6\\ 1 & : \,\, c \ge 1.6\\ \end{array} \right.$    mit   $c = \frac{\langle\mathbf{n} \cdot \mathbf{v}\rangle}{ \alpha \sqrt{1 - \langle\mathbf{n} \cdot \mathbf{v}\rangle^2} }$
$\mathrm{G}_{1\ \tiny \mbox{GGX}}(\mathbf{v}) = \frac{ 2 \, \langle\mathbf{n} \cdot \mathbf{v}\rangle }{ \langle\mathbf{n} \cdot \mathbf{v}\rangle + \sqrt{ \alpha^2 + (1 - \alpha^2)\langle\mathbf{n} \cdot \mathbf{v}\rangle^2 } }$
• Fast approximation [Schlick 1994] for the GGX variant:
$\mathrm{G}_{1\ \tiny \mbox{Schlick-GGX}}(\mathbf{v}) =\frac{\langle\mathbf{n} \cdot \mathbf{v}\rangle}{\langle\mathbf{n} \cdot \mathbf{v}\rangle(1 - k) + k }$    mit   $k = \frac{\alpha}{2}$

### Geometry Term

$\mathrm{G}_{1\ \tiny \mbox{Beckmann}}$
$\mathrm{G}_{1\ \tiny \mbox{GGX}}$
$\mathrm{G}_{1\ \tiny \mbox{Schlick-GGX}}$
$r_p = 0.00$
$r_p = 0.25$
$r_p = 0.50$
$r_p = 0.75$
$r_p = 1.00$
$\alpha = r_p^2$

### Example: GGX Microfacet BRDF in GLSL

vec3 fresnelSchlick(float cosTheta, vec3 F0) {
return F0 + (1.0 - F0) * pow(1.0 - cosTheta, 5.0);
}

float D_GGX(float NoH, float roughness) {
float alpha = roughness * roughness;
float alpha2 = alpha * alpha;
float NoH2 = NoH * NoH;
float b = (NoH2 * (alpha2 - 1.0) + 1.0);
return alpha2 / (PI * b * b);
}

float G1_GGX_Schlick(float NdotV, float roughness) {
//float r = roughness; // original
float r = 0.5 + 0.5 * roughness; // Disney remapping
float k = (r * r) / 2.0;
float denom = NdotV * (1.0 - k) + k;
return NdotV / denom;
}

float G_Smith(float NoV, float NoL, float roughness) {
float g1_l = G1_GGX_Schlick(NoL, roughness);
float g1_v = G1_GGX_Schlick(NoV, roughness);
return g1_l * g1_v;
}

vec3 microfacetBRDF(in vec3 L, in vec3 V, in vec3 N,
in vec3 baseColor, in float metallicness,
in float fresnelReflect, in float roughness) {

vec3 H = normalize(V + L); // half vector

// all required dot products
float NoV = clamp(dot(N, V), 0.0, 1.0);
float NoL = clamp(dot(N, L), 0.0, 1.0);
float NoH = clamp(dot(N, H), 0.0, 1.0);
float VoH = clamp(dot(V, H), 0.0, 1.0);

// F0 for dielectics in range [0.0, 0.16]
// default FO is (0.16 * 0.5^2) = 0.04
vec3 f0 = vec3(0.16 * (fresnelReflect * fresnelReflect));
// in case of metals, baseColor contains F0
f0 = mix(f0, baseColor, metallicness);

// specular microfacet (cook-torrance) BRDF
vec3 F = fresnelSchlick(VoH, f0);
float D = D_GGX(NoH, roughness);
float G = G_Smith(NoV, NoL, roughness);
vec3 spec = (D * G * F) / max(4.0 * NoV * NoL, 0.001);

// diffuse
vec3 rhoD = vec3(1.0) - F; // if not specular, use as diffuse
rhoD *= 1.0 - metallicness; // no diffuse for metals
vec3 diff = rhoD * baseColor / PI;

return diff + spec;
}

### Sampling the GGX microfacet BRDF

• The specular part of the GGX microfacet BRDF is:
\begin{align}L_{o,s}(\mathbf{v}) &= \int\limits_\Omega \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \, d\omega \end{align}
• This is an integral over all incoming light directions $\mathbf{l}$
• The normal distribution function $\mathrm{D}(\mathbf{h})$ of the microfacets is a function of the halfway vector $\mathbf{h}$
$\mathrm{D}_{\tiny \mbox{GGX}}(\mathbf{h}) = \frac{\alpha^2}{\pi \left(\langle\mathbf{n} \cdot \mathbf{h}\rangle^2 (\alpha^2-1)+1\right)^2}$
• Since this distribution is given as an analytic function, the integral should be solved by importance sampling over the halfway vector

### Sampling the GGX microfacet BRDF

$\mathbf{v}$
$-\mathbf{l}$
$\mathbf{h}$
$\mathbf{n}$
• Relation between $\mathbf{l}$ and $\mathbf{h}$
• As can be seen from in the figure, $\mathbf{l}$ can be computed by reflecting $\mathbf{v}$ at $\mathbf{h}$
• It follows:
$\mathbf{l} = 2 \,(\mathbf{v}^\top \mathbf{h}) \, \mathbf{h} - \mathbf{v}$

### Sampling the GGX microfacet BRDF

• Integration by substitution (change of variables):
\begin{align}L_{o,s}(\mathbf{v}) &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \, d\omega\\ &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \, \frac{d\omega}{d\omega_h} \,d\omega_h\\ &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \, \frac{\sin(\theta)\, d\theta \,d\phi}{\sin(\theta_h) \,d\theta_h d\phi_h} \,d\omega_h \end{align}
$d\omega = \sin(\theta)\, d\phi\, \cdot d\theta$

### Sampling the GGX microfacet BRDF

\begin{align}L_{o,s}(\mathbf{v}) &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \, \frac{\sin(\theta^\ast) \,d\theta^\ast \,d\phi^\ast}{\sin(\theta_h^\ast) \,d\theta_h^\ast \,d\phi_h^\ast} \,d\omega_h \end{align}

with $\theta^\ast = 2 \,\theta_h^\ast$ and $\phi^\ast = \phi_h^\ast$

\begin{align}L_{o,s}(\mathbf{v}) &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \,\frac{\sin(2 \theta_h^\ast) \,2 \,d\theta_h^\ast \,d\phi_h^\ast}{\sin(\theta_h^\ast) \,d\theta_h^\ast \, d\phi_h^\ast} d\omega_h\\ &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \cos(\theta) \,\frac{2 \sin(\theta_h^\ast) \cos(\theta_h^\ast) \,2}{\sin(\theta_h^\ast)} d\omega_h\\ &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{4\,\,\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \,\cos(\theta) \,\,4 \cos(\theta_h^\ast) \,d\omega_h\\ &= \int\limits_{\Omega_h} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \,\cos(\theta_h^\ast) \,d\omega_h\\ &= \int\limits_{0}^{2\pi}\,\int\limits_{0}^{\frac{\pi}{2}} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle \,\sin(\theta_h) \, d\theta_h \, d\phi_h\\\\ \end{align}

### Sampling the GGX microfacet BRDF

• Importance sampling:
\begin{align}L_{o,s}(\mathbf{v}) &= \int\limits_{0}^{2\pi}\,\int\limits_{0}^{\frac{\pi}{2}}\underbrace{ \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle \,\sin(\theta_h)}_{\mathrm{f}(\theta_h, \phi_h)} \, d\theta_h \, d\phi_h\\ &\approx \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{f}(\theta_{h}, \phi_{h})}{\mathrm{p}(\theta_{h}, \phi_{h})}\\[1.5ex] &=\frac{1}{N} \sum_{n=1}^{N} \frac{\frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{D}(\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v})}{\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle \,\sin(\theta_h)}{\mathrm{D}(\mathbf{h}) \cos(\theta_h) \sin(\theta_h)}\\[1.5ex] &= \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle}{\langle\mathbf{n} \cdot \mathbf{h}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l})\\ \end{align}

### Sampling the GGX microfacet BRDF

• The overall result is:
\begin{align}L_{o,s}(\mathbf{v}) &\approx \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{F}(\mathbf{v},\mathbf{h})\,\mathrm{G}(\mathbf{l},\mathbf{v}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle}{\langle\mathbf{n} \cdot \mathbf{h}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l})\\ \end{align}
with $\mathbf{h} = \begin{pmatrix}\sin(\theta_h) cos(\phi_h) \\ \sin(\theta_h) \sin(\phi_h)\\ \cos(\theta_h)\end{pmatrix}$  and   $\mathbf{l} = \operatorname{reflect}(-\mathbf{v}, \mathbf{h})$
where $\phi_h = 2 \pi \,h_2(n)$ and $\theta_h = \arccos\left(\sqrt{\frac{1 - h_3(n)}{h_3(n) (\alpha^2-1) + 1} }\right)$
and $\operatorname{reflect}$ refers to the GLSL function reflect:
$\operatorname{reflect}(\mathbf{i}, \mathbf{n}) = \mathbf{i} - 2 \,(\mathbf{i}^\top \mathbf{n}) \, \mathbf{n}$

## BTDF

### Sampling the GGX Microfacet BTDF

• The behavior of the transmission should correspond to that of the specular part of the reflection
• Therefore, the same sampling approach as for the reflection can be used, except that $\mathbf{l}$ is now obtained by the refraction of the view vector $\mathbf{v}$ at the halfway-vector $\mathbf{h}$:
\begin{align}L_{o,t}(\mathbf{v}) &\approx \frac{1}{N} \sum_{n=1}^{N} \frac{(1 - \mathrm{F}(\mathbf{v},\mathbf{h}))\,\mathrm{G}(\mathbf{l},\mathbf{v},\mathbf{h}) \,\langle\mathbf{v} \cdot \mathbf{h}\rangle}{\langle\mathbf{n} \cdot \mathbf{l}\rangle\,\,\langle\mathbf{n} \cdot \mathbf{v}\rangle} \,L_i(\mathbf{l})\\ \end{align}
with $\mathbf{h} = \begin{pmatrix}\sin(\theta_h) cos(\phi_h) \\ \sin(\theta_h) \sin(\phi_h)\\ \cos(\theta_h)\end{pmatrix}$  and   $\mathbf{l} = \operatorname{refract}(-\mathbf{v}, \mathbf{h}, \eta)$
where $\phi_h = 2 \pi \,h_2(n)$ und $\theta_h = \arccos\left(\sqrt{\frac{1 - h_3(n)}{h_3(n) (\alpha^2-1) + 1} }\right)$
and $\operatorname{refract}$ refers to the GLSL function refract

### Sampling the GGX microfacet BTDF

$-\mathbf{v}$
$\mathbf{l}$
$\mathbf{n}$
$-\mathbf{v}$
$\mathbf{l}$
$\mathbf{n}$
$\mathbf{-n}$
$\mathbf{-n}$
$\eta = \frac{\eta_1}{\eta_2}$
$\eta = \frac{\eta_2}{\eta_1}$

### Microfacet BTDF

• According to [Walter et al. 2007] the BTDF for the transmitted component is given by
$\mathrm{f}_t(\mathbf{v}, \mathbf{l}) = \frac{|\langle\mathbf{h}_t \cdot \mathbf{v}\rangle|}{|\langle\mathbf{n} \cdot \mathbf{v}\rangle|} \frac{|\langle\mathbf{h}_t \cdot \mathbf{l}\rangle|}{|\langle\mathbf{n} \cdot \mathbf{l}\rangle|}\frac{(1.0 - \mathrm{F}(\mathbf{v},\mathbf{h}_t))\,\mathrm{D}(\mathbf{h}_t)\,\mathrm{G}(\mathbf{l},\mathbf{v},\mathbf{h}_t)}{\left(\eta_1 \langle\mathbf{h}_t \cdot \mathbf{l}\rangle + \eta_2 \langle\mathbf{h}_t \cdot \mathbf{v}\rangle\right)^2}$
with
$\mathbf{h}_t = - \frac{\eta_1 \mathbf{l} + \eta_2 \mathbf{v}}{|\eta_1 \mathbf{l} + \eta_2 \mathbf{v}|}$

### References

• [Schlick 1994] Christophe Schlick: An Inexpensive BRDF Model for Physically-Based Rendering. Computer Graphics Forum, 13 (3), 233–246, 1994.
• [Walter 2005] B. Walter: Notes on the Ward BRDF. Technical report PCG-05-06, Cornell University
• [Walter et al. 2007] B. Walter, S. R. Marschner, H. Li, K. E. Torrance: Microfacet Models for Refraction through Rough Surfaces. Eurographics Symposium on Rendering, 2007.
• [Smith 1967] B. Smith: Geometrical shadowing of a random rough surface. IEEE Transactions on Antennas and Propagation 15(5):668-671, Sep. 1967

### Are there any questions?

Please notify me by e-mail if you have questions, suggestions for improvement, or found typos: Contact