11 and Global Illumination Chapter 11 Direct illumination occurs when a light source directly illuminates an object or objects in a scene. Indirect illumination occurs if light illuminates objects by reflection or transmission by other objects. Global Illumination is the technique used to describe Indirect Illumination. Indirect Illumination includes Global Illumination, Final Gather and effects such as. are light patterns formed by focused light. They are created when light from a source illuminates a diffuse surface by way of one or more specular reflections or transmissions. Examples of Caustic effects include the "hot spots" seen on surfaces when light is focused through a refractive glass or reflected off metal, or the patterns created on the bottom of a swimming pool from light shining through the water. Since Global Illumination and cannot be simulated efficiently using standard Raytracing methods mental ray uses a mechanism based on Photon Maps. Light is emitted from the source in the form of energy (called photons) and then followed as they bounce around a scene until they re either absorbed or escape to infinity. The absorbed photons are then stored in a Photon Map and used at render time to calculate illumination in a scene. Photons can be emitted from standard light sources as well as from user defined photon emitting shaders.
CHAPTER 11 A glass of cognac In this chapter, you will learn the following: How to use ; How to fine-tune ; How to use Global Illumination; How to fine-tune Global Illumination. In this exercise, you will learn to enable and fine-tune its effects. 1 Open scene file cognacglass_start.mb Render the scene to see the initial results using Maya Software Rendering. This is a simple scene consisting of a glass and a Spot Light. The glass and its contents have refractive materials, and the Spot Light casts Raytraced Shadows. You can see that the shadows cast by the glass are properly colored and transparent, but the image lacks the "hot spots" usually seen when light shines through glass. 280 RENDERING
CAUSTICS AND GLOBAL ILLUMINATION Initial render using Maya Software Renderer 2 Enable Open the Render Globals window and change your selected renderer to mental ray. In the mental ray tab of the Render Globals, go to the Quality Presets setting and select the Preview preset. Scroll to the Ray Tracing section and increase the Raytrace settings: Set Refractions to 6. This is the number of times the ray must go through a transparent surface before it stops. Set Max Trace Depth to 8 (Reflection rays + Refraction rays). Scroll to the and Global Illumination section and note that are now enabled. Increase Max Refraction Photons and Max Photon Depth to 6. The photon goes through 6 transparent surfaces before hitting a diffuse surface (the wall) and stopping. Therefore, the default value of 5 would not produce proper results. Scroll to the Translation section of the Render Globals, and set Export Verbosity to Progress Messages so that you can check Maya s Output Window for progress messages when you render. RENDERING 281
CHAPTER 11 3 Turn on photon emission In order to use, at least one of the light sources in your scene must emit photons. Each photon emitted by the light source is traced through the scene until it either hits a diffuse surface or until it has been reflected or transmitted a maximum number of times as indicated by the photon trace depth. The Caustic Photon Map holds just those photons that have been specularly reflected or refracted, before hitting a diffuse surface where they are stored. Note: It is also possible to use custom mental ray shaders as photon emitters. In the Hypershade s Lights tab, select spotlightshape1 and open the Attribute Editor. Scroll to the mental ray attribute section and turn on Emit Photons in the and Global Illumination subsection. Photon Intensity is the amount of light distributed by the light source. Each photon will carry a fraction of the light source energy and distribute it into the scene. Leave Photon Intensity at the default (8000) for now. The number of Caustic Photons emitted by the light source will determine the quality of the generated. More photons produce higher quality results, but also increase memory usage. A suggested workflow is to use the default number of photons or less while tuning your image, to produce quick, low-quality. You can increase the number of photons to produce higher quality images. Leave Caustic Photons at the default number (10000) for now. Exponent acts like decay; the intensity increases as the value decreases. The default value of 2 simulates quadratic (realistic) decay. Leave this setting at the default value for now. The Physical option will not be used. 282 RENDERING
CAUSTICS AND GLOBAL ILLUMINATION Caustic and Global Illumination light attributes 4 Test render the scene You should now see Caustic effects around the glass, but the brightness and quality will not be very good; the Caustic effects will be spotty. Further tuning is needed to improve the appearance of. Initial results of render with RENDERING 283
CHAPTER 11 5 Fine-tuning You may find that the Caustic effects are not bright enough. Raising or lowering the Photon Intensity of your light source will increase or decrease the brightness of your. Open the Attribute Editor for the light and, in the and Global Illumination section, change the Photon Intensity value until you have better results. Try a setting of 25000. In the mental ray tab of the Render Globals, scroll to the and Global Illumination section. The appearance of can be fine-tuned using the Caustic Accuracy and Radius settings. Radius controls the maximum distance at which mental ray considers photons. For example, to specify that only photons within 1 scene unit away should be used, set Radius to 1. When Radius is left at the default value of 0, the renderer will itself calculate an appropriate radius based on your scene size. However, this default result is not always acceptable, as in this case. Increasing the Radius will generally decrease noise but give a more blurred result. To decrease noise without blurring details, it would be necessary to increase the number of Caustic photons emitted by your light source. Increase Radius in small increments and test render until you have acceptable results. Try a setting of 1.5 or 2. Accuracy controls how many photons are considered during rendering. The default is 64; larger numbers make the smoother. For example, to specify that at most 100 photons should be used to compute the Caustic brightness, set Accuracy to 100. Increase Accuracy in small increments and test render until you have acceptable results. Try a setting of 100. 284 RENDERING
CAUSTICS AND GLOBAL ILLUMINATION Caustic Radius 2.000, Accuracy 100, Photon Intensity 25000 Changing the Caustic Filter Type to Cone can produce smoother results. In the mental ray tab of the Render Globals, scroll to the and Global Illumination section and change Caustic Filter to Cone. Results using Cone filter RENDERING 285
CHAPTER 11 Global Illumination To further increase the quality of Caustic effects, you can increase the amount of emitted photons. This will slow down your rendering time, but improve image quality. In the and Global Illumination attributes for your light, increase Caustic Photons. Try a setting of 20000. 20000 Caustic Photons, Accuracy 200, Radius 1.5 Further improvements to generally require experimentation with the light s Energy, Caustic Photons and Exponent values, as well as the Render Globals Caustic Accuracy and Radius values. The scene file cognacglass_finished.mb has the finished results of this exercise. Global Illumination In this exercise, you will enable Global Illumination and fine-tune the results. 1 Open scene file Global_start.mb This scene consists of a bike in a garage. The garage door is animated open, allowing indirect light to spill into the scene and illuminate its contents. Go to the last frame of the animation where the illumination will be at it s fullest. We will tune from there. 286 RENDERING
CAUSTICS AND GLOBAL ILLUMINATION Global Illumination 2 Enable Global Illumination Open the Render Globals window and change your selected renderer to mental ray. In the mental ray Render Globals, go to the Quality Presets setting and select the PreviewGlobalIllum preset. Scroll to the and Global Illumination section and note that Global Illumination is now enabled. 3 Turn on photon emission As with, at least one of the light sources in your scene must emit photons. In the Hypershade s Lights tab, select spotlightshape1 and open the Attribute Editor. Under the Spot Light attribute section, turn Intensity to 0. This means that all illumination in the scene will come solely from photons. Scroll to the mental ray attribute section and turn on Emit Photons in the and Global Illumination subsection. Leave Photon Intensity at the default 8000. Leave Exponent at its default value of 2 for now. Leave Global Illum Photons at the default number 10000. 4 Test render the scene There is very little if any illumination in the scene. Further tuning is needed. Note: If you get a message stating that "no photons stored after emitting 10000 photons" means that photons emitted by the source don t hit any energy-storing object. One reason this can happen is the photon emitting source is emitting photons in the wrong direction. 5 Change the Exponent value As mentioned in the previous exercise, the Exponent attribute represents decay. To increase the chances of photons reaching the back of the garage, increase your Exponent to 1. Render the scene. RENDERING 287
CHAPTER 11 Global Illumination 6 Change the Photon Intensity values Notice you can now see the bike at the back of the garage a little more clearly but, you may find that overall, the scene is still not bright enough. Change the Photon Intensity value to 15000. Render the scene. Exponent 1, Photon Intensity 15000 7 Change the Radius The scene is bright enough, but now we need to further fine-tune our photons. In the mental ray tab of the Render Globals, open the and Global Illumination section. Scroll to the Global Illum Radius section and increase this value from 0 to 1. Increasing this value will help smooth out the photons and reduce blotchiness. If you still find that your photons are not smooth enough, increase the Radius to 2. Continue increasing the radius until you see little or no change in image quality. Using the Keep Image button from the Render view window menu bar, will allow you to compare current renders to previous renders. When you reach the point where changing the Radius has little effect on the image, start increasing your Global Illum Accuracy value. 288 RENDERING
CAUSTICS AND GLOBAL ILLUMINATION Global Illumination Tip: Increase your Radius until you see no change in your render. Then start increasing the Accuracy value. 8 Increase the Accuracy Slowly increase the Global Illumination Accuracy values. This will further refine your photons, helping to smooth them. Radius 2, Global Illumination Accuracy 900 Further refinements All illumination in this scene comes solely from photons. You may find that the shadow information created this way is either weak or absent. The below image is an example of the above scene with a Directional Light with low intensity and soft Shadow Maps. This helps add depth to the scene and separate the bike from the background. In the next chapter, we cover Final Gather which can also be used to bump up shadow information. RENDERING 289
CHAPTER 11 SUMMARY Global Illumination and Shadow Maps SUMMARY Adding and Global Illumination to your scenes can help create more subtle and realistic light effects. This chapter covered the following topics: and Global Illumination; Enabling /Global Illumination in the Render Globals; Emitting photons from a light source; Fine-tuning Caustic and Global Illumination effects. 290 RENDERING