Diamond Caustics

Rendering a diamond as photo-realistically as possible is a 3D challenge. Light doesn't just bounce off an object; it enters it, bends, changes color, bounces back and looses intensity. To achieve all this requires the use of Caustics to handle this refraction of light as it passes through a diamond and onto its supporting surface. Also, to more accurately re-create the physical behavior of light in the diamond requires the use of a dielectric material. And just to add that touch of realism which indirect illumination creates, Global Illumination and Final Gather also need to be used.

Model and Scene Set-Up

The diamond was modeled separately from a gem cutter diagram and then imported into a scene resembling a photographic studio - the virtual set.

To better appreciate the Caustics effect, the diamond is first set-up and rendered using a standard light and transparent material using Mental Ray. It is lit by a high backlight casting a Depth Map Shadow onto the floor.

The diamond uses a Phong material for hard specular highlights and is set to be mostly transparent. The results are convincing - it looks like a diamond - but can be improved. I started by applying a dielectric material to the diamond.

The Dielectric_material

A dielectric material accurately simulates transparent objects such as glass, water and diamond. The word dielectric refers to any material that is a poor conductor of electricity. Unlike a material with a high transparency setting, it also uses Fresnel reflection and Beers law of light absorption. Fresnel reflection controls the amount of specularity of a surface according to the camera angle: the more perpendicular the surface is to the camera the more reflective the surface becomes. Beers law states that light is absorbed exponentially as it travels through a material. So light that has entered our diamond will be less bright as it exists.

There are six attributes to control the dielectric material: Col, Ior, Col_out, Ior_out, Ignore_normals and Phong_coef. Col is more than just the color of the material, it also controls "...the fraction of light which is left after traversing one unit of material. Thus 0.9 means that 10% of the light is absorbed per unit length of the material." (Maya Help manual). This is where Beers law is used and affects how much light can pass through the medium. Ior is Index of Refraction of the dielectric material. As light enters a medium denser than air, it bends. IoR affectively controls the density of the medium. Water has an IoR of 1.333 (4/3), Glass an IoR of 1.5 to 1.7, and Diamond an IoR of 2.419.

The Col and Ior attributes control how the light is behaving at either end of the object. When two dielectric materials are adjacent to each other then the Col_out and Ior_out are used to specify the respective values of the outside dielectric material. For example, a glass object would have an Ior of 1.5 and an Ior_out of 1.0 because air is on the outside of the glass. If the glass object were immersed in water, the Ior_out would be changed to 1.33.

If your object is well model, Ignore_normals can be left off. Whether a ray of light is entering or exiting an object can be determined by the direction of the object's normals. The dielectric material will use the normals of the surface to distinguish the medium on either side of the interface. For a dielectric-air interface the normals point into the air. For a dielectric-dielectric interface the normals point into a dielectric material which is outside. To use the dielectric material the model normals must be oriented correctly unless the ignore_normals parameter is set to true.

Phong_coef can also be turn off. It is used to generate fake highlights of an area light source. The Phong Coefficient will take care of how sharp or blurry the light rays will appear on a surface: higher values produce sharp highlights and lower values glossy, or more blurry highlights.

Diamond Material Set-up

Col is left at the default Value of 0.98. It can be adjusted latter if we want add a little color to the diamond. The IoR is simply looked up in an IoR index. For the diamond it is set to 2.419. As the diamond is sitting in air, the Col_out and Ior_out are left at their default value for air. An initial render produces the following result.

It's black! This is because in the Render Global Settings, Raytracing is turned on, but Refractions are set to 1. Light needs to enter and exit the diamond, so refractions happen twice. The Refractions are now set to 2. Also, since raytracing is in effect, the shadow is replaced with a raytraced shadow.

Starting to look like a diamond. Before entering into the caustics, the overall lighting of the scene can be improved. The diamond will be lit using the indirect light of Global Illumination and Final Gather. The surrounding environment is also going to have DGS materials to better control the indirect illumination.

Environment Materials and Photon Materials Set-up

All the objects in the scene need new materials. DGS materials will be used for the backdrop, reflector board, and room environment. Each of the objects in the scene also needs their own equivalent photon shader to control the Global Illumination and latter receive the caustics.

The Backdrop is a painted white wall. Acrylic based paint is usually a rough matte surface with most of the light reflected being diffuse. The backdrop material's Diffuse Value is therefore set to 0.85, with Hue and Saturation set to 0.0 as it is a white wall. Glossy and Specular are set to 0.0 as the wall is being used to scatter the light.

The Reflector Board is being used to catch the bouncing light and used to illuminate the sphere like a large soft light. Its Diffuse is set to a Value of 1.0 and Glossy and Specular are set to 0.0.

The Room Environment absorbs most of the light. Diffuse is reduced to 0.1, and Glossy and Specular are set to 0. Some light is reflected so that a Photon Map can be generated and we avoid the annoying "no photons stored after emitting 10000 photons" warning. This warning results when photons travel into infinite space, or are completely absorbed by a material and their reflection is not caught at least once.

Both the Backdrop and Room Environment need a photon material. To assign the DGS_material_photon, scroll to the Custom Shaders section of each material and select the add texture button next to the Photon Shader field. From the Photonic Materials group, choose DGS_material_photon. Ensure that both the photon material and material settings match. Turn on Opaque in the Flag section for all the materials (except the diamond), as it will speed up render times.

Lastly, the diamond needs its equivalent photon material. In the Photon Shader field of the diamond material link a dielectric_material_photon shader. Ensure that both the material and photon material settings are the same.

