Global Illumination and Finla Gather in Mental Ray for Maya
Currently, one of the best ways of achieving photo-realistic imagery is to render using Mental Ray for Maya. Mental Ray offers a Global Illumination and Final Gather solution, which when combined, simulates the physics of real world lighting effects. Now, for the first time in 3d, lighting techniques used by photographers and filmmakers can be applied to computer graphics. The following is a guide for setting up Global Illumination and Final Gather using Mental Ray for Maya. It is based on notes from the web, Maya’s Help manual and good-old fashion experimentation.
The first thing I always like to do is develop some sort of plan. As they say, ‘If you don’t know where you’re going, you probably won’t get there.’ Here is a quick set-up sketch I did in Photoshop. I have included lighting placement and some material information.
The basic idea from the sketch was modelled and setup. Maya has four basic shaders to choose from: Lambert, Blinn, Phong or Anisotropic. Lambert has no specular highlights, Blinn has soft specular highlights, Phong has hard specular highlights and Anisotropic has irregular highlights. Based on the sketch, the first material will be a white, matte background that has no shine. A basic Lambert material was used with color set to an off white (very light grey) and diffuse increased above 0.8. Next is the sphere, which will be used as a prop to study the effects of illumination. A Phong shader was used to give it a highly polished, chrome like appearance, so as to be able to better study how the light rays are being traced. The last material is the Negative fill. These are being used like large barn doors, stopping the light from spilling. To suck the light from the scene, a Lambert material was again used, with both the color and diffuse set to black.
This is the final scene set-up. Two spot-lights have been added either side of the negative fill and are pointed at the wall. Their light will bounce of the white wall, to create a soft large light, illuminating the back of the ball. Any spill from the lights is being stopped by the black boards. Later the lights will be converted to Mental Ray area lights to create softer shadows.
As the sphere subject is not receiving any direct illumination a reflector board has been added. It will catch reflected light from the screen and illuminate the sphere from the front. The same material used for the background has been applied to the reflector board.
A standard hardware render produces an almost black image as most of the illumination is to be achieved from bouncing light.
The first part involves setting up the Global Illumination. Once a good photon map has been created, then Final Gathering will be added to increase indirect illumination. Global Illumination using Mental Ray, requires the adjustment of two main sections: the light’s attributes and the Render Globals Settings.
Both light’s attributes are first set-up. To get realistic lighting behaviour,
- the decay rate is set to Quadratic and
- the light intensity is initially set to 120.
- Raytraced shadows are turn on in the Shadow attributes section.
- Lastly, in the Mental Ray section, the light is set to emit photons.
To create the Global Illumination solution, the Mental Ray render is selected in the Render Globals Settings, and in the ‘mental ray’ tab, the Quality Preset is set to Draft and Global Illumination is turn on in the Caustics and Global Illumination section.
Here the initial render is created. The Negative Fill boards were adjusted to give a more even lighting. Both the light’s intensity was reduced by half down to 60 – giving a total combined intensity of 120. The spot lighting effect was also reduced by increasing the Penumbra Angle to 10.
The next stage is to fine tune the Global Illumination. To adjust the overall brightness of the scene, the light’s Exponent value and Photon Intensity attributes are adjusted. Here is Maya Help manual definition for the Exponent value:
This is similar to decay — the intensity increases as the value decreases. To increase the chances that indirect light will reach a greater distance, decrease the value.
Visible noise can occur with values less than 1. The default (2) simulates natural (quadratic) decay, but violates the conservation-of-energy law (that happens in the natural world), so bright spots from distant light sources could occur in unexpected locations.
Phrased another way, higher Exponent values will decrease brightness. Increments of 0.1 through to 3.5 will gradually decrease the brightness.
This is the same render with an Exponent value of 3. The image is much duller.
As the lights are set to Quadratic decay, and Final Gather will be used at the end, then only a little increase in Exponent value, up to 2.2 was used to darken the effect a little.
Then comes Photon Intensity adjustments. The Maya manual explains:
Energy (Photon Intensity)
The amount of light distributed by the light source. Each photon carries a fraction of the light source energy.
8000 is the default. 0 means no photons are emitted.
If caustic effects are not bright enough, try increasing these values equally, in small increments (to 12000, to start) until you have better results.
If `hot spots’ (blown out) areas occur, try decreasing these values equally to around 4000 or 5000.
Basically it controls how bright the white spots are (the photons).
Here the Photon Intensity has been increased to 10,000 – just to slightly brighten things up.
One more light attribute to adjust – Global Illumination Photons. The Maya manual explains:
Global Illum Photons
The number of photons to be generated by the light source and therefore stored in the photon map. The default, 10000, is suitable for quick, low-quality renders. To improve the quality, increase this number, incrementally, to 20000 to start (render time will increase as a result). Generally, 100000 produces medium quality and 1000000 produces highly accurate effects.
This feature then controls quality. In other words, the more photons you can shoot, the better the quality. The aim is to increase this value to as high as possible, before render times are affected.
Here, the number of Photons has been increased to 50,000. There are now more visible white spots. This will be fine tuned in the Render Globals Settings of the render.
To reduce the number of white spots (visible effect of photons), the Global Illum Accuracy is increased in the Render Globals Settings Mental Ray tab. Here is the Maya Help manual definition:
Global Illum Accuracy
Change the number of photons used to compute the local intensity of global illumination. The default number is 64; larger numbers make the global illumination smoother but increase render time.
A Global Illum Accuracy of 1 is shown here to show the individual photons.
A Global Illum Accuracy of 100 has been used here. Generally, Accuracy above 100 only increases render time.
To improve illumination quality and reduce the spotty effect, the Global Illum Radius is increased. The Maya manual explains:
Global Illum Radius
Controls the maximum distance at which mental ray for Maya considers photons for global illumination. When left at 0 (the default), mental ray for Maya calculates an appropriate amount of radius, based on the bounding box size of the scene. If the result is too noisy, increasing this value (to 1 to start, then by small increments up to 2) decreases noise but gives a more blurry result. To reduce the blur, you must increase the number of global illumination photons (Global illumination Accuracy) emitted by the light source.
Here, with Global Illum Accuracy set to 100, and Global Illum Radius is set to 0.1.
A Global Illum Radius value of 1 produced the best results.
Up to this point an accurate Global Illumination model has been used. To improve indirect illumination and to create a Radiosity effect, Final Gather is introduced. In the Render Globals Settings, Final Gather is turn on and Final Gather Rays are reduced to an initial value of 100. The following is the Maya manual extract:
Final Gather Rays
Controls how many rays are shot in each final gathering step to compute the indirect illumination. The default is 1000 per sample point, but this tends to be high for test renders (renders can take hours). Test rendering at lower values, usually 100 or 200, is sufficient; higher values are required for final renders. Increasing the value reduces noise but also increases the rendering time.
This is the resulting image with Final Gather turned on and Final Gather Rays set to 100. The image is currently appearing much darker. This is because there are only really two surfaces for the light to reflect off. Final Gather also works in response to a surface’s Diffuse and Incandescence values.
Here a separate material has been applied to the reflector board above the set. The Color has been set to pure white and the Diffuse set to 1. Incandescence has been set to mid-grey and gradually increased to add light. The backdrop has also been set to pure white and a diffuse value of 1. It’s Incandescence is a low dark-grey. Adjusting the Incandescence value gradually allows Final Gather to introduce more light.
With more light, the Final Gather Rays are increased to 300 to improve quality.
The last Final Gather adjustment to make is the Min/Max Radius. Here is the Maya manual explanation:
Min Radius, Max Radius
Max Radius and Min Radius control the size of the sampling region within which Final Gather rays search for irradiance information from other surfaces.
With the default values, Maya calculates values that seem appropriate based on scene dimensions to speed up the render, but this calculation doesn’t allow for complex geometry. Generally, enter a value that is 10% of scene’s overall dimension for the Max Radius, then enter 10% of that for Min Radius. Make further adjustments based on scene geometry detail, how the geometry is arranged in the scene, and how the render looks. For example, use these settings to achieve better diffuse detailing in nooks and crannies in your scene.
Mental Ray automatically calculates the Min/Max Radius when the value is 0. Increasing these values can help reduce render time.
Here the Radii are equal with a Min Radius of 0.1 and a Max Radius of 0.1. It leaves a spotty effect.
Here a Min Radius of 0.1 is used and a Max Radius of 1. Render time has been reduced notably.
As a final touch, the Spot lights are converted to Mental Ray area lights. This removes the hard shadow from the black boards and adds softness to the image.
This is the image with area lights. The type is set to Rectangle and both Sampling increased to 6×6. To increase brightness, the light’s intensity has been increased slightly to 80 and the Incandescence of the wall and reflector board material has also been increased.
The Final Render
After some tweaking, this final image was rendered. The camera was moved closer, the sphere’s color material changed, a key light added and render quality increased.
If you would like to experiment with this set-up the files are available for download:
Part of this guide has been adapted from Inter-Station 3d.
Philippe Le Miere, 29th Marth, 2005