I recently decided that it would be really cool to include the ability to handle light dispersion in dielectric materials, like diamonds. Most renderers out there do not account for dispersion at all, which is a shame because it produces really amazing visual affects.

Dispersion 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.

To implement dispersion, every camera ray is randomly given a wavelength of light associated with it in the range 360-700 with a step of 5 between each successive wavelength. Thus, when a ray hits a dispersive material, the index of refraction is calculated on the spot and the ray reflects/refracts probabilistically based on the Fresnel equations. The contribution for each wavelength is multiplied by the RGB value for that wavelength. This is accomplished by finding the XYZ response sensitivity for that particular wavelength and then converting the XYZ value to an RGB representation. Every wavelength is assumed to have the same intensity and the resulting RGB value is normalized such that if one were to add up all of the RGB values for each wavelength, each color channel would sum to 1. This is to ensure the conservation of light energy.

I have included three images below. In the first, the wavelength for each camera ray is randomly assigned. The end result is kind of dark and it doesn’t look as good as it could.

My second image was rendered using importance sampling. Initial wavelengths are chosen probabilistically based on their XYZ curves, and are then modulated by the appropriate weights, as per Monte Carlo integration. As you can see, this approach gives the diamonds a much more vivid appearance.

The third image was simply an attempt to go all out and see if I can create a really cool looking scene. This scene was rendered using my double gaussian lens system with moderate depth of field effects. Each diamond is a transformed instance of the same mesh with each instance sharing the same set of vertices in memory. This image was rendered quite large at 720p so I would recommend opening it in a new page to get the full effect.