A Linear Lighting Workflow Based Around Mental Ray's Final Gather

I'm hoping this will become part of a collective of innovations projects if people decide to upload or post theirs too, so I'll link to them at the bottom of the post and update the it as they become available. I was specifically interested in expanding my understanding of bounce cards and indirect lighting techniques inside of Mental Ray so I created a step by step as I lit a scene using this method almost exclusively. Here it is for your perusal:


First I set up a simple scene with some props inside it and created a camera. In order for 32bit rendering to be enabled in Maya you first must go to the display tab of an open render window, and set Maya to 32bit, restarting the program if necessary. Now you need to go to the mental ray tab on the camera's attributes and create an exposure node to give you control over the exposure of the scene. Create this node by clicking the checkerboard next to the lens shader box.
The lens shader you want to use is the mia_exposure_simple. For what we're doing it has plenty of control and nothing that you can't add in post later if you need it.

The important part here is to setup the way your scene is being displayed, so that it is correct within the linear workflow we are using, some people like to gamma correct each shader individually but this a much quicker and more efficient way if perhaps less physically correct.
Go to the gamma attribute of the lens shader and set it to 0.455. This will ensure that your scene is being displayed in a way that matches the sRGB output of a computer monitor.
You can leave the rest as default for now though we may (will) need to tweak them later.
Now to ensure that Maya is not applying the gamma correction twice when displaying the image you need to go to the render view and under the display tab at the top choose colour management. 
This will bring up the the colour management settings in the attribute editor. You need to set the top on to “Linear sRGB”.
Final gather has a sneaky and powerful feature where you can use the colour of a camera's environment to effect the final gather, to simulate say the colour of the sky, casting light where the sun doesn't shine. Here I've set it to grey just to give the final gather a bit of a boost in the areas the light isn't going to reach.
A little about render settings before anything else is done. In order for the 32bit renders to display without noise you need to set the framebuffer to RGBA 32bit at the bottom of the quality tab in the render settings, a format like OpenEXR can handle this fine but tiffs also work. Make sure Mental Ray is the selected renderer and that final gather is turned on, either in the features tab or the indirect lighting tab, the result is the same.

Before Final Gather

After Final Gather
So the plan is to try and light this scene using everything I know about final gather and as few real lights as possible, the whole scene could be lit by final gather alone but as I want a quite direct light source coming from about it wouldn't like right without the correct shadowing if we didn't throw in some raytracing, and what better way to do that than an area light?
Area lights are slightly tricky and there are some sampling things you need to straighten out that for the shadows to look smooth, its also easy with an area light to increase render time radically without actually increasing image quality. Before any of that is approached set the falloff to quadratic and assign a portal light shader in the light shader box under the mental ray tab of the light's attributes.
For the portal light shader to work the light needs set to use the light shape in the mental ray section and have the “visible” box checked on. The great thing about the portal light shader, and its relevance to a final gather pipeline, is that it draws in light from the exterior environment colour and pumps it through the hole you put it in, meaning that final gather quality is greatly increased on interior lighting without having to massively turn up any settings. Its intensity acts independently of the light's intensity so you can tweak the multiplier attribute and ignore the original light intensity.
The Portal Light
I then experimented with turning the final gather falloff right down to only between 50 and 75 world units of distance. This meant that anything further than that was illuminated by the environment colour so the entirety of the room was now lit as it exceeded these measurements, therefore drawing on the environment colour rather than remaining in darkness. It looks nice but was not the effect I was going for.

Tighter Final Gather Falloff
Hole In The Roof
I made a box in order for the light to function properly as a portal and create darkness around the the rest of the scene, here is the hole itself.
That's the one light setup (subject to further tweaking), next Ill explain how virtual lights work and how to set them up. In lighting for cinema or photography bounce cards are often used to spread light around in a soft way that requires no extra lights, just large white surfaces. In mental ray you can achieve the same effect without even needing the light to bounce in the first place, just the card. First a polygon plane is created (or any shape, depending on how you want the light to be emitted), then a surface shader is assigned to it. But changing the out colour of the surface shader to a white it will emit light when final gather is turned on. The softness of that light is controlled by the size of the plane, the direction by the angle, and the intensity by the value of the out colour. If you open the colour watch for the out colour you can type values higher than one into the value box to create brighter virtual lights of any colour.
Virtual Lights
This is what it should look like in scene when you've set a few up in strategic positions. This was my initial set up but I ended up placing one under Leonard's chin to bounce light up into his face, and one to the left of the books to brighten their profile from the side. One important thing to remember is to go into the render stats in the attribute editor of each plane and turn everything off, unless you want reflections for the virtual light. Then in the mental ray section below render stats turn of everything else except cast final gather: that's the bit that will be doing the actual illuminating.
If you don't turn them off you get a render that looks like this:
Oops, forgot to hide them in the render stats...
Something to make the scene a little easier to navigate now that there are giant cards hovering in the air blocking the view is to group them and under the display tab of the attributes for the group are the drawing overrides. After enabling them, you can set the “level of detail” dropdown to “bounding box”. This means that only outer edges are represented by a wireframe cuboid. They render exactly the same and are still selectable, its merely a visual tool to allow the scene to run smoother and be easier to see what's going on.
Drawing Overrides
I planned to fill the suitcase with Kernels so I created a hemispherical virtual light to place over the
them and give them a knowledgous glow. Playing with sizes, angles, and intensities was important to get the tops of them glowing but also have them receive enough light from the environment to make them sit properly amongst the other props.
After a quick render it looking like this:
The Glow of Knowledge
I really liked this look but the overall look was too dark and contrasting. Perhaps more realistic, but I want more of the environment detail to be visible, as well as Leonard's facial features. Without touching the portal light itself, which I had increased the intensity on in the previous render, I turned the environment colour on the camera from a dark grey to white. It changed the overall luminosity dramatically. From here it was just a question of evening it out a bit which can be done easily using the lens shader.
Over Exposed
When there's this much contrast the bounce light is literally the only thing lighting up areas untouched by direct light, this gives it a really organic colourful look which I love and is particularly noticeable on some of the books and the undersides of Leonard's limbs. The light I mentioned earlier to brighten Leonard's features was placed like this:
After some minor tweaks to various brightnesses and things I adjusted the lens shader, using its compression attribute to narrow the high dynamic range of the exposure, bringing the blackest blacks and the whitest whites closer to the visible spectrum, and equalise the mid tones for an image that probably closer resembles what I eyeball sees rather than what a camera would see.
I set the compression attribute to 5, the gain up to 2 (brightening the whole image), and kept the knee at 0.500 in order to stop the highlights from blowing out too much.
And here is the final render:
King Kernel
Any questions?








Innovations Collective:


Charlie Minnion: How to composite a polluted city.


[watch this space]


















Comment