At Psyop we have a tool called “Cryptomatte”.
Deconstructing the name, “matte” means that it makes ID mattes, and “crypto” means that people are confused about how it works. To help clear things up, we’ve published exactly how it works in our SIGGRAPH 2015 poster, which is now posted online for everyone!
View the Psyop ID mattes Poster here (PDF)
The super short version of how it works: Object names, namespaces, and material names already organize 3D scenes. You don’t need any more information than that to create IDs and this information is available inside of the renderer. That, plus a funky encoding (a ranked series of ID-coverage pairs in a multichannel EXR) means we can automatically provide mattes for every object, material, and namespace which stay accurate for all the “multiple objects in the same pixel” cases like AA, motion blur or transparency. All this happens more or less automatically in 3D and the 2D experience is even better (see the video!)