MR Rendering an interior scene with artificial lighting (GI and FG)

From TOI-Pedia
Gi interior tutorial final.png


In this tutorial we will setup a scene using Global Illumination for Mental Ray.


This tutorial assumes you're using Maya 2008. It's strongly recommended to use 2008 instead of 8.5 as a lot of bugs and annoyances for Mental Ray have been fixed in 2008 (which uses the new Mental Ray 3.6 engine).

We assume you have a scene with your geometry. Please make sure you remove all lights before you start to make your light setup. It's recommended to start with the default Render Settings.

It's of paramount importance that the (interior) model is enclosed properly. If you omit large parts of the walls or ceiling (e.g because they are not in sight of the camera), the light will not distribute correctly throughout your model. Of course normal windows and other openings are allowed.

When using Mental Ray and Global Illumination / Final Gather don't ever use additional lights (without shadows) to create diffuse/ambient light as you would do with Software or Vector rendering!

Work flow

Making a good Global Illumination setup at your first attempt can be a fairly complex task by itself. So it's important to make sure you can keep overview and keep things as simple as possible. That means: eliminating unnecessary variables and unknowns. Start with a simple model (will also make sure it renders quickly) and start with one light.

When you've got a working setup with one light in a simple model, you can start to expand and improve your scene: adding more lights and geometry.


  • Setup a single light
  • Setup Global Illumination for the lights and in the Render Settings
  • Setup mental rays Physical Light shader and Exposure control
  • Fine-tuning the settings
  • Setup any other lights (if required)
  • Some more fine-tuning
  • Adjusting the settings to go to production quality


Load your scene and open the Render Settings window. Set Render Using to mental ray.

If the Mental Ray option is not shown in the pull-down menu of the Render Settings, go to: Window » Settings/Preferences » Plug-in Manager and make sure the check-boxes for Mayatomr.mll (Mayatomr.bundle on Mac) are checked.
Since Maya 2016 a major overhaul has been made to the user interface. This also affects the standard tabs in the Render Settings of mental ray. It is possible to change it to legacy tabs similar to Maya 2015 and earlier.

Make sure the mental ray plug-in is already loaded! Open Windows » Settings/Preference » Preferences and choose Rendering in the Categories panel. Check the boxes Show Maya Legacy Passes and Use Legacy Render Settings and click Save.

Reload the mental ray plug-in or restart Maya to see the changes.

In the Common tab under the Image Size section change Presets to 320x240 for fast preview rendering.

In the Quality tab under the Sampling section change the Sampling Mode to Legacy Sampling Mode to change the Anti-Aliasing Quality of the render. Make sure the Legacy Sampling Mode is set to Adaptive Sampling and set the Max Sample Level to 1 for medium image quality.

MR Quality Sampling.png

Under Sample Options you may choose to set Filter to Triangle.

Open the Indirect Lighting tab and under the Global Illumination section check Global Illumination. The settings will be covered later.

Setting up the first light

Create a 'normal' Maya light, typically an Area Light, Point Light or Spot Light. Position it in your scene. Make sure you make the required settings:

Open the Attribute Editor for the light.

In the Shadows section make sure Use Ray Trace Shadows is checked:

Arealight enable raytrace.jpg

Scroll down to the mental ray section, enable Emit Photons. Set the Photon intensity to 2000 for now;

There's a nasty bug in Maya 2011 that causes the photon intensity to stay the same if you change it numerically. All seems fine, but as soon as you deselect the light and go back to its attributes, you'll see the photon intensity is back at its original value (probably the default of 8000) again.

Solution: Use the slider to set the value. This bug has been fixed in Maya 2012.

Increase the default number of photons to 50000:

Arealight enable photons 50k.jpg

When creating an arealight, make sure you check Use Light Shape in the mental ray section! This will convert the light to a Mental Ray arealight which produces more accurate results.

Arealight MR enable use light shape.jpg

Direct and Indirect Light

Mental Ray splits lighting in two basic classes: direct- and indirect illumination. The direct light is typically calculated using raytracing and works pretty much like the basic software rendering. Indirect light is calculated using either Global Illumination (Photons) or Final Gather or both.

You set the intensity for direct illumination separately from the intensity that is used by Global Illumination. Getting both tuned to properly match is quite tricky and is more complex than you might have thought. To get the direct light to behave more realistic and to get it to match the indirect light, we're going to 'upgrade' the light, using a special Mental Ray shader for the light: the Mental Ray Physical Light Shader.

A shader is basically nothing more than some extra computer instructions that can determine how something behaves, for instance when it emits a certain type of light (or when it receives it: a material shader). They are the building blocks that allow very complex structures to be created.

