Raytracing Diamonds

presented by Sabine Fischer

Seminar Light & Color in Nature

presentation materials

Why do people render diamonds? Well, there are many reasons. Diamonds are expensive because of their rarity and their beauty. No other gemstone comes close to the dispersive power of a diamond. This dispersive power combined with a cut that maximizes total internal reflection results in sparkling rainbow colors. However, while a lot of total internal reflection is the source of the diamond's beauty, it also requires rays to be traced to a relatively high depth.

1. Ray significance

To minimize the number of recursively generated rays, it makes sense to assign a "significance" value to each ray. This value describes to what extent the final color depends on the ray. Considering that each time a ray intersects the diamond model several dispersed and reflected rays are generated, a model that discards rays that would contribute so little that the visual difference is not discernable speeds up the raytracing significantly.

See the difference between some low maximum recursion depth values:
Recursion depth of 3 Recursion depth of 4 Recursion depth of 7
These images were done with a rather bad lighting approach, however, the main point can still be seen with them.

2. Fresnel Term

Basically, each time a ray intersects the 3d model of the diamond, the Fresnel term is computed to decide the contribution of the reflected and dispersed rays. The Fresnel term is used to assign ray significance according to the parent ray significance. To speed up computations, an approximation to the Fresnel term is computed.

3. Dispersion

Colors in a diamond are the result of dispersion. Due to the varying index of refraction for different wavelengths, the dispersed rays travel different paths. This results in rainbow colors at the edges of reflected objects since the closer to the edge we get, the more rays miss the object.

4. Total internal reflection

Total internal reflection occurs when going from a denser to a thinner medium. Due to the refractive index of the diamond, the critical angle is reached easily in a diamond. Total internal reflection only enhances the color-splitting effect of dispersion by allowing the rays to travel a long way inside the diamond, their paths becoming more and more different during the course before they finally leave the diamond.

5. Some raytraced images

Experimented with lighting.

Recursion depth 7 with 2 light sources with intensities 0.5 and 0.7 Recursion depth 10 with 2 light sources with intensities 0.5 and 0.7
Recursion depth 10 with one light source with intensity 0.5 Recursion depth 10 with only one light source with intensity 0.7
Recursion depth 10 with 2 light sources with intensities 0.7 and 0.7
Recursion depth 10 with 2 light sources again with intensities 0.7 and 0.7, different light directions. I think this one turned out rather okay.