Rollover image to view Object ID pass (Utility shader set to 'obj')
The AOV Write shader in combination with the Utility shader is a useful combination for writing out an Object ID pass. This simple setup will allow you to use an ID pass in compositing software to identify certain objects by their color. We will also isolate certain objects and give them specific id's with which to group by color.
- Open the Slate Material Editor.
- Start off by creating a Standard Surface shader that you want to use as the beauty shader.
- Now we need to create an aov_write_rgb shader (you must connect an aov_write node into each material that requires an AOV). We will use this shader to write out our 'Object ID' pass. From the search bar on the left, type 'aov_write_rgb'. Drag this shader onto the main work area in the center. Assign it to the geometry that you want to create an Object ID render.
- Select the aov_write_rgb shader and type 'ObjectID', into the aov_name. This is the name of the Object ID render pass that we want to create.
ObjectID added to aov_name of 'aov_write_rgb' shader
- Next, create a Utility shader. Change the Shade mode to flat because we only want flat shaded color for our Object ID pass. Change the Color mode to obj. Object mode will use the name of the objects in the scene to compute the color.
- Connect the Utility shader to the aov_input attribute of the aov_write_rgb shader. The output of the utility shader will be directed to our custom aov by connecting it to the aov_input parameter.
- Connect the output of the Standard Surface shader to the passthrough attribute of the aov_write_rgb shader. The reason its connected to the 'passthrough' is that we want to see the output of the Standard shader in the beauty render.
Final shader network
- In the previous setup, we defined data to be written to a custom AOV. However, we have not added our AOV to the scene yet. Now we need to create a custom AOV to write out our Object ID. Open the Render Setup window and under the AOVs tab, select Setup AOVs.
Select Add custom AOV, and the Arnold Add Custom dialog will appear. Add the same name that we used for the aov name that we used earlier (ObjectID). If the names don't match, it will not work. In the AOV window, a new group called <custom> is created. This group lists all custom AOVs defined in the scene. Our newly created custom AOV is activated by default, and you can see the name ObjectID in the Active AOVs list on the right.
Add a custom AOV and rename it 'ObjectID' (the same name used for the 'aov_write_rgb' shader)
- Now when we render the scene, we can see our newly created ObjectID AOV! The aov_write_rgb collects the ObjectID attribute from the geometry and passes it to the ObjectID AOV.
Utility shader's 'Object' mode uses the name of the shapes to compute the color