Create binary segmentation images based on object flags

What you probably need to do is create a post-process material with ‘SceneTexture’ node which you should set to CustomStencil in the dropdown in its properties. You should also enable Render Custom Depth on all static meshes in the scene and assign to each of them a different Custom Stencil (or assign them based on object type or whatever you want the objects to be segmented to).

Then what you do is create apply this post process material to a post process volume. As it’s quite hard to change post process materials in post process volumes from blueprints, as far as I know, it might be easier to just create a separate post process volume and switch between them. I’m posting a few screen shots below:

This is the node-graph of segmentation post-process material. The starting node on the left is Scene Texture with CustomStencil.

This is where I find all the static meshes in the scene and assign a random custom stencil between 10-255. I kept the stencils below 10 reserved for the landscape and the sky.

213567-screenshot-2017-09-15-091433.png

The properties of a static mesh in the rendering part. This is where you enable Custom depth rendering and where you can assign a custom stencil.

This is the final look. I’ve manually set the landscape’s custom stencil to 1, which is rendered green (using bitmask node) and the sky is set to custom stencil 0 (you can’t change that actually), which is rendered black.

I hope this helps.