Render Passes for Maya - Tutorial

Written by Andrew Chapman


This is a very simple tutorial to lead you through the steps involved in setting up a scene to use Render Passes. The pass created here will not be useful for anything, but it will give you an idea of how to go about creating whatever passes you need.

Step 1 - Loading the Plugin

Create a new scene in Maya, and ensure the Render Passes plugin is loaded. You should see the Render Passes menu in Maya's main window menu bar when in Rendering mode.

Step 2 - Create an object

Now create a NURBS sphere, make sure it is named nurbsSphere1 (Maya's default name) and move the camera in on it (by default, press the 'f' key with the sphere selected). If you render at this point, you will see a mid-grey coloured sphere. This will be your 'normal' scene - i.e. your scene setup how you like it before making any modifications for Render Passes.

Step 3 - Create a Red Material

Create a new blinn material, and set its diffuse colour to be red. Ensure that this new material is named blinn1 and its shading network is named blinn1SG (which they will be by default). Don't apply this new material to the object - rendering at this point should still show a grey sphere.

Step 4 - Create a 'Red' Pass and Material Override

Open the Render Pass Editor from the new Render Passes menu. Click the Add Pass button in the dialog, which will create a new pass named newRenderPass1. On the right side of the editor, change the name to RedPass and click Save Changes to this Pass. You now have a new pass, but applying this pass will not currently do anything to your scene.

Next, click the Add Override button, which will create a new override named newOverride1. On the right side of the dialog change the name to RedMaterial, and select the RedPass in the list of passes to apply this override to. Click the Save Changes to this Override button. You now have an override which will be used when you apply the RedPass to your scene. However, as there is no MEL code in this override (except for the default comments) it will have no effect on your scene.

Now we will write a short piece of MEL code so this override knows how to override the material of the object in your scene. Type the following into the Override MEL Code text area (you can either remove the comment line there, or put this code underneath that line):

   assignSG blinn1SG nurbsSphere1;

In the MEL Code to revert Override section, add the following:

   assignSG initialShadingGroup nurbsSphere1;

Save the changes to the override. The code above will assign the red shader to the sphere when you apply the RedPass, and will revert to the default grey material when you select any other pass (including the special <none> pass which turns off the effects of all passes). NOTE: the first line in each of these pieces of code makes available the assignSG command to assign a shading group. For some reason this command is not available by default, until you right click on an object in one of the Maya viewports.

Step 5 - Render Your Passes

Open the Render View, and render your default grey sphere scene. Now, select the menu item Render Passes - Set Render Pass - Red Pass. If you now render your scene you will see a red sphere. Select the menu item Render Passes - Set Render Pass - <none>, rendering now you will see a grey sphere again.

Congratulations, you've just set up a scene with a special pass for rendering your normally grey sphere red.

Further Steps

Now that you've set up one pass, you should be able to create a few more trivial passes yourself. You can put literally any MEL code you need into your render pass overrides, in order to make the changes you need.

You should continue getting familiar with using Render Passes for Maya on a simple scene like this one before using passes with any production scenes you are working on.

You should also find a demo scene included in the package you downloaded. This scene contains a number of pre-configured render passes. Just open the render view, and select each pass in turn and render it to see the results. You can then inspect the override code in the Render Passes Editor to see how it works.

Return to the Render Passes documentation