Physical Light shader

So to get the direct light to (more or less) match with the indirect light from the light and to get physically accurate result, we're going to upgrade the light with the MR Physical Light Shader.

There is also an option to use IES light profiles instead of the Physical Light shader, but this is a little tricky: you must model 1 unit = 1 centimeter (or set the Maya units to meters) in order for this to work.

In the mental ray section of the Attribute Editor of your light, scroll down to the Custom shaders section

Arealight custom shaders.jpg

Click the checker box next to the Light Shader field. The following window will pop-up:

Mr create render node.jpg

Scroll down to the MentalRay Lights section and select the Physical Light node.

You can set the intensity for direct light emitted by this light, using the color value of the Physical Light node that you've just connected. Click the color sample field:

Color chooser physical light.jpg

The intensity is set using the Value field. We start off by setting it to the same value as the Photon Intensity divided by PI, so: 2000 / 3.14 = 640, which is physically accurate.

The Physical Light shader returns an irradiance value, while MIA materials expects irradiance/pi. So to be physically accurate (when using mia_materials), you need to divide the intensity by pi.

Color picker set to HSV.png

If you're using a recent version of Maya with the new color-picker, make sure to set it to HSV-mode, as shown in the image above.

Maya 2011 may have a bug in the color chooser which won't allow you to enter a Value greater than 1000. This problem has been solved in Maya 2011 Servicepack 1 or newer.

Alternatively you could use this method as a workaround: connect a mib_blackbody node to the color value of the physical_light. You can control the light color by setting the color temperature and set the intensity value to any value required.

Arealight with physical light.jpg

When using the Physical Light shader, the standard intensity and color of the light found in the common light attributes section of the Attribute Editor are ignored. The color and value of the Physical Light shader are used instead.

Exposure Control

We are going to need some fine-grain control over the light balance of the image as the light range produced by Mental Ray is far too wide to 'fit' within a traditional image format. We're going to use the mia_exposure_simple node to do what is called tone mapping. It is also crucial to get correct color interpretations for the lighting of your scene.

The Mental Ray mia_exposure node is connected to the camera, so you need to set it up for each camera you're going to use for rendering (don't forget the persp camera when you're making test renders from persp).

Open the Hypershade and go to the Cameras tab:

Hypershade cameras.jpg

Drag each of the cameras you want to use for rendering to the Work Area below using you middle mouse button (MMB).

Hypershade cameras in workarea.jpg

Now we're going to create the mia_exposure_simple node. This is a Mental Ray Node, so we need to switch the inventory at the left to Create Mental Ray Nodes:

Hypershade create mental ray nodes.jpg

Scroll to the Lenses section and open it. Click the mia_exposure_simple icon. A new node will be created and displayed in your Work Area:

Hypershade mia exposure simple in workarea.jpg

Now it's time to connect it to our cameras. MMB drag the mia_exposure node onto the camera icon and release your mouse button. A pop-up will appear asking you what type of connection should be created. Choose default in this case.

Mia exposure simple connected.jpg

That's it. The mia_exposure is now connected to your camera and can be used to adjust the rendered image. We'll keep the default settings for now. We will adjust them shortly.

You can repeat this process for other cameras. In most cases a single mia_exposure_control node will suffice, just connecting it to multiple cameras. In other cases you may want to create multiple mia_exposure nodes as well, allowing you to fine-tune per camera.

If you want to create an existing mia_exposure_simple node to one of your cameras, but your Work Area is empty, you can find existing mia_exposure_simple nodes in the Utilities tab. You can MMB-drag them into your Work Area to connect them.

If you want to see to which cameras a node is connected, select it and use the Hypershade show input output connections.jpg button to show its connections.

Important note when using file textures

When you are using file textures in your model, it's very important to make sure you use the proper gamma settings when rendering using Mental Ray and MIA Exposure control. If you don't change the default settings, your textures will be very bleach ('washed out'). The solution is described here: Exposure control and File textures.

First test render

Now you're set to make your first test render.

There are three basic options:

  1. Your render is way too dark
  2. Your render is way too bright
  3. Your render is about right; the highlights are may be too bright, but the rest is about right.

The resulting image will probably be very coarse and filled with spots. That's something we can solve later on, we're now concerned with basic lighting.

The first test render is too dark

Increase the intensity of the light until it's about right. Make sure you change both the Photon intensity and the intensity of the direct light in the Physical Light Color value.

Once the illumination in the darker areas of your render are about right, the highlights are now probably over-exposed. You can continue in the The highlights are too bright section.

The first test render is too bright

Gi interior tutorial 1.png

