# 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[0],\kappa[0], \theta)$$ $$Fresnel_{Green} = F(\eta[1],\kappa[1], \theta)$$ $$Fresnel_{Blue} = F(\eta[2],\kappa[2], \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. – PeteUK Mar 29 '17 at 8:40
• @PeteUK Yes, I am using only one area light source (a sphere actually). I did not include rendered images with Schlick's so as not to clutter the question. However, I can send you equivalent images rendered with Schlick's Fresnel formulation along with the precise description of the scene so that you can reproduce on your renderer and compare. My email is available on my Github page (see my profile). – Christian Pagot Apr 1 '17 at 14:42
• Very kind, email on the way... – PeteUK Apr 1 '17 at 16:24