6
$\begingroup$

I'm trying to implement Cook-Torrance BRDF and had previously bookmarked this question as it looked very well thought out. Going through it, I'm confused about the Fresnel equation. The author has the equation:

$$ F = c_{spec} + (1 - c_{spec}) (1 - \mathbf{w_i} \cdot \mathbf{h})^5 \tag{1} $$

and says "$c_{spec}$ is the specular color"

Looking elsewhere, I can see this equation is Schlick's approximation, but in other references, $c_{spec}$ is called $R_0$ and is $\left(\frac{n_1-n_2}{n_1+n_2}\right)^2$ which is clearly a number based upon refractive indices and not a colour.

Does equation $(1)$ make sense with colour?

$\endgroup$
  • 1
    $\begingroup$ Inspired by your question, I've posted a related one regarding the use of more accurate Fresnel approximations in a RGB-based path tracer. I am just commenting it here in the case you are interested. $\endgroup$ – Christian Pagot Mar 19 '17 at 21:06
  • $\begingroup$ Brilliant. I have tried to implement gold appearance but don't think it looks right and have been reading more about Fresnel, extinction coefficients, etc. I'm not on this full time so it's going slow. Thanks. $\endgroup$ – PeteUK Mar 19 '17 at 22:32
7
$\begingroup$

Yes, because refractive index can vary with wavelength. This is the origin of colored specular reflection in metals such as gold and copper; most other materials have essentially uncolored specular. At each wavelength, the specular reflectance at normal incidence is related to the refractive index at that wavelength according to the formula you mentioned.

In case you're interested, the site refractiveindex.info has data tables and graphs of refractive index versus wavelength for various materials. For example, here's gold:

refractive index of gold vs wavelength

$\endgroup$
  • $\begingroup$ Thanks. So to come up with the specular colour for gold, I'd need to lookup the wavelengths for red, green, and blue components. With those wavelengths I lookup the corresponding refractive indices for gold. Then plug them in the formula for $R_0$ and those 3 values are the components of the specular colour? $\endgroup$ – PeteUK Feb 25 '17 at 0:56
  • 2
    $\begingroup$ @PeteUK Yep, as an easy way, you can use representative wavelengths for R, G, B like that. Probably a more accurate way is to integrate $R_0(\lambda)$, multiplied by one of the CIE color matching functions, over wavelength. $\endgroup$ – Nathan Reed Feb 25 '17 at 0:59
  • 1
    $\begingroup$ @PeteUK In complement to the answer posted by -Nathan, I would cite this article (seblagarde.wordpress.com/2011/08/17/…), by Sebastién Lagarde, where he briefly discusses the convertion between IOR and RGB values to be used in the Fresnel equation (Schlick's approximation). The ZIP file containing the source code of the converter is disguised as a PDF and the link can be found in the section "Specular color". $\endgroup$ – Christian Pagot Feb 27 '17 at 4:32
  • $\begingroup$ Taking a closer look at the conversion program (IOR->RGB) I mentioned above, I see that it actually converts IOR values into sRGB (gamma compressed) values. Wouldn't it be the case to convert just to RGB, since the final rendered (path traced) image will be gamma compressed? $\endgroup$ – Christian Pagot Feb 27 '17 at 4:46
  • $\begingroup$ @ChristianPagot Perhaps it's for storing in a sRGB specular color texture. The GPU would then decode to linear RGB when it's sampled. $\endgroup$ – Nathan Reed Feb 27 '17 at 4:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.