This tutorial was written by the amazing Midge Sinnaeve and appeared in issue 104 of 3D Artist
This tutorial is about understanding Blender Cycles render engine passes and how to leverage compositing them together in After Effects for more flexibility in post-production. The guide takes you through the basics of multi-pass compositing. Learn about the benefits of working this way and gain an understanding of why this workflow can save you time in the long run when working on complex scenes.
Step 01 – Analyse the scene
Open up the provided C2AE-START.blend file to have a look at its contents. We’ll use this scene as a jumping-off point to set up the Cycles passes we’ll be using in After Effects. A final render has also been supplied to work with, so no rendering is required to complete the training. Take a moment to get aqcuainted with the Blender scene to be able to follow along easier.
Step 02 – Set up the scene
In the Render Layers tab of the Properties window, there is a Passes section with all of the render passes Cycles is able to output. We’ll start by selecting all 12 of the passes found under the Diffuse, Glossy, Transmission and Subsurface headings. Be sure to enable the Emission and Environment checkboxes as well. These passes contain all the information we need to re-create our image in After Effects.
Step 03 – Add any additional useful passes
On the left of the passes there are a number of extra ultility passes that can be added to a render. The Combined pass is enabled by default and is just the final render. Leave this pass in for later reference in After Effects. The others serve as tools to be used when you’re compositing the render. For example, the Z pass can be used to add camera depth of field interactively in AE. Be sure to check the Z, Mist, Object Index, Material Index and AO passes respectively.
Step 04 – Object index
Some passes need additional setup in the scene, as is the case with the Object and Material Index passes. These serve as masks that can be used in compositing to tweak individual objects or materials. Starting with the Object Index, a unique number needs to be assigned to each object that a separate mask is wanted for. Do this by selecting an object and going to the Object tab, then changing the Pass Index under the Relations section. By default, all objects have an Index of 0, so make sure to have a unique value higher than 0 for each object that needs a mask. In this case the candle at the rear has an Index of 1 and the candle at the front has an Index of 2.
Step 05 – Material Index
After setting up the Object indexes, it’s time to do the same for the materials of the fruit in the scene. Each piece of the three types of fruit comes in two variants, so there are six materials total to set up masks for, as well as one for the velvet cloth. Start by selecting one of the lemons and going to the Material tab. In this example, MESH.Lemon.A.001 is selected. Under the Settings heading there is a Pass Index option, which will be changed to 1 for the first material (Lemon.A). Do the the same for each fruit variation and the piece of cloth and make sure to increase the Pass Index to a unique number for each material.
Step 06 – The Mist pass
Other utility passes that need extra parameters are the Mist and AO passes. The Mist pass is generally used to add some atmosphere into the scene during compositing and as such needs to be set up to define the visible distance of the scene. The AO pass, on the other hand, can be used to add extra shadow-like detail. Both of these passes are set up in the World tab after enabling them. These values will be dependent on the size of the scene and will be different for every project. In this scene, setting the Mist to 1.0 and 2.0 and the AO to 0.025 produced the desirable effects. There’s no need to check the Ambient Occlusion checkbox for it to be rendered to a separate pass.
Step 07 – Ready to render
Before hitting the Render button, there’s one last thing to set up. In order to have all the render passes available in the output file, it must be saved in the OpenEXR MultiLayer format. This ensures all the render passes are contained in one image file, so they can be extracted in AE later. The Float (Half) option has everything that’s needed to store all of the information and doesn’t take up as much space as the Full option. This can be set up in the Render tab.
Step 08 – Set up After Effects
To set up After Effects for a linear workflow, click on the 8bpc button at the bottom of the Project panel. Set the Depth to 32 bits, Working Space to sRGB and tick the Linearize Working Space check box. Now all of the colours in the project will be displayed correctly and it’s time to start compositing.
Step 09 – Import the render I
Import the C2AE-FINAL.exr file by going to File>Import. Drag the imported image onto the Composition button at the bottom of the Project panel. After Effects will create a composition with the image in it as a single layer. With the image selected, add the EXtractoR effect to it from the Effects menu. Click on the channels and select RenderLayer.Combined in the layer dropdown. Hit OK to enable the final render to show up in the Composition view. This layer can now be used as a reference when combining all the diffirerent passes.
Step 10 – Composite the first colour passes
Start by duplicating the reference layer three times, so they already have the EXtractoR effect applied to them. Renaming the reference layer keeps things clear. Starting at the top, select the RenderLayer.Subsurface.Col layer in the EXtractoR effect and set the blending mode to Multiply. Select RenderLayer.Subsurface.Ind for the layer under it and set the blending mode to Add. Finally, set RenderLayer.Subsurface.Dir for the third layer, leaving the blending mode at Normal. With these three selected, go to Layer>Pre-Compose to group them together in a new composition called SUBSURFACE.
Step 11 – Composite the other colour passes
Refer to the Pass mixing chart to set up the Diffuse, Transmission and Glossy passes the same way the Subsurface passes were combined. Don’t forget to group each set into a pre-comp with the approriate name to keep things easily readable. The last pass that needs to be composited on top of the pre-comps is the Emission pass. Copy the reference layer one more time and select the RenderLayer.Emit layer in the EXtractoR plugin. Finally, add together this pass and the pre-comps below it to re-create the reference image.
Step 12 – Object Index masking
To use the masks in the Object Index pass, select the Renderlayer.IndexOB.X channel manually for the Red, Green and Blue channels in the EXtractoR plugin settings. Next, set the White Point to the highest Pass Index selected in Blender. In this case that’s 2. To extract the mask from the greyscale image, add a Colorama Effect after the Extractor and finetune it to only have the back candle selected. This can now be used as a Luma Matte for an adjustment layer with a Hue/Saturation effect above the SUBSURFACE group. Please refer to the video for an in-depth explanation of this.
Step 13 – Material Index masking
The same technique described in the previous step can be applied to the Material Index mask pass. Don’t forget to set the EXtractoR white point to 7 instead of 2, as there were 7 Material Pass Indexes set in Blender. Note the limitation of using these mask passes with the fruit, where the mask is limited to the parts of the objects that are directly visible. The parts that are refracted in the bowl aren’t masked, as Cycles treats all objects as opaque when creating the mask passes.
Step 14 – The Ambient Occlusion pass
This pass can provide extra detail in shadowed areas of the render. Once again, select the correct render layer in the EXtractoR plugin after duplicating the reference layer. When this layer is set to Multiply the white areas of the AO pass dissappear and only the dark areas of the pass will affect the final image. Experiment with the opacity of this layer by hitting the T key with it selected in the timeline and changing the Opacity value
Step 15 – Back to the Mist Pass
Although this pass is mainly meant for use in large-scale images to create a sense of haze in the air, it’s still interesting to experiment with its effect on the scene. In the EXtractoR effect, the Red, Green and Blue channels need to be set manually to the RenderLayer.Mist.Z to get a usable image. Set the layer to Add and experiment with the opacity by hitting the T key with the layer selected.
Step 16 – The Depth Pass
To use this pass to create depth of field, first set the EXtractoR Red, Green and Blue channels to the RenderLayer.Depth.Z and add a HDR Highlight Compression effect after it from the Utility section in the Effects menu. Then, pre-compose the layer with Move All Attibutes Into The New Composition selected with the name DEPTH COMP. This layer can now be turned off and moved to the bottom of the layer stack, as it doesn’t need to be visible to use. Add an Adjustment layer to the top with a Camera Lens Blur effect. In the effect, select the newly created DEPTH COMP as the Blur map. Experiment with the focal distance and blur size parameters to tweak the result.
Step 17 – Final thoughts
While this compositing method takes some time to set up in After Effects, it can reduce the number of re-renders from Cycles if some adjustments need to be made, although some limitations apply. For a more in-depth explanation, be sure to have a look at the video version of the tutorial where each step is explained in more detail.