Multi-Pass Lighting & Test Box

By Lance Evans • Category: Tutorials

Excerpt from 3DNY’s “MAYA | Multi- Pass Rendering” Interactive MediaBook

If you have been involved in 3d for a bit of time then you have probably heard the term Multi-Pass Rendering (MPR) bandied about. What is interesting though is how few people seem to know much about it. They have heard that it is a truly powerful technique, and this is true. But most people have also heard that it is a technique best reserved only for the largest studios, and this could not be further from the truth. In reality, MPR is just as powerful and just as accessible to the one man shop as it is to the big teams. In fact, MPR can actually help the understaffed among us work far more efficiently and get a lot more done at the end of the day.

What is Multi-Pass Rendering? Although Maya has some tools in its Render Global window and its Render Layer interface to help make the most common types of multiple passes run more smoothly, these only address a small range of what MPR offers. Part of the misconception people have about MPR is that it is a very specific tool or narrow technique. Neither of these things are the case. MPR is actually a general term that loosely describes a very broad category of related techniques. The unifying element between all MPR projects is that they are rendered off in more than one pass for a given scene. And by definition, that is all MPR means. Rather vague, huh?

With such a loose definition, what differentiates a simple composited scene-say a foreground element over a background-from a full MPR? Technically nothing. However, real MPR projects tend to be more sophisticated and often involve more than just two passes. They tend to be more complex and more importantly, they tend to move many elements of a scene’s control out of the 3D realm and into the world of the compositor. This is exemplified in the screen grab from 3DNY’s “Maya|Multi-Pass Rendering” Primer section, seen in Figure 1.

Light Dialogs
1: Interactive Primer Section

This last item is the most critical part of what makes a MPR so attractive. By moving our scene and attribute controls away from the slow realm of 3D, and into the fast and often real-time world of 2D, we net TREMENDOUS gains in control and overall production efficiency.

The question then becomes: How do we break a scene down into the various elements and passes needed to accomplish our goals? An MPR project can break a scene down based upon an unwieldy number of criteria. This can be done by various attributes (diffuse, reflection, specularity), by scene objects, by depth and distance, by special effects application, and so on down a never ending list.

In the “Maya | Multi-Pass Rendering” MediaBook dozens of different types of MPR projects are covered, however in this article we are going to look at just one type: various light sources used as the components for each rendering pass. The advantage this offers us is the ability to off-load most of our lighting decisions to post. In doing this we are able to have extensive control over each light in a scene, and control it all in real-time. Furthermore, our real-time feedback will be in final render quality instead of our less accurate OpenGL previews.

Once in our post compositing application we will assemble the various passes into something of a real-time 2D test box. This makes the subtleties of lighting design much easier to control and faster to produce. This saves time, money and lets the compositor, or even the project’s art director, work on and even finish the project.

Setting Up For MPR in Maya
We will start by looking at the various ways we can control the lighting within Maya, and use them to generate our render passes. As you will see, we have a number of options. We will start off slow-a bit of 101-then quickly build from there.

The Visibility of Lights
The concept of using an object’s visibility controls in Maya to turn scene objects on or off is easy to grasp. When applied to lights in a scene it controls the rendered illumination as well and performs much like turning real world stage lights on or off.

Light Dialogs
2: Basic lighting Visibility controls are found in multiple locations.

Lights can be controlled in this way using the following toolsets: In a light’s Attribute Editor window, its total display and render visibility can be controlled by using the Visibility toggles found under Light1 > Display. The same Visibility toggle is also found in the Shape > Object Display tab, as seen in Figure 2. By comparison, the LOD Visibility toggles, which are also found on the same two tabs, turn off a light’s screen display, but still allow it to render. This is good for getting rid of visual clutter when working on complex scenes (note that LOD stands for “Level of Detail” and is used with LODgroup nodes-not something that is generally used with lights).

Finally, there are a few on/off toggles that are specific to lights. They are found in the Shapetab > (light type) Attributes tab near the top. With most lights you will have the following options:

Illuminates by Default-this is basically an on/off switch for the light’s illumination during rendering, and controls both the diffuse and specular attributes. The following are sub controls:
Emit Diffuse-controls whether the light will illuminate a scene’s diffuse properties. Emit Specular- controls whether the light will illuminate a scene’s specular properties. Note that these three items will probably not be seen in the display view, however they are updated and visible in both the rendering and IPR windows.

Another option: You can also use the Hide and Show commands found under the DISPLAY menu. Hiding a light will both remove it from the world view, and prevent it from rendering.

Keep in mind that when a light is made invisible or hidden, it will no longer be selectable in the world view. To reach its controls and re-enable a light use the Outliner to first select the light. Also note that Outliner will display the names of visible items in black, and invisible items with blue colored lettering. This give you a quick way to tell what is and is not currently displayed.

For the most simple of needs you could use the Selected Lights or Specify Selected Lights found in the work view panel’s LIGHTING menu. But this will get tiresome quickly. It is also possible to use a light’s Intensity value turned all the way down to control its effect on the rendering. However this is likely to muck up other lighting controls so are best left alone.