Decrease the intensity of the light until it's about right. Make sure you change both the Photon intensity and the intensity of the direct light in the Physical Light Color value.

Gi interior tutorial 2.png

Once the illumination in the darker areas of your render is about right, the highlights are probably still over-exposed. You can continue in the The highlights are too bright section.

You may notice the light leak that occurs near our lighting fixture. Don't worry, this is something we'll fix in the next steps.

Fine-tuning the image highlights

You're about where you want to be, but the highlights are too bright. This is very common, as computer screens cannot handle the huge contrast range the human eye (and brain) can handle. So you need to compromise and tweak a little. We're going to use the Mental Ray Exposure Control to do this. You can find your mia_exposure_simple node(s) in the 'Utilities' tab of the Hypershade. Double-click it to open the setting in the Attribute Editor.

Change the Gain only when needed (if the overall brightness is still a bit too high or low). Consider the darker areas of your image and determine if your image is too bright or too dark there.

If that's all about right, use the Compression to compress the brighter areas of your image so they are no longer over-exposed. Compression values of up to 50 can be needed. If you need higher compression values, make sure the intensity of you light is not too high after all.

The left side shows our previous render, the right side shows the render where we've adjusted the compression of the mia_exposure_simple to darken the highlights just a little bit.

Gi interior tutorial 2.png
Gi interior tutorial 3.png

Finding the right settings is a process of adjusting one setting and making a new test render. Continue this process until your satisfied with the results.

Render Settings - Global Illumination

We need to tweak some Global Illumination Settings to get better results. As you'll notice the may seem to get worse first...

Open the Render Settings and go to the Caustics and Global Illumination section in the Mental Ray tab.

Determines the number of photons Mental Ray will consider when determining the illumination of a given point.

At the moment our light is emitting 50000 photons, so when MR needs to consider 500 (default accuracy), it uses 1% of the total number of photons to calculate the illumination for a single pixel (sample). This may produce strange results in corners and other areas with high contrast differences (for instance near lighting fixtures).

A rule of thumb you can use, is that the accuracy should never be more that 1/10000th to 1/1000th of the total number of photons emitted by your lights. So with 50000 photons, your accuracy should be between 5 - 50. Start with a value of 20.

In the Global Illumination Options sub-section, you'll find the photon Radius.

The area of influence of a single photon. It's effect gets spread and will help to smooth out the results.

When radius is set to 0, Mental Ray will automatically determine a radius. This is fine in most cases.

The resulting render may appear to be worse, but we'll fix that in a bit. In the end the quality and accuracy will be better.

Gi interior tutorial 4.png

Tuning Light and Render Settings for better quality

Your render probably still has strange looking spots in it. This is due to limited accuracy in the Global Illumination calculations. To get better results, you need to increase the number of photons. Open the Attribute Editor of you light and increase the number of global illumination photons.

Gi interior tutorial 5.png

For medium-sized renderings a total number of photons (add up all photon-emitting lights) for the final image is typically between 200000 and 1500000. You could increase the number of photons straight away, but rendering could get quite slow. It's recommended to use intermediate settings for now: increase the number of photons emitted by your light to 100000 - 200000.

Larger renderings (> 1280x1024) or very complex scenes may require up to 10 million (or sometimes even more). Try to keep the number of photons as low as possible and only increase it if it's really necessary and test-rendering show it has effect.

In this tutorial we're going to finish by enabling Final Gathering. If you plan to use Final Gathering, the result from rendering without FG doesn't need to be perfectly smooth. Final Gathering will take care of that.

Adding more lights

If you want your scene to have more than one light source, now is the time to add them.

When you duplicate the light you created before, note that the physical light shader will not be duplicated automatically. You have to Manually add a physical light shader.

We want a little more light in the back, so we've created a light there. We've used an arealight, but in this case the Type (Attributes > Mental ray > Area Light) is set to disc. Don't forget to configure it properly and to add a Physical Light shader.

Gi interior tutorial 6.png

Be careful though: having a large number of photon-emitting lights can be tricky. In many cases there are better alternatives. See the Advanced section in this page for details.

If the overall light of the scene was ok with the one light you created, you probably need to lower the intensity (photon intensity and direct light intensity) of your light when you add more lights. Keeping the total 'intensity' of all the lights the same value, seems to work pretty well. So if you lit your scene with one light with an intensity of 2000, two lights with an intensity of 1000, or four with 500 should be a pretty good starting point.

We've added some more lights (in this case also disc-shaped arealights) and tweaked the intensity of each light:

Gi interior tutorial 7.png

Enabling Final Gathering