The next step is to set-up the lights to emit photons. These photons will be used to create both the Global Illumination and later the Caustics.

Lighting Set-Up

There are three main areas to cover when setting up the lights: applying a Physical Light Shader, converting the point light to a Mental Ray Area Light, and turning on Emit Photons.

Since the diamond is using a physically accurate dielectric material, a Physical Light shader is applied to the main light. This shader simulates the natural fall off, or decay of a light. To attach the Physical Light node, select the light and scroll down to the Mental Ray section, Custom Shaders section. Click on the add texture button next to the Light Shader field. A Create Render Node window will appear. Scroll down to the Lights section and select the Physical_light node. The Attribute Editor will switch to display the Physical_light settings. The default values are fine.

Area lights emit light from within a space defined by its shape. This produces a more accurate model for the light and softens the effect of raytraced shadows. To convert the Point Light into an Area Light, select the light again, and scroll down to the Area Light section in the Mental Ray section. Check Area Light. The default Rectangle Type and Sampling is used. Low Level is initially set to 3 to speed up rendering of shadows, but set back to 0 when final rendering. Also, area lights have direction, and need to be rotated to point at the object.

To enable Photon Emission, turn of Emit Photons in the Light's Caustics and Global Illumination section of the Mental Ray section. Default values are used initially and then adjusted after test rendering.

The scene is now set up and ready to render. The last step is to turn on the Global Illumination and Final Gather. Turning Final Gather Rays down to 100 and rendering with the rest of the settings at their default value produces the following:

Now, real diamonds cast light into their shadow - they are transparent objects and don't block all the light. Also, because light is being refracted, some of it gets focused into one spot like a lens. It's these 'bright shadows' we call caustics that are missing from the picture.

Caustics

Caustics are a light effect and the result of specular light transmission. It calculates light that remains focused, unlike Global Illumination which calculates how light diffuses. Caustics are usually seen as light patterns on a diffuse surface created by transparent mediums such as water and glass.

Like Global Illumination, Caustics use a photon map. Photons emitted from a light source are stored in the photon map and used to calculate the effect. Photons have already been turned on in the previous setup of Global Illumination - saving an extra step. Rendering with Caustics turned on, and at their default value produces.

Render times have increased, but when adding caustics to a scene, it is easier to visualize after indirect illumination has been taken into account. Notice the bright spots being cast onto the ground, and how internally the diamond is brighter. The next step is to improve the caustic effect.

Fine Tuning the Caustics

There are two places that the caustics can be improved, adjusting the photons emitted by the light and controlling the caustics in the Render Global Settings.

The brightness of the caustics can be controlled by the Photon Intensity setting in the light's Caustics and Global Illumination section.

Here the Photon Intensity has been decreased to 4,000. Note that this setting is now controlling the brightness of both the global illumination and caustics.

The Exponent value, below Photon Intensity is left at the default of 2. This is because a Light Shader is being used and the value of two is the natural decay of light.

Caustic Photons is the number of photons emitted by the light to create the caustic effect and stored in the photon map. The higher the value the better the quality, but the render times are longer. Setting it to 50,000 photons produced the following result - but took much longer to render.

There are now more light patterns and the results are sharper than the first render.

Caustics Settings

There are four Caustic settings in the Render Global Settings that can be used to improve quality and efficiency: Caustic Accuracy, Caustic Radius, Caustic Filter Type and Caustic Filter Kernel.
Caustic Accuracy controls the number of photons used to estimate the caustic brightness. Generally the default of 64 is fine and values above 100 will smooth the photons. Reducing the Accuracy to 1 though, can be a way of visualizing how the photons are behaving.

Here the Accuracy has been set to 1 (with the number of photons reduced back to 10,000 to get a quicker render). It can be seen here how the photons are being refracted onto the surrounding surface.

Caustic Radius controls the maximum distance at which photons are consider for caustics. Left at its default of 0, the radius is automatically calculated and is usually the best setting.

The Caustic Filter Type controls the sharpness of the caustics. There are two settings Box and Cone. Box will make caustics look sharper and Cone makes caustics look smoother. The resulting difference can be subtle and I have a preference for the Cone filter.

The Caustic Filter Kernel is the last of the settings and specifies the size of the filter applied to caustic photons. The default of 1.1 is fine in most cases.

Final Touches

To improve the final render quality:

  • Global Illumination and Caustic Photons from the light were both increased to 80,000
  • Photon Intensity was also increased to 6,000 to brighten the scene
  • The Max Reflection\Refraction Photons was increased to 6
  • And Max Photon Depth was increased to 10
  • Global Illumin and Caustic Accuracy was increased to 120
  • The Number of Samples was increased to Min = 0 and Max = 2
  • Multi-pixel Filtering set to Gauss
  • Jitter turned on in Sample Options
  • Raytracing increased to 10 for Reflections/Refractions and 20 for Max Trace Depth

Just for fun I set the Col of the diamond material to blue - not sure if there is such as thing as a blue diamond though.

Reference

The individual files for this tutorial are available for download:

01_set-up.mb
02_dielectric_mat.mb
03_GI&FG.mb;
04_caustics.mb
05_final.mb

Scenes were modeled and rendered using Maya 6

The caustics details were partly based on an article at Interstation3d

The dielectric material details were partly based on an article at Matty3d

Jeremy Birn's, "Digital Lighting and Rendering" has more information about the Fresnel Effect (Fresnel Reflections)

The Maya Help manual is copyright of Alias Software

Enter content...

Fetching comments...

Post a comment