Wednesday, June 18, 2014

Spectral Rendering Part III - Dispersion

In addition to my renderer's capability to create iridescent and fluorescent materials using spectral rendering, I also wanted to include the ability to handle light dispersion in dielectric materials, which is caused by the fact that a material's index of refract is dependent on the wavelength of light passing through.  The index of refraction for a given wavelength of light can be determined by using the Sellmeier equation with material-specific coefficients.

Every camera ray is randomly given a wavelength of light associated with it in the range 390-700 with a step of 5. Thus, when it hits a dispersive material, it can reflect/refract properly based on the Fresnel equation (which also is wavelength dependent).  The contribution for each wavelength is multiplied by the RGB value for that wavelength (derived by integrating over the XYZ response sensitivity curves) assuming that each wavelength of light has equal intensity and is then normalized to 1 for each of the RGB color channels.

My image below is my best render thus far, but it still has some problems with it. Each diamond (which are actually two transformed instances of the same mesh - and so they share vertices) have a weird foggy haze on parts of their surfaces and I am not entirely sure where that is coming from. Also, I was hoping that the dispersion effects would be more prominent.

Some improvements I need to add include importance sampling the wavelength for each ray based on the XYZ curves instead of randomly choosing a wavelength, amongst some other minor details. Hopefully this will help with alleviating some of the above issues.

Update: I've added a second image and third image which include importance sampling the wavelengths with the proper weights and expanding the spectrum used. As you can see, the second image is brighter and more vivid.

I rendered my third image quite large at 720p and with many instances of the diamond mesh.

Click to see full size

1 comment: