My latest shader assigns each object in a scene a distinct, randomly selected color, the so called Object ID. I have decided to offer this shader as a free download to the mental ray community.
An Object ID pass isn’t exactly pretty, but it is incredibly useful because a compositing artist can apply effects or corrections to individual objects or specific areas without the need to render separate masks or even paint masks by hand.
My approach to this shader is somewhat naïve in that it randomly assigns a color to each object without regard for adjacent object’s colors or possible repetitions. However, the chances of the same color being picked twice by the algorithm are so small as to be negligible for all intents and purposes.
Download
Download
minObjectID is a free shader for mental ray (Windows x86/x64 and Mac OS X)
Usage
Once minObjectID is assigned to your objects just hit render and you’ll have a random color on each and every object — no need to manually specify object– or label IDs.
Note that this shader’s output is not compatible with Nuke’s or Fusion’s ObjectID format as it does not save to an integer buffer in OpenEXR files.

