Interior Lighting with Mental Ray Physical Sky

This post has been in the back of my mind for a while now and I figured why not jump in and start my ramblings. Ever since I've discovered linear lighting, I haven't looked back.  I've settled into a workflow with which I'm pretty comfortable (I do find myself tweaking it of course) and I figured I’d assemble my heap of random notes into something coherent...kind of.   It might help someone get on the road to making some of those Ikea like shots.

After I’ve created the physical sky by using that complicated process of clicking a button, the next step is to decrease the Final Gather settings, as a point density of 1.00 is excessive for quick tests.  I crunch that down to 0.1, the accuracy to 32 and one secondary bounce just for starters. The thing with the physical sky is, once you’ve corrected the washed out colors, you can get some nice exterior lighting pretty easily but without extra steps, interiors often turn out dark and blotchy, painfully obvious when the openings to the outside are very constricted, and the sunlight isn't directly hitting anything in the room.

Eww :(

Portal Lights

Portal lights help relieve the spotty shadows; they cram illumination into the room.  They’re easy to setup too:

- Create a normal area light and then scale and position it so it sits just outside the window/door/whatever and it's facing the interior.  I’ve developed a tendency to scale it a tiny bit smaller than the window.
- Check on “use light shape” and “visible” in the light's mental ray section of the shape tab.
- Open Hypershade and create a portal light node (it’s in the Mental Ray Lights section for anybody who doesn’t know).
- Select the area light, expand the “custom shaders” section, check “suppress all Maya shaders” and drag and drop the portal light into the light shader and photon emitter slots.
- Done.


A little better :/

The lighting distribution is better, shadow spottiness is decreased and there is better contact shadowing.  But it’s still so dark!  At this point, it’s more about the camera than the lights.

Controlling Exposure

Unlike a real world camera and our eyes, the exposure on a Maya camera doesn't automatically adjust to accommodate the lighting conditions.  So even when you’re using an exposure control, it might look great outside, but as soon as you render an indoor shot, you can barely see the scene.  It's not so much that the scene is under-lit but that it's underexposed.  At this point, I’ll switch out the simple exposure for a photographic, simply because its my preference.

There has been much talk on luminance conversion and though it was somewhat informative, it was really draining, especially after realizing that Maya lights behave rather arbitrarily (in terms of real world intensity equivalence). Once you start reading up on that stuff you’ll most likely find yourself getting more pissed off about the state of Maya’s rendering department, making you have to go so deep and read all this shit, ugh!  Anyway, I've recently decided on a cm2 factor of 3180 and leaving the physical sky rgb unit conversion at 0.00100 instead of a cm2 factor of 1 to an rgb conversion of 0.318, I get the same compensation for the sky and I can tweak other lights without having insane numerical values for intensities and such.

Setting up the exposure node for preview is easy enough:

- Disconnect the exposure node from the camera.
- Batch out the frame to a high dynamic range image like .exr or .hdr.
- Reconnect the exposure node to the camera.
- Turn the “Use Preview” checkbox on.
- Map the “preview” attribute and browse for the image you batched out.
- In the render settings, disable FG/GI/Caustics if they’re on.
- Keep rendering and fiddling with the exposure settings (more on that below).
- After the exposure settings are good, turn off “Use Preview” and turn back on FG/GI whatever.

When it comes to “fiddling with the exposure”, the three attributes that I’ll be tuning the most are the Film ISO, Camera Shutter and F Number, these work together to control the exposure.

In a real life camera, the ISO determines how much the sensor or film reacts to well...light, the higher the value the more sensitive.

The camera shutter attribute is the shutter speed.  Shutter speed determines the amount of time the sensor or film is exposed to light, in most instances this will happen within a fraction of a second like 1/30 of a second (which is considered slow), 1/250, 1/60, 1/1000 are some more examples.  The denominator from any given shutter speed can be used as the value for this attribute.  You can think of it like the weird guy in the trench coat who exposes his squishy bits to strangers on the street, sometimes it happens in a flash, sometimes he’ll leave it open for a while, prolonging your brain’s exposure. Is that weird that’s how I think of shutter speed?  Moving on!

The F number (or f – stop , f/1.4, f/16, f/2.2, f/11 for example) relates to the size of the aperture, which is the circular opening (measured in millimeters) in the lens that controls the volume of light that will be let into the camera; kind of like the human eye that dilates and shrinks. The f-stop is determined by dividing the lens' focal length (35mm, 50mm 100mm etc.) by the diameter. As the f numbers get higher, the aperture shrinks. Here we’re not required to obey real world limits and I find it fun to try out the different combinations.

Note: Each of these three properties have side effects in real world cameras, like, shutter speeds also affect motion blur, fast shutter speeds can crisply freeze moving objects while slow ones blur them, the higher the ISO the more grain will be introduced into the image, and f-stops affect the depth of field,  for example, a wide open aperture like f/1.4 creates a shallow depth of field(common in portraits and food photography where the subject is against a highly blurred backdrop). These side effects are taken into consideration even though the the same exposure can be achieved through different combinations.  They are not created using mental ray’s photographic exposure node, however.

I leave the gamma and saturation as is.  The “Burn Highlights” attribute crunches down the overexposed areas.  A value of 0.25 is good enough to prevent all the highlights from being beaten back into gray blobs.  As for “Crush Blacks”, this attribute intensifies the darker tones in the image.  Here I’ll use 0.2 to maintain some contrast.   Since the tonemapper is still using a preview image the test renders are instant so hurray for that.  Everything looks good exposure wise so now back to lighting (I warned you I was going to ramble).

Exposure Settings

At this point I'll uncheck use preview and turn FG back on like I mentioned in the steps for setting up exposure preview.

       Final Gather

Time to go through my FG to do list!  For this I’ll post a screen grab and explain my choice of settings (I’ll be jumping all over the place in that tab).

First I enter a path for my FG map (C:\myProject\myMR_folder\mapName), that way when I get some good output, I can just freeze the map and not have slap myself when I have to wait for it to rebuild.  Skip on down to the FG tracing settings.  I find that I get better bounce light when the FG traces can keep pace with the secondary bounces, so my FG reflections will have the same value as the secondary bounces . The FG refractions are less important in this case since there are very few transparent surfaces, and of course the Max Trace has to be able to cover both. A secondary bounce value of 4 gives me the illumination I want.

Note:  you can save some time on FG map generation by hopping into the “Features” tab in the render settings and set the Render Mode to Final Gathering Only, I don’t think this is available in older Maya versions though (I don’t remember when this was added).  A way around that, is to decrease the image size to something miniscule and set the AA settings obscenely low so there wouldn't be so much to render.

At this point I can either eyeball my scene scale or actually use the measurement tools…eeh I’m going to eyeball this bitch, going purely by the grid.  Why do I even want to know this information?  Simple, when applied to certain attributes, it helps clean up the look of the FG and even speed things up!

 I’ll apply this information first in Falloff Start and Falloff Stop attributes.  The Falloff Start is the distance at which MR stops caring about what lighting information objects can add to the FG map and just decides to pitch in the environment color instead.  The Falloff Stop, is where MR stops caring period, anything outside that just won’t count when it comes to calculating FG.  My room isn’t much bigger than 100 units, but I have a ground plane with a grass texture on it so I want a little bit of that thrown into the FG map, I don’t want it to seem like my room is floating in space so I’m being generous with a 200 for Falloff Start and 250 for Falloff Stop.

I set the Final Gather Mode to “Use Radius Quality Control”; this enables the min/max radius input boxes. I find this to be very important because it can determine whether FG looks blobby, especially in corners and tight spaces.  Instead of having Maya do guess work, I can tell the FG rays exactly the area in which to look for surfaces spewing lighting information.  Here I’m going to be a bit tighter with the numbers because all the surfaces that really matter are inside the room.  The max value should be 10% of the scene size and then the min value should be 10% of the max.  The room is roughly 120 units so that would be 12.0 and 1.2 respectively.

 An FG filter value of 1 or 2 takes care of the white speckles that can pop up, they're the result of really bright samples contributing too much illumination to the sampling area, making it look out of place.

Like this image for example:

A filter value greater than 0 ends up dampening the overall FG brightness a bit but some color correction in post fixes that.  It also seems to get really obnoxious when FG accuracy and point density are very low (those are usually the last two attributes I increase and I try to balance those with the FG filter). 

I ended up using an FG accuracy of 150 and a point density of 0.4 after running some diagnostics (it's the little check box in the FG map section, can't really miss it).  My initial settings of 32 accuracy and 0.1 for point density yielded some pretty sparse results but that was expected.

The geometry and the lighting aren’t so complex, so I don’t need those settings to be very high.  Not to mention the fact that I’m using mia_materials with their built in AO enabled, so I don’t need to have my FG be super mega accurate and perfectly shade the corners and cracks.  Uncheck "diagnose finalgather" and cache out the map (just choose "Freeze" from the Rebuild drop down menu).  Re-rendering gives me this:


       Anti Aliasing

Something that is holding the image back big time (apart from the jagged edges) is that nasty grain that’s all over everything!  That’s the portal light; the area light's ‘high samples’ are far too low, so now I have to balance that out with the AA values in the render settings (Render region is your friend!)  When balancing light sampling, I tend to test the portions with the softest of shadows, as too low sampling wreaks havoc on those areas.  The post is long enough without getting into all that can be considered when dealing with AA settings (like the different filter types, diagnostics, per object overrides to avoid thin surfaces looking like crinkled garbage etc.), but like most other choices in rendering, it comes down a tradeoff between what won’t needlessly murder the processing times and what looks good.  These were my settings, and they allowed me to get away with a value of 46 on my area light's high samples.

When the AA settings are squared away and everything looks right, I’ll disconnect the exposure node from the render camera, yeah that’s right, all that tweaking was just to preview what it will look like in post!  If you want to keep the exposure node and bake the tonemapping into the image then that’s fine, especially if you don’t need the flexibility in color range for some heavy color corrections.  I’m rendering out to .exr, and under the “Framebuffer” section of the “Quality” tab, I’ll set my data type to RGBA float 4x32 bit.  If you ditch the exposure node the final output will need exposure tweaks, for me, it’s going to be done in After Effects.

That concludes these notes or should I call it a rant.  Either way, that was a long one!  Now let's hope I didn't miss anything and there aren't too many grammar mistakes.


  1. Really interresting post, thanks a lot to share your knowledges; I will do some test in conjonction to your notes.

  2. Thanks for the post and the attention to detail!

  3. Thank you :) I have to go over it and correct some typos though.

  4. That is really helpful, I'm doing this similar task for living room lighting. Thanks for your guide.

  5. Thank you very much, great tutorial.

  6. Great job, thanks for taking the time

  7. omg thank you so much your tutorial was the only thing that worked.

  8. when you use the preview mode and batch render, is it only for that one angle?

  9. Yes, if I moved the camera then I'd need to batch out a new exposure image.

  10. I am happy to find this post Very useful for me, as it contains lot of information. I Always prefer to read The Quality and glad I found this thing in you post. Thanks
    Pendant Lights

  11. This article is too long, and although it contains a lot of useful information, very few people have the patience to read it.

  12. Hi Genny,
    Are you still supporting this blog? Got afew rendering questions.


    1. I'll be around more this year. Haven't been doing much personal stuff. I know it's reeeeeallly late but feel free to shoot me an email at whatever point!

  13. This post contains a lot of information and I'm glad it was very useful to me.


Leave a message at the beep...wait for it...:p