Render the scene using caustics

 
 
 

To render using caustics you need to turn on specific settings or attributes. There are two sets of caustic-related attributes that you must initially set.

You initially render the scene using these attributes at their default settings to see how they affect the rendered image and then compare it to the previous raytrace rendering. As you gain more experience rendering with Caustics you will better understand what settings to initially use.

To turn on the caustics preset settings

  1. In the Render Settings window, select the Quality tab and set the Quality presets setting to Preview: Caustics.

    This turns on the presets that control the quality of the caustics.

  2. Close the Render Settings window.

Mental ray for Maya uses photons to simulate the caustic effects in a scene. Photons are small packets of energy emitted from a light source into the scene. The photons travel throughout the scene, refracting through transparent objects or reflecting off reflective surfaces. The renderer keeps track of the illumination that results from this photon emission in a file called a photon map. The overall caustic simulation is determined from the photon calculations that result.

In addition to having the spotlight emit light into the scene you set the light to also emit caustic photons. The overall caustic effect is determined from the photon calculations that result.

To turn on the caustics lighting settings

  1. In the Hypershade, double-click on the icon for spotLightShape1.
  2. In the Attribute Editor, click the spotLightShape1 tab to display the lighting attributes for the spotlight.
  3. Open the mental ray section, and in the Caustic and Global Illumination attributes set:
    • Emit Photons: On
    • Photon Intensity: 8000
    • Caustic Photons: 10000
  4. Hide the Attribute Editor.

Rendering the scene with caustics

Now that the lights are set to emit caustic photons and the caustics preset is turned on, you’re ready to render an image using caustics.

To render the scene using caustics

  1. In the Render View window, click the Redo Previous Render icon.
  2. When the image has completed rendering, click the Keep Image icon.
  3. Compare this rendered image with the previously rendered image by dragging the scroll bar at the bottom of the Render View window left and right.

    This image differs from the previous one in the following ways:

    • The bottle appears more opaque. This indicates that the correct number of refractions may not be occurring. The Raytracing Refraction Level setting may need to be increased. When a different preset was selected (Production to Preview), the refraction levels changed.
    • There are spotted areas on the table surface directly in front of the bottle. This can be corrected by adjusting the photon quality settings.
    • The desired caustic effect in the shadow has appeared but is not very pronounced. You want to achieve an effect where the shadow has brighter regions as a result of light being refracted through the surfaces of the bottle.

Adjusting the refraction levels

When the refraction levels are set too low, light rays do not refract through all of the surfaces enough to provide a realistic indication of a translucent surface when raytraced. This results in the object appearing opaque when it should appear translucent.

Increasing the Refractions setting allows the renderer to calculate what is seen through the surfaces of the glass by allowing the light rays to refract the correct number of times.

In the next step, you change the Refraction settings so that the bottle will appear translucent when rendered.

To increase the refraction levels

  1. In the Render Settings window, select the Quality tab and then open the Raytracing attributes.
  2. In the Raytracing section set the following:
    • Refractions: 6
    • Max trace depth: 8

    The Refractions setting sets the number of times a light ray can be refracted. When the setting is too low the ray does not penetrate through all of the surfaces. The Max Trace Depth setting limits the total Refraction and Reflection settings. By setting it to 8, you ensure that two reflection and six refraction calculations can occur.

Photons refract in a manner similar to light rays when rendering. Increasing the Refractions setting for the Caustic Photons ensures that the renderer can correctly calculate the caustics that should occur with the bottle. In this case, matching the Caustic Photon refraction settings with the Raytracing refractions is a good practice.

To increase the photon refraction settings

  1. In the Render Settings window, select the Indirect Lighting tab.
  2. In the Photon Tracing section set the following:
    • Max Photon Depth: 6
    • Photon Refractions: 6

    The Max Photon Depth setting limits the Refraction and Reflection calculations for the Caustic Photons to the limit set. The Photon Refractions setting is similar to the Refractions setting for raytracing but sets the refractions for the Caustic photons. Close the Render Settings window.

Increasing the brightness of caustics

Increasing the Photon Intensity setting increases the brightness of the refracted caustic that appears in the shadow of the bottle.

To increase the Photon Intensity

  1. In the Hypershade window, double-click the icon for spotLightShape1 to display the attributes for the spotlight.
  2. In the Caustic and Global Illumination attributes for the light adjust the settings to the following:
    • Photon Intensity: 36000

To render the scene

  1. In the Render View window, click the Redo Previous Render icon to render the image.
  2. Once the render is complete, click the Keep Image icon in the Render View window to save this image.
  3. Compare this rendered image with the previously rendered images.

    The translucency of the glass now appears more realistic. The caustic effect is more evident in the shadow of the bottle. However, the spotted effect, that appeared on the surface in front of the bottle, is more pronounced. These spots are the result of a low caustics quality setting.

Adjusting the quality of caustics

The quality of the caustic effects in a scene is primarily affected by the number of photons, the accuracy of sampling, and the radius surrounding the sampled area of illumination. (If you have previously completed the Global Illumination tutorial, you may notice similarities in this area.)

In the next steps, you return to the Render Settings window and the Attribute editor to increase the quality attributes that affect the caustics effect.

To increase the caustics quality settings

  1. In the Render Settings window, click on the Indirect Lighting tab and expand the Caustics section. Change the following Caustics attributes to:
    • Accuracy: 900
    • Radius: 1.5

    The Accuracy determines how many photons will be evaluated to determine the Caustic intensity at a given sampling point. Radius determines the size of the region surrounding the particular sampling point. The more photons that get sampled, the more realistic the caustic effect appears in the final image.

  2. Close the Render Settings window.

Increasing the number of caustic photons that get emitted into the scene also increases the quality of the caustic effect. When you increase the number of caustic photons you increase the density of the resulting photon map that gets produced at the beginning of the render process. The more photons, the smoother the resulting caustics effect.

Note

As you increase the caustic quality and photon settings so will the render time. Your goal should be to increase these settings just enough to achieve the desired image quality, without increasing them beyond what is required so that your rendering times are not adversely affected. Performing test renderings is the best method to determine these settings.

To increase the number of caustic photons

  1. In the Hypershade window, double-click the icon for spotLightShape1.
  2. In the Caustic and Global Illumination attributes, adjust the following settings:
    • Caustic Photons: 50000
  3. In the Render View window, click the Redo Previous Render icon.
  4. When the image has completed rendering, click the Keep Image icon and compare this rendered image with the previously rendered images.

    In this image the bright spots in front of the bottle should be reduced when compared to the previous images. The caustic in the bottle’s shadow should also appear more pronounced and more evenly illuminated.