When all the basic settings are ok, you can enable Final Gathering to improve the quality of your rendering. When combining Final Gathering with Global Illumination, you can keep the settings of FG quite low.

Open the Render Settings and go to the Final Gathering section in the Mental Ray tab. enable Final Gathering.

We're not going to discuss the properties in depth here. Refer to Rendering Mental Ray: Final Gather for more information on each of the settings. Keep in mind that the values given there are for interior rendering with only Final Gathering (no Global Illumination). This tutorial covers specific values when combining Global Illumination with Final Gathering.

Start with a value of 20. Only increase if the results aren't smooth enough and make test-renderings to see if increasing it has the desired effect.
Point Density
Start with a value of 0.6
Point Interpolation
Start with a value of 10.

Our rendering with Final Gathering enabled looks like this:

Gi interior tutorial 8.png

Bright spots

Lights and reflective surfaces may produce bright spots in Final Gathering (they disappear when you disable Final Gathering).

If you see any of these bright spots in your rendering: Open the Final Gathering Options section in the Render Settings. Set Filter to 1.

On the left our previous rendering without FG filter, rendering with FG filter set to 1 on the right.

Gi interior tutorial 8.png
Gi interior tutorial 9.png

In some cases it may cause the scene to become very dark; in that case you can only solve the bright spots by increasing your Accuracy, Point Density (0.8 - 1.4) and optionally Point Interpolation.

Going up to Production Quality for the final renderings

For your final rendering, you're probably going to increase the image size. You need to adjust the other render settings as well. It takes some practice and experience to get a feeling for the settings. It's difficult to give general values that apply for every rendering. This sections gives some pointers, but won't apply exactly for each and every rendering.

Global Illumination

Increase the total number of photons emitted by the lights in your scene. It's tricky to generalize what values you need, but to give you some pointers: use 200k - 1 million for medium sized renderings, 1 million - 5 million for renderings > 1280 x 1024 pixels. Large renderings and scenes with complex lighting situations may require > 5 million photons.

Increase the number of photons in steps and make test renderings (temporarily disable Final Gather to see the effects) to see if you need to increase the values further.

Set the Global Illumination Accuracy to about 1/10000th - 1/1000th of the total number of photons, so start with about 200 when using 1 million photons. You can then increase it up to 500 - 1000 if needed.

Final Gathering

Increase to about 40. Only increase further if the results aren't smooth enough and make test-renderings to see if increasing it has the desired effect.
Point Density
Increase to 0.8 when your rendering is larger than 1024x768. Increase to 1.0 for renderings larger than 1600x1200. You shouldn't need to increase it above 1.
Point Interpolation
Increase to 20 and further if you've also increased your Accuracy further.

Image Quality

Render Settings for better image quality are covered in: Rendering Mental Ray: Anti Aliasing Settings.

Our final rendering compared to the previous version:

Gi interior tutorial 9.png
Gi interior tutorial final.png

Common problems

The light itself is not visible

In the Attribute Editor of the arealight, open the Mental Ray section, then open the Area Light subsection.

Make sure Use light shape is enabled and enable Visible.

Obviously this option is only available for arealights.

Light leaks

Light 'leaks', causing incorrect rendering of the scene as shown in de lefts side of the image below.

Mr gi light leak.png
Mr gi light leak solved.png

Cause: This is caused by a GI Accuracy setting that is too high for the number of photons (or a too small number of photons).

Solution: Make sure the accuracy is between 1/10000th to 1/1000th of the total number of photons in your scene.

Graininess near arealights

Arealight mr low sampling enlarged.png

Cause: the number of samples Mental Ray uses to calculate the light for this arealight is too low, causing aberrations.

Solution: In the Attribute Editor of the arealight(s), open the Mental Ray section, then open the Area Light subsection. Increase the High Samples for any light that produces grainy direct light on surfaces. In most cases a value between 32 and 64 should suffice, but it may be necessary to increase to up to 256 in rare cases.

The left side of the image below shows a rendering with a low sampling setting, the right side shows an increased sampling setting.

Arealight mr low sampling.png
Arealight mr high sampling.png

A test you could do to determine if it is not another artifact: The graininess stays when you render without Global Illumination and Final Gather, excluding problems with FG or GI settings.

Graininess may also be caused by low sample settings in the shader (material) of the object. For instance: low samples for glossy reflections or refractions in the mia_material shader

Advanced topics

Keep the number of lights as low as possible

It's not necessary to create a photon-emitting light for each and every light fixture that is in your scene. Alternatives are to skip photons on small or distant lights or to use the Additional Color (Incandescence for Maya Lambert and Blinn) value of a material to 'generate' light from it, thereby mimicking a light source.

Personal tools