What is Final Gather?

In the real world, objects reflect light onto adjacent surfaces. This reflection can be diffuse (like plastic) or direct (like metal) or any combination. Surfaces can even absorb light only to scatter it internally and emit it in a new direction with a different wavelength. In the case of Mental Ray’s Final Gather we are trying to achieve accurate diffuse reflections of one or more bounces. These reflections are the easiest and quickest way to add realism to a scene.

Your typical light in a render illuminates a surface by a lambert shading model (or something similar like a phong) where the object’s faces are illuminated by the angle they are facing relative to the light source. As the faces of a sphere turn away, they receive less light. No light is reflected from the lambert surface to any other surface or vise versa. Anything in the shadow of such an object or a polygon on the face of that object is invisible to the light. Such a scene is only natural on the surface of the moon.

Additionally, there is no ambient light coming from the sky in cg renders. The sky is blue because that is the wavelength of light entering the atmosphere most commonly bent (refracted) by the air molecules. Ambient lights in Maya don’t simulate this. They simply brighten the whole scene, not taking into account the fact that ambient light from the sky would illuminate a sphere more on top than on bottom where it is blocked (occluded) by the ground. Objects can occlude themselves- the outside of a car's rim would receive more ambient light than the inside or the disk brakes tucked away behind the spokes.

Final Gather works by shooting a ray from the camera into the scene. Where this invisible ray hits it measures the light intensity, then shoots off a number of secondary rays in a hemisphere. It then averages the intensity of points those secondary rays strike. The result is a smoother, brighter and more natural diffuse light. If the secondary ray intersects no objects, it can take its value from a sky dome. The third sphere image is an example of this. The secondary rays that traveled outside the box took the sky's blue color and averaged with the yellow sun spotlight.

Setting Up Final Gather

Final Gather doesn't shoot enough rays from the screen into the scene to get a clean rendering. Instead it relies on an averaging technique to approximate missing samples and create a smooth render. This is controlled by the "min" and "max radius" in the Final Gather tab. A good rule of thumb is to make the max radius 1/10th your scene's longest dimension and you min radius 1/100th that same measurement. If you do not want to measure your scene, Maya 7 allows you to let Mental Ray figure out that radius based on screen size (pixels) rather than maya units. Tick the "screen size" checkbox and set the min/max to 2/20 for tests, 1/10 or better for final. Decreasing the radius increases quality and reveals more detail, but requires final gather to shoot more rays, thus slowing the render.

Final Gather Rays are the second major player in controlling quality/speed. After getting a correct radius, I usually start with 25-50 rays when testing and increase to 200-400+ in the final animation.

Tips: Set the "filter" to 1. This controls speckling that can occur when samples taken near each other differ greatly in value (ex: noise in a HDRI skydome). "Final Gather Scale" controls the intensity of the FG effect.

Common Light Models

Outdoor: Use a Directional light with ray traced shadows, and Intensity greater than 1 with a yellow-orange color and create a skydome. To do this, open the Render Global's and go to the Image Based Lighting section. Click "Create". A special dome is built around your scene which is optimized for final gather rendering. Go to "Type" and select "Texture" in the drop down menu. Set the color to a sky blue. This provides a natural global illumination effect.

Indoor: Create the skydome as above and the directional light. Rendering now inside the building you will notice the scene isn't bright enough. To help the diffuse lighting along you can create area lights and place them in the windows. Real light decays (fades) with the inverse square of the distance. To do this, create a normal Maya point light (not area or spotlight), then go down to the Mental Ray tab and click the "Area Light" check box. Sampling controls the quality and should be left there for test renders. A max of 5x5 to8x8 for final renders produces a smooth shadow with little grain, but at greatly increased time. Low Level is to help render time when dealing with reflections and refractions. When a ray is reflected, refracted (or reflected+refracted) more times than the Low Level, Mental Ray uses the min sampling level. This increases the speed greatly.

HDRI Image: HDRI stands for High Dynamic Range Image. A normal image (LDR or Low Dynamic Range) uses 8 bits of information per color channel- that's 24 bits in an RGB image. HDRI can use substantially more bits depending on format. For example, in a typical black and white LDR image, the gradation from light to dark is in 254 shades of gray. This is not enough range to represent the contrast in real world lighting situations. The sun for example is thousands of times brighter than any other source of illumination outside (direct or reflected). HDR images can capture this though, and that extreme dynamic range can be used to light your scenes in Maya exactly as they would be lit had they been photographed in that real world scene. The HDRI's can be used like giant area lights taking their color and intensity from the image, they can be translated into directional lights, or used diffusely like the Final Gather skydome for ambient light discussed above. HDRI's also make for outstanding reflections- traditional reflection maps look dead by comparison, yet they render at about the same speed! Some examples of HDRI lighting (800x600 / 1m:15s render):

For this example, we will use the HDRI as a source of diffuse light for a Final Gather skydome which will also make it visible for reflections. Free HDRI Probes are available from Paul Debevec's Lightprobe Gallery (link). Maya can use the angular format unaltered, so choose one of those. In your Render Global's Mental Ray tab, scroll down to Image Based Lighting and click Create. Change the Mapping to Angular and then select your texture. That's it! You can set Final Gather as above, though your Filter setting might have to be 2 or higher to reduce specking. Add a light in the direction of the key light(s) in the HDRI and render. Under the Render Stats of IBL you can turn on visibility of the HDRI in the background as well as controlling its overall color. If you were to turn on Emissive in the IBL options, the HDRI would become one large area light as the third Buddha render above. It is the most accurate approach because the render then does the dome does the ambient and the direct, but the render jumps in time 25 fold.

GI + FG : GI stands for Global Illumination. Where as Final Gather shoots extra rays from the camera to calculate an approximation of the way diffuse light bounces around, GI works by shooting photons from lights which can bounce around the scene many more times than FG rays and illuminate areas beyond the camera's view. It is a much more realistic effect and is best used in conjunction with the smoothing features of FG. Unfortunately it is beyond the scope of the article and if you are interested there are some educational links below. GI rendering adds another layer of difficulty as it has its own settings min/max radius blurring and can require millions of photons for accurate lighting. For inspiration, here is a scene by Dagon1978:

Links

Files:

Lighting Examples: Spheres, Buddha Scenes

Sites:

Trix Are For Kids
LA Mental Ray Users Group
CGTalk: Ultimate Mental Ray Thread
CGTalk: Taking it Slow with GI, FG, and Caustics
CGTalk: Jeremy Birn's Lighting Challenge (free scene to practice)
Florian Wild's Render for Jeremy's Challenge
Stanford 3D Scanning Repository
Paul Debevec: HDRI Pioneer
IBL Tools: for more advanced HDRI