# More accurate Fresnel approximation for a RGB-based Path Tracer

I'm writing a path tracer and, for the moment, spectra related data (spectral power distributions and spectral reflectance curves) are stored as RGB tuples. In the Cook-Torrance specular BRDF I am using the Schlick's approximation for the Fresnel term:

$$F(\theta) = R_0 + (1-R_0)(1-\cos \theta)^5$$

where

$$R_0 = \left( \frac{\eta_1 - \eta_2}{\eta_1 + \eta_2} \right)^2$$

Schlick's approximation is fast and very convenient in the current context (e.g. for conductors, $R_0$ is simply the RGB tuple of the normal incidence reflectance of the metallic material).

However, despite being fast, Schlick's approximation is very simple (it does not take into account, for instance, the extinction coefficients of conductors). Some path tracers use much more accurate Fresnel formulations. PBRT, for instance, uses the following equations for the Fresnel terms:

Fresnel term for conductors

$$r^2_{||} = \frac{(\eta^2 + k^2) \cos \theta_i^2 - 2 \eta \cos \theta_i + 1}{(\eta^2 + k^2) \cos \theta_i^2 + 2 \eta \cos \theta_i + 1}$$

$$r^2_{\perp} = \frac{(\eta^2 + k^2) - 2 \eta \cos \theta_i + \cos \theta_i^2}{(\eta^2 + k^2) + 2 \eta \cos \theta_i + \cos \theta_i^2}$$

Fresnel term for dielectrics

$$r_{||} = \frac{\eta_t \cos \theta_i - \eta_i \cos \theta_t}{\eta_t \cos \theta_i + \eta_i \cos \theta_t}$$

$$r_{\perp} = \frac{\eta_i \cos \theta_i - \eta_t \cos \theta_t}{\eta_i \cos \theta_i + \eta_t \cos \theta_t}$$

For both equations, the resulting Fresnel reflectance is obtained with:

$$F=\frac{r^2_{||} + r^2_{\perp}}{2}$$

In the case of spectral path tracers, I believe that the use of the above Fresnel formulations would be straightforward (just a matter of feeding the formulas with already tabulated IORs and $\kappa$ data - such as those available at https://refractiveindex.info).

However, how could these formulations be used in a RGB-based path tracer? Is this even possible (I believe so, because these are the only Fresnel formulations used by PBRT and it works both with spectral and RGB-based spectral data - at least, to the best of my knowledge)? So, if yes, how to generate the IOR and $\kappa$ triplets to be used in the above formulations? If not, what would be the alternatives (with the exception of going fully spectral)?

UPDATE

I've found a potential answer to the question and, despite missing technical soundness (that's why I've just added it as an update and not as the actual answer), I am posting it here in the case someone may be interested or may have comments to add.

According to this OSL Shader, at least the complex Fresnel term (for conductors), in the context of an RGB-based path tracer, can be evaluated by simply substituting $\eta$ and $\kappa$ by those values corresponding to the R, G and B "representative" wavelengths. Since R, G and B are not narrow spikes on the electromagnetic spectrum, the "representative" wavelength may be a little different from one implementation to another. I've seen that the most common values for these representative wavelengths are 0.65$\mu$m for Red, 0.55$\mu$m for Green and 0.45$\mu$m for Blue.

For instance, suppose that we want to render the gold material. The $\eta$ and $\kappa$ values of gold, for our representative wavelengths (0.65$\mu$m, 0.55$\mu$m and 0.45$\mu$m), can be obtained from https://refractiveindex.info, and will be:

$$\eta_{gold} = ( 0.15557, 0.42415, 1.3831 )$$

$$\kappa_{gold} = ( 3.6024, 2.4721, 1.9155 )$$

Now, it is just a matter of evaluating the Fresnel reflectance for each color channel:

$$Fresnel_{Red} = F(\eta,\kappa, \theta)$$ $$Fresnel_{Green} = F(\eta,\kappa, \theta)$$ $$Fresnel_{Blue} = F(\eta,\kappa, \theta)$$

I have used this complex Fresnel equation within my Cook-Torrance BRDF, whose formulation can be seen here, and I've obtained the following results (I've compared them to reference images rendered with Mitsuba): Above image: Gold material rendered with (left) Mitsuba and (right) my renderer. Above image: Copper material rendered with (left) Mitsuba and (right) my renderer.

The images generated by my path tracer are noisier because it uses only BRDF importance sampling. With respect to copper, the images are, at least visually, almost identical. With respect to gold, colors are slightly different. I have made some experiments, and observed that very small changes on the values of the "representative wavelengths" might have significant impact on the final color. Thus, the color difference regarding the rendering of the gold material could be eventually attributed to differences regarding the "representative" wavelengths used by each renderer for R,G and B.

