How to make an object invisible in masks (render elements)?

To make an object invisible in any masking render elements (for example alpha, wire color), in its material settings go to "Advanced options" and uncheck "Visible in masks". This is useful for example for rendering elements when there are objects behind windows.





Examples


1. We want to render objects that are behind the window in this scene:


With default settings, this is the result of rendering Wire color render element:
Window glass occludes exterior objects.


This is the output when "Visible in masks" is unchecked for glass material:
Window glass does not occlude exterior objects.