Clean mattes from object ID pass
As I understand it, creating a material or object ID pass is pretty common practice, using surface shaders with a single color (typically Red, Green, or Blue, and additional ones might be Cyan, Yellow, and Magenta so the RGB values are very straightforward). (see Fig 1 )
What I can't figure out is how in After Effects to get a perfectly clean, accurate alpha or matte or mask for a single color. Most tutorials I can find (even high profile ones) seem to go the route of applying a "Color Key" and tweaking the color tolerance and feather. This in my experience is just guesswork and won't create a clean accurate matte.
The alpha is anti-aliased (see Fig 2 ). Obviously anti-aliasing at the outside edges and between colors complicates the process, but there should still be a simple mathematical way to isolate these regions with an anti-aliased alpha.
The better way seems to remap the channels, for example using "Channel Mixer" and setting all other channels to -100 or 0 except the one you want and then using it as a luma matte? But even then, if I duplicate the process for each color and put the layers on top of each other, I get black lines at the intersection of colors and the outside edges aren't the same.
I did a very simple experiment where I have two copies of the id pass and used one as an "alpha inverted matte" of the other. This should completely eliminate the image, yet I have a fringe showing up. (Fig 3)
TL;DR: Does anyone know the RIGHT way to use an id pass? (If you say "use Nuke" I might actually take you up on that).
Thanks!