• I'm looking forward to going through this when time permits. Your results look good compared to reference. I'd be interested to see the images from your renderer with Schlick's. In my renderer, I'm trying to use image based lighting. My gold (with Schlick's) doesn't look great, but I'm not sure if that's because of the BRDF, or the lighting. Think I might move to area lights (is that what you use?), and work in a more controlled environment until I've got things right. Mar 29, 2017 at 8:40
• Very kind, email on the way... Apr 1, 2017 at 16:24
• You might be interested in Some Thoughts on the Fresnel Term by Naty Hoffman Jan 9, 2021 at 18:11

This would be a response to why is it possible to use the Fresnel equations in an RGB path tracer. Though evaluating Fresnel equation directly requires some what more information about the environment in which the rendering takes place, it certainly is possible to use it in an RGB path tracer. Here is why:

TLDR: see last two paragraphs.

The goal of Fresnel equations is to describe the relationship between the incident, reflected and transmitted planar light waves. In its most general form, it can describe this relationship even at the boundary of an interface (think of them as the zone of contact between one object and air or water).

Notice that we are considering lightwaves as plane waves which is an approximation. Now let's define the incident light as the uniform plane sinusoidal electromagnetic wave whose electric field is defined as $$\vec{E_i} = \vec{E_{0i}} e^{i(\vec{k} \cdot \vec{r} - \omega_i t)}$$ since $$e^{i\theta} = \cos(\theta) + i\sin(\theta)$$ and since we are dealing with measurable quantities we can let go of the complex part and simply write the incident light as $$\vec{E_i} = \vec{E_{0i}} \cos(\vec{k} \cdot \vec{r} - \omega_i t)$$. $$\vec{E_i}$$ is an electric field. Mathematically it is a vector field. Notice that once we get rid of the imaginary part the whole equation is just a cosine wave now with $$\vec{E_{0i}}$$ as the amplitude. $$\vec{k} \cdot \vec{r}$$ is the phase and $$\omega_i t$$ is the frequency. For surfaces with constant phase the $$\vec{k} \cdot \vec{r}$$ would be constant where $$\vec{r}$$ would designate the point/position in space and $$\vec{k}$$ the direction of the propagation of the wave.

We are interested in the relationship between $$\vec{E_i}$$, $$\vec{E_t}$$ and $$\vec{E_r}$$. With no knowledge about direction, frequency, phase, etc we can describe the reflected wave as $$\vec{E_r} = \vec{E_0r} \cos(\vec{k_r} \cdot \vec{r} - \omega_r t + \epsilon_r)$$ where $$\epsilon_r$$ is the phase constant with respect to $$\vec{E_i}$$. The transimited wave is defined the same way with $$\vec{k_t}$$, $$\omega_t$$, $$\epsilon_t$$ and $$E_{0t}$$. The $$\epsilon$$ is introduced because we have not specified the origin of the $$\vec{E_i}$$.

Well, after a lot of math which you can read from pages 122 - 124, we learn that they, $$\epsilon$$s, don't really matter and we can consider them as 0 throughout the discussion and that frequencies, $$\omega$$ of all three of them are equal (unless there is a doppler effect) and that phases of all three of them are related.

The relationship that is described by Fresnel equations is the amplitude of waves. Here are the full Fresnel equations from E. Hecht 2017, Optics, p. 124-125:

$$(\frac{E_{0r}}{E_{0i}})_{\perp} = \frac{\frac{n_i}{\mu_i}\cos(\theta_i) - \frac{n_t}{\mu_t}\cos(\theta_t)}{\frac{n_i}{\mu_i}\cos(\theta_i) + \frac{n_t}{\mu_t}\cos(\theta_t)}$$

$$(\frac{E_{0t}}{E_{0i}})_{\perp} = \frac{2\frac{n_i}{\mu_i}\cos(\theta_i)}{\frac{n_i}{\mu_i}\cos(\theta_i) + \frac{n_t}{\mu_t}\cos(\theta_t)}$$

$$(\frac{E_{0r}}{E_{0i}})_{||} =\frac{\frac{n_t}{\mu_t}\cos(\theta_i) - \frac{n_i}{\mu_i}\cos(\theta_t)}{\frac{n_i}{\mu_i}\cos(\theta_t) + \frac{n_t}{\mu_t}\cos(\theta_i)}$$

$$(\frac{E_{0t}}{E_{0i}})_{||} = \frac{2\frac{n_i}{\mu_i}\cos(\theta_i)}{\frac{n_i}{\mu_i}\cos(\theta_t) + \frac{n_t}{\mu_t}\cos(\theta_i)}$$

These are completely general statements, that is it applies to linear, isotropic, homogenous, even magnetic media. Using certain assumptions you can eliminate some of the terms. For example if you consider $$\mu_t \approx \mu_i$$ you can simply simply ignore them which would give you the common form of the equations, for example those that are used by PBRT.

Here are the terms of the equation:

• $$\mu$$ is the permeability: $$\mu_i$$ accounts for the magnetic effect of the incident media, $$\mu_t$$ accounts for the transmitted media
• $$n$$ is the index of refraction: $$n_i$$ for incident media, $$n_t$$ for transmitted media. It is related to k in discussion above.
• $$\theta$$ the angle is defined under the following constraints:
• $$\vec{E_i}$$ is perpendicular to the plane of incidence.
• $$\vec{B_i}$$, magnetic field, is parallel to the plane of incidence.
• With these constraints it can be proven that $$k$$s of all planes are coplanar, that is they are all defined on the plane of incidence which is perpendicular to the surface, and that $$\theta$$ is angle between the normal of the surface and the coplanar direction vectors. (image from, Hecht, Eugene. 2017. Optics. 5 ed/fifth edition, Global edition. Pearson Global Edition. Boston Columbus Indianapolis: Pearson, p. 123)

Now all of the terms and their are related concepts are given, yet we have not defined anywhere a term that relates directly to wavelength. Notice that we CAN include the wavelength to the frequency term of the cosine wave but since frequencies of all waves (incident, transmitted, reflected) are equal, we abstract it away from the relationship that we are trying to describe. That is why we can side step the whole spectral distributions machinary and still have visually plausable results.

Here are some approximations that can be done. You can approximate the $$k$$ and $$r$$ with incoming ray's direction and origin, the plane of incidence with collided surface normal, keep the frequency constant for all fields. For the majority of surfaces, the approximation $$\mu_i \approx \mu_t$$ holds as well. For other case they need to be looked up. IOR is also a material property so one has to look that up as well. If they are defined in a wavelength dependent manner, you can make an average and use that as an approximation as well.