I want to render multiple ID masks to separate file outputs?

I want to render out several ID mask to separate files. I’d like to use the file output node to render each mask to a different file it would be a real time saver but I don’t know what node combo I need to use. Any help would be much appreciated

Frankly, I’d suggest setting up one-or-more RenderLayers and using this facility to store the various outputs into one MultiLayer OpenEXR target file. However, that being said, it will probably be more satisfactory to break the shot into multiple independent renders. (You can use “Scenes” within a single blend-file to do this.) After all, the entire purpose for having “separate files” is that you will be able to re-render any one of them without necessarily having to re-render all of them.

You can use just one scene if you want. Set the Pass Index for each object and then route that pass information to the ID Mask node. The output from the ID Mask node is what you would send to your separate files.

Attachments

27_material_ID.blend (91.2 KB)


If you have many id’s or enough so that you don’t want to set the outputs for each, could try and exploit file output node behaviour to add frame number in the end of the filename:

In short: Set object or material indices that match frame numbers, render once and save as multilayer openexr, set one id mask node with a driver, file output node and render animation from that. This saves multiple masks in one go.


  • Set object index for each object
  • Enable object index pass in render layers
  • Render frame (F12) and save as multilayer openexr file. Drag and drop that .exr in the compositor (in a new file maybe) and delete render layer node.
  • I have cube indices set to 1-5 so I set the start and end frames accordingly
  • File output node configuration, set the filename prefix. Hashtag (#) means it replaces that with the frame number. Default is four digits
  • Id mask node. This is controlled by a driver. To get it to match frame numbers, could type “#frame” without the quotes in the number field
  • Rendering animation produces a mask file with the matching number