This script creates a Material Id and Object Id render layer. The original material assignments are maintained through the masterLayer. This makes keying any object or material in a compositing program very easy.
The script's steps:
1) Creates a render layer for Material Id and Object Id.
2) Creates a shader for each shader assigned to all objects for the Mat_Id layer. For the Obj_Id layer, it creates a shader for each object. Shaders are lamberts with no color and a solid incandescent value. Saturation and Value are set to 1 and hue is cycled in increments of .01 out of 1. This will create 100 unique shaders, after which point the cycler will reset.
3) Assigns the newly created shaders. For the Mat_Id layer, material assignments will be based on the object's shaders, for the Obj_Id assignments are based on every object.
4) Creates a Material bin for Mat_Id and Obj_Id shaders.
Known Issues:
- Your scene will have two new Material bins, but the hypershade will often only show one. Toggle between materials and bins to update the bin list or close the hypershade and re-open it.
- Currently, this script creates 2x the number of object ID shaders, making a lot more than it needs. In they hypershade, you can Edit - Delete Unused Nodes to clean this up. I didn't want to put this in the script itself, I may delete nodes that the user wants that aren't assigned to anything. In a future version, I will hopefully fix this problem :)
- Transparent objects and materials will not have their transparency.
- Instances, groups and objects with per face material assignments have all caused problems in the past. They seem to be fix but beware :)
- This script uses render layers and render layers tend to be buggy, save a backup of your scene just in case.
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.