All of these controls are wonderful and straightforward. But controlling lights one by one is an increasingly time consuming process as a scene gets more complex. So we need more efficient solutions.

Controlling Multiple Lights
Imagine a scene with 30, 50 or more lights that need to be controlled as a group. For example, it should be easy enough to add 200+ street lamp lights in a city scene to a custom Display or Render layer, and then use the layer to activate/deactivate the lights. One would think. Unfortunately, the Display layer will only control a light’s display and illumination visibility within the preview workspace-not during a rendering. If you are previewing the scene’s lighting it will indeed turn off any preview illumination, but this is not reflected during the render-VERY MISLEADING! The render layer will produce no effect whatsoever in this regard, as it too has no effect on lights during rendering. So how do we control many lights at once?

There are a few alternatives:
[Ed. Note: other sections of "Maya | Multi-Pass Rendering" not excerpted contain many more options than those listed here.]

  • Make active (i.e. select) all the lights to be controlled uniformly and group them together (EDIT > Group). With the light’s group node selected (not any of the individual light nodes-use the up arrow key to select the top group node), you can use any of the visibility controls discussed earlier to turn them on and off for display, but more importantly this will control the rendering as well. Use Outliner to select and control turning on or off the various lighting groups you create.
  • Outliner Light Sets
    3:The Outliner Showing a Lighting Group.

  • In the Lighting Sets, by highlighting the desired lights and selecting from the CREATE > Sets > Set or the CREATE > Sets > Quick Select Set. menus. This will accomplish much the same thing as grouping lights, however Sets do not alter the hierarchy of the scene. (See Figure 3)
  • Light Linking is sometimes another option. This will not actually turn lights on or off for you, but it will limit which items in a scene can be illuminated by which light sources. This can often be used to benefit in these and similar situations.
  • To create even more powerful group lighting controls, you can use the Hypershade interface’s Lights tab to set up a single light’s Outputs that will be used to control any desired Input variables for all connected lights. Thus you could have a lighting network with dozens of lights and simply adjust the intensity or color of the main (top hierarchal node) light and have those attribute modifications instantly applied to the entire connected chain.

Default Lighting
4: Scene as seen inside Maya’s working view panel using OpenGL.

Basic Lighting MPR Okay, the preliminaries over, let’s begin making good use of these tools. We all know lighting is a powerful tool in our work, and we also know it takes time to render and test render, especially when there are large numbers of lights. Getting the right look and nuance to a scene can take a lot of time. Getting it wrong and having to re-render takes even longer. Using a relatively simple MPR setup we are going to create all of the lighting in our next scene a la carte. In Figure 4 our test scene is illuminated with Maya’s default lighting in its OpenGL work view.

Basic Scene Render
5: All scene lights are placed, but without final adjustments.

We begin adding the lighting treatments to the scene by adding one light after another, being careful to properly illuminate all objects. In Figure 5 we see all of these lights dropped in place, however the image is far from a polished or finished one. We still need to do a lot of tweaking to the light intensities, colors, contrasts and other attributes before calling it done.

Getting to this point is pretty easy and we have a lot of enthusiasm moving us along. However, trying to refine a scene from this point on takes more dedication because it involves making 10,000 subtle decisions. It may also involve producing hundreds of test renderings which would take a lot of our time. So let’s speed this process up.

Ambient Pass
6a: Ambient light pass

Key Light Pass
6b: Key Light Pass

Rim Light Pass
6c: Rim Light Pass

Stair Light Pass
6d: Stair Light Pass

Background Pass
6e: Background Pass

By breaking down each and every light (or group of lights) into its own rendering pass we can composite them in post with a wide range of options. Doing this can accomplish one or two things for us. First, it allows us to play with different lighting attributes in real-time, no slow test renders needed. And since this can look much better than the hardware renders-including showing subtleties the hardware display can’t-it can be a great “test box”. Secondly, in many situations the tools in post are powerful enough that we can finish the project in the compositor and never have to go back for a re-render. Figures 6A through 6E show how each light was rendered separately.

Notice that we are including a base ambient rendering pass. This layer is too often forgotten, and is critical in controlling our scene’s contrast and overall shadow detail. It is created by adding an ambient light for that one pass-even if one was not needed in the original scene rigging. Each pass is rendered out one by one, until we have all 6 passes for this project. We are just rendering still images for this example, but the process works equally well with animation content.

Because of the unique additive nature of lighting, these rendering passes can be treated a bit differently than other types of MPR projects, and in the process save us a few steps in post. Each layer should be rendered out with the Premultiply (default) toggle enabled, and the Alpha Channel (Mask) toggle off. Both of these toggles are found in the Render Globals menus. The reasoning behind these settings will become apparent in the next section.

Advanced Lighting Set up
When generating lighting based MPR it can sometimes be necessary to break down certain passes into what we might call “micro-passes”. For example if you have a foreground light whose illumination falls upon both foreground and background objects as well, you may need to break this into two passes. This way you retain discreet control over the lighting on each scene object. However if the illumination spilling onto the background objects is inconsequential, and these background objects are already illuminated by other lights in other passes, then simply rendering the foreground object alone may suffice and save you from extra work.

