## Memo on Fresnel equations

Version : 1.3 – Living blog – First version was 29 April 2013

This post is a memo for me about misc thing I found related to the Fresnel equation as there is plenty of formula into the wild. I spend some times to gather these information and I was thinking it can interest others. This will not be really relevant to game rendering but still good to know. This could be useful when doing reference or when dealing with total internal reflection (frequent with multi layered BRDF). This is a memo, not a tutorial, so I won’t give basic explanation of many concepts like reflection/refraction, Snell’s law, index of refraction (IOR), total internal reflection (TIR), etc… At the end of the post I provide a Mathematica file with all the equations and graphs.

Notation for this post:

Conductor mean Metal and dielectric mean no-Metal material.

Light moves from a medium of a given IOR $n_i$ (incoming) into a second medium with IOR $n_t$ (transmitted).

Conductor have complex IOR with an imaginary part $k_t$ (note that’s t “transmitted” is a bad choice for conductor but I found it more identifiable than $n_1$ and $n_2$, $k_2$).

## Fresnel Equation basis

All equations using an index of refraction $n_t$ can be replace with the same equation using a complex index of refraction $n_t -\mathbf{i} k_t$.

Snell’s law dielectric-conductor interface : $\frac{\sin\theta_i}{\sin\theta_t}=\frac{n_t -\mathbf{i} k_t}{n_i}$

Snell’s law dielectric-dielectric interface : $\frac{\sin\theta_i}{\sin\theta_t}=\frac{n_t}{n_i}$

The calculations of the reflectance $R$ (What we are looking for when we want to calculate the percentage of reflection and transmission) depend on p- and s-polarization of the incident ray. $Rs$ and $Rp$ are the reflectivity for the two planes of polarization. $Rs$ is perpendicular (s = German senkrecht) and $Rp$ is parallel. The reflectance $R$ for unpolarized light is the average of $Rs$ and $Rp$:

$R=\frac{(R_s+R_p)}{2}=\frac{(r_\perp^2+r_\parallel^2)}{2}$

Following expressions use $R_s$ and $R_t$ or $r_\perp$ and $r_\parallel$ depend on cases to simplify notation.

## Spherical Gaussian approximation for Blinn-Phong, Phong and Fresnel

Spherical Gaussian approximation for lighting calculation is not new to the graphic community[4][5][6][7][8] but its use has  recently been adopted by the game developer community [1][2][3].
Spherical Gaussian (SG) is a type of spherical radial basis function (SRBF) [8] which can be used to approximate spherical lobes with Gaussian-like function.
This post will describe how SG can be use to approximate Blinn-Phong lighting, Phong lighting and Fresnel.

Why care about SG approximation ?
In the context of realtime rendering for games, the SG approximation allows to save a few instructions when performing lighting calculations. For modern graphics cards, saving few ALU in a shader is not always beneficial, but for older hardware like one can find in the PS3, every GPU cycle counts. This is less true for XBOX360 GPU, which performs better with arithmetic instructions, though this optimization can still be beneficial. It can also be used to schedule instructions in a different (low loaded) pipe on SPUs to increase performance [2].

Part of the work presented here credits to Matthew Jones (from Criterion Games) [9].

## Different spherical radial basis function

The post talk about SG, but it is good to know that there is several different types of SRBF found in graphics papers.
For completeness, I will talk quickly about SG and von Mises-Fisher (vMF) as this can be confusing.

SG definition can be found in [4]:
$G(v; p,\lambda,\mu)=\mu e^{\lambda(v.p -1)}$ where p ∈ 𝕊2 is the lobe axis, λ ∈ (0,+∞) is the lobe sharpness,
and μ ∈ ℝ is the lobe amplitude (μ ∈ ℝ3 for RGB color).

vMF is detailed in [8]:
$\gamma(n.\mu;\theta) = \frac{k}{4\pi \sinh(k)} e^{k(n.\mu)}$ with inverse width k and central direction μ. vMFs are normalized to integrate
to 1. Note: the notation from the paper [8] doesn’t match the notation from above.
The paper presents an approximation of this formula for k > 2 (which is almost always the case) : $\gamma(n.\mu;\theta)\approx \frac{k}{2\pi} e^{-k(1-n.\mu)}$

As you can see, the formulation stays the same for a lobe sharpness > 2, the difference lies only in the normalization constant for vMF, which we will omit. In the following, I will only refer to the SG function.

## Approximate Blinn-Phong with SG

An approximation of the Blinn-Phong model with SG is provided in the supplementary material of [4]:
$D(h)=(h.n)^k \approx e^{-k(1-(h.n))}$

Here is the comparison of the accuracy of the approximation for low specular power (<10), medium (25) and high( > 50)