I am trying to use blender to generate training data for a machine learning algorithm. As such, I need to render a given scene twice, the first time generating an actual image, and the second time generating an "instance" map (where each object is simply a uniform color).
Rendering the RGB image comes out perfectly, and via the example shown here, I am able to generate an instance map exactly as I want. However, I can currently only do that by manually rewiring the shading nodes from the RGB setup, to the emission based instance setup.
Given that I'd like to generate thousands of images (by changing the seed of the particle system via a python script), this is obviously not really an option.
So what is the best way to have two separate entirely different rendering pipelines, that utilize the exact same geometry and layout? It would be ideal if I could define two separate shader node setup for each object, and from a python script, simply switch between the two.
It seems like this is something that should be rather straightfoward, but I've yet to find anything specific on this, so I would very much appreciate help pointing me in the right direction! Thanks