Light Links & Light Selections: Another way to control lighting passes is to use Maya’s Light Linking tools that allow you to limit which objects a light will illuminate. For example, to prevent a foreground light from illuminating background objects, we can open the Light Centric Light Linking Relationship Editor (WINDOW > Relationship Editors > Lighting Linking > Light Centric). On the left simply highlight the light to be edited. Then on the right side enable the scene objects to be illuminated by this light, and disable those the light should not affect.

A fast way to know what objects a light is illuminating is to select it in the scene view and use the LIGHTING/SHADING > Select Objects Illuminated by Light. The process can also be reversed by selecting the Select Lights Illuminating Object.

Lighting Passes in Post
Once our passes have been rendered we can bring them into our compositor. We will be working with Adobe After Effects here, and with single frame passes, but everything we do is also applicable to multiframe work and most compositing applications.

Since lighting is an additive process, we can actually approach the compositing of all layers the same way. This is a much more natural workflow, and very different from other types of MPR compositing projects that have more of a patchwork quality.

Here are the steps:

  1. Open After Effects, create a new comp, and import the render passes
  2. Go to COMPOSITION > Background Color. and set to black
  3. Select all of the layers and place them on the comp’s stage (Cmd or Ctrl-/)
  4. Select all of the placed layers and modify their Transform Mode to Lighten (Screen or Add and other choices will work as well, with varying results)

In After Effects
7: Multi-Pass Rendering passes assembled in After Effects.

The result is a composition that should look just like Figure 5. But now we have each light as a separate and editable layer in 2d. Here is where the fun begins. Since we may not be sure exactly what aesthetic we are looking for, we can modify each layer’s Opacity settings and start to rebalance the lighting. In doing this, our feedback is both immediate, and of final production quality. You can see the assembled project in Figure 7.

One of the unique features of this particular style of MPR is that since it is additive, we can add more layers as needed. For example, if we found the need to add another light to spread more illumination over the right side background, then we could just render another pass with that light and add it to our mix in After Effects. Unlike with other MPR solutions, this setup using an additive based Transform (Lighten, Screen, Add) will not require modifications of the other lights/layers-not even those that it may overlap. Very nice!

This method of working allows us to build up the scene in much the same way we would in Maya, or the way a lighting designer would work in real life. Care must be taken to not overdo a good thing-too many lights can still be costly.

Lighting Test Box When we work with these composited light layers, we are not limited to using just the opacity controls-far from it! What we have before us is a real test box, a digital lighting lab where we can try out all sorts of things. We can alter an individual layer’s color, hue, contrast, gamma, brightness and more. We can even push things further than you might have thought, for example, if you were to bring a layer’s Opacity to 100% and the image on that layer was still not bright enough, you could add a Levels filter and crank up its Input White Point and Gamma controls to push the whites and mid tones even higher.

Layer Effects
8: Being able to add per layer effects allows for fast and powerful controls. Before on left, with Directional Blur filter on right.

Any number of effects can also be added to a specific light layer. In Figure 8 we see a simple Directional Blur filter added to the Rim Light layer to quickly create a motion blur effect. In this example a trailing blur is quickly created without the need for the more time consuming 3D motion blur treatments. Note that the underlying layers were changed to the Add transform for improved interaction with the blur.

Combined with this technique, we can actually use our lights in Maya to choose areas of the scene or a model where effects should be added later. This is almost like creating visual selection sets. This can be used to create broad effects, or very subtle accents. More aggressive filtering effects like distortions are also very effective.

FAKE LIGHTS TRICK: A frugal way to add the effect of additional lights without extra cost is to use 2D elements where applicable. In Figure 9b you can see that a spotlight effect has been added along the right side of the background. Here a Solid layer was used as follows:

Fake Spot Solid
9a: Fake Spot Solid

Fake Spot
9b: Fake Spot

  1. In After Effects create a new Solid layer on top of the other comp elements. The Solid in this example was set to white, but other colors can be used for various effects. (Figure 9A)
  2. Use the Oval Mask tool to create an oval spotlight shape. This can then be further edited to resemble a light source at various incidences.
  3. Go to LAYER > Mask > Mask Feather. and crank up the edge softness.
  4. Position the layer as desired on the stage.
  5. Set the Transfer Mode to the Overlay setting.
  6. Set the Opacity and adjust as desired. (Figure 9B)

Notice here that the Transfer Mode is set to Overlay. This is because we are dealing with a solid color instead of an image of light as before. If set to any of the additive Transfers used with the other layers , the effect would become an unsaturated pallor which we don’t want. When done properly and kept within its limits, the results are very effective and natural. This effect works best when simulating lights cast from a more frontal direction, as it cannot generate any model shading or cast shadows. The effect could also benefit from the use of After Effect’s 3D layers to help achieve some types of results.

Read more about 3DNY’s “MAYA | MULTI-PASS RENDERING”: http://3dny.com/mpr.html
(A shorter version of this excerpt also appeared in 3D World Magazine issue #53)

Comments are closed.