Wednesday, November 27, 2013

Spectral Rendering and Iridescence Through Thin Film Interference

I really wanted to include iridescence as a feature for FancyRay and so in order to do that I had to include spectral rendering, which is where instead of using the conventional RGB model, light is treated as a combination of electromagnetic radiation at various wavelengths and intensities. Each wavelength of light interacts with the iridescent surface and depending on the thickness of the surface and the angle of view, the outgoing wavelength differs due to interference with other wavelengths.  The outgoing wavelengths are then converted to their XYZ tri-stimulus values using the CIE color matching functions and then finally the XYZ tri-stimulus values are converted using a matrix transformation into their RGB values in order to be displayed on the screen. The result is a nice rainbow effect. However, to avoid banding, Perlin Noise is used to get varying widths for the surface.

Below is a completed example of my iridescent bubble shader.



The image below is a semi-finished prototype. You can see the iridescence in place but the Fresnel term and specular highlight and refraction have not yet been added.





No comments:

Post a Comment