Maya Render Passes to Nuke
There are many schools of thought on multi pass rendering with many people employing different approaches consisting of different passes. The following I have found to be the most flexible. Slightly different approaches might be used in particular instances, for example a motion pass will be needed if the object is moving and some post-render motion blur is required.
Key Maya knowledge
A few bits of key Maya knowledge are needed:
A render layer is a way of managing the render. It can ‘contain’ many render, scene and shader settings specific to that layer. It can also contain many Render Passes.
A render pass is a render ‘attribute’ such as light, shadow, reflection etc. A Render Layer can contain many Render Passes. They are managed through the Render Settings. First turn on Mental Ray then go to the Passes tab. Add all the passes that are needed (below left) and then associate them as needed to each Render Layer (below right).
The following passes will be needed:
- Ambient occlusion, which is a ‘map’ of areas hidden from ambient light such as crevices and overhangs.
- This is the flat color of the object with any light or shadow at all. Do not confuse it with diffuse light which is a light pass.
- Indirect light.
- The reflected environment.
- This is the shadow that is cast by the lights.
- This is the specular light i.e. highlights.
- Matte = alpha.
- Direct light.
Most of the attributes of an object or scene can be made subject to overrides that are specific to a particular Render Layer. First make a Render Layer and then right click on the attribute and select Create Layer Override.
Render layers specified
These are the Render layers that will be needed to set up and their associated Render passes.
This will contain most of the Render Passes. To get the AO the Ambient Occlusion will need to be turned on in the Indirect Lighting tab of the Mental Ray render settings.
This contains the simple alpha of the object and it will be used to separate the object from the environment. A Layer Override will need to be set up for the scene. Go to the Shape Attributes of the ground plane object and turn off Primary Visibility in Render Stats. This layer will contain only one Render Layer:
This will do something a bit tricky. In order to integrate the object with the new environment the alpha of the shadow that the object casts onto the ground plane is needed. But the object should not occlude (obscure) the shadow. To do this the Primary Visibility of the object will need to be turned off as a Layer Override. Though it will be invisible to the render it will still cast a shadow. The following Render Passes will be needed:
Maybe a reflection pass will also be needed, depending on the physical quality of the ground plane.
This is clever. Set a layer attribute for the color of the lights to a pure red, green or blue. This must be done numerically in the Color Chooser. An RGB light pass can be pulled off from the render, each channel of which will contain the light information from a particular light. This approaches saves having to do separate Render Layers for each light. More than three lights can be rendered if they are set to secondary colors and separated out with a but of simple maths in the compositing app. It will contain only one pass:
This is how the passes are assembled in Nuke. A similar arrangement can be used in After Effects. Other passes might be needed depending on the circumstances. NOTE: Maya outputs images in sRGB color space but Nuke assumes that .exr files are in linear space. You must therefore change colorspace setting in the read nodes from Linear to sRGB.
Object passes (in order of application)
diffuseMaterialColor This is the base layer to which all other layers are applied.
- The most flexible way to use this pass is to mask an ADD node with this pass taking care to ensure that the appropriate channel is set in the mask pull down menu. The color and strength of the mask can be moderated by the add node color values. This pass should first be moderated by a Multiplication set to zero and masked by the shadowRaw pass. This will remove the cast shadows from the light.
- Use the same approach as in directIradianceNoShadow but without the channel specific bit. This is an RGB pass but only one channel need be used in the mask. Out of habit I usually use the green channel.
- Use the same approach as in indirect.
- This is also a light pass but as it contains color it is best used in a layer mode with the blend set to Plus.
- Use this as a mask to a Multiply node.
- Set the object alpha to this pass and then pre-multiply.
Ground plane passes (in order of application)
- Use this as a mask on a Multiply. This will act as the ‘foot’ of the shadow.
- Use this as a mask on a Multiply. This will act as the main body of the shadow.
This guy has a very clear tutorial on multi pass rendering setup though his approach is slightly different (e.g. he uses a shader for the AO).