PxrCryptomatte has since superseded this workflow as a useful and nearly automatic alternative.
Add a user attribute for MatteID0.
Duplicate the fields for:
- Label (this is the UI name)
- Tags (necessary to see RenderMan attributes and edit them during interactive rendering)
Set its type and color value.
Create a Houdini buildarray node to connect to the Utility Pattern on the PxrSurface material. Then connect a PxrMatteID Pattern node to the buildarray as shown below.
In your PxrMaterialBuilder Network, add a PxrMatteID VOP. Set the color as the user attribute above.
Connect PxrMatteID's resultAOV to PxrSurface's Utility Pattern.
Set up AOV for Output
Choose the correct/corresponding MatteID AOV output from the RenderMan ROP node Displays Tab
You will notice we set a color on the OBJ with an attribute and there's also a color from the MatteID pattern itself. This is so you can multiply the color of the attribute by the pattern node. For example, you can supply a texture mask to the MatteID pattern node and have it multiplied against the color chosen in the MatteID Attribute