SceneCapture2D to BW Render Target mask

Hey! I’m trying to use a SceneCapture camera to capture the current scene onto a render target and convert it into a black and white mask, where everything is white except for some actors that are a black silhouette (no greys).

I solved it by adding a white plane in the background and a copy of the static mesh in each actor but with a black material, and then making these meshes only visible to the SceneCapture camera. This actually worked but seems needlessly complicated, so I’m wondering if anyone has a better solution? I’ve also tried to change the post process effects on the camera to squash the colors such that only black and white remains, but this makes meshes with lighter color disappear. I also solved it by adding the render target with a certain capture type to a material and plugging it into the emissive channel, but I need a texture of some kind and not a material. Perhaps this solution could be used by converting the material to another render target, but how expensive would that be? It can’t be a static texture as the scene will change and the mask has to keep updating.

Edit I have managed to get it black/white by adjusting gamma and removing the background plane. However, it is inverted compared to what I want. If there is some way to invert the colors in blueprint that would also solve it.

Edit 2 I managed to solve it on my own. If anyone else is struggling with this, you can easily create masks using the custom depth or stencil buffer!

Thanks!

Hi there. I can not for the life of me figure out what I’m pretty certain should be simple to do, seems like you have figured out how? How do I make only one type of blueprint (meaning I created BP_box and then placed several of them in my level) visible to the scene capture but nothing else visible?

I had tried using custom depth buffer to create my mask, but I need to use the mask with a non translucent material, and I can’t reference the custom depth buffer in the opaque material, so I was going to use a scene capture to render just the custom depth buffer, but I can’t figure out how to do that either, so next I thought I’d render only the selected actors in the scene capture, but I can’t figure out how to do that either! I only need to create this texture and apply it before play begins, and I don’t even need it at runtime, I really only need to be able to create this mask in the editor once I have placed all my assets, but I can’t figure out a way to do it, and I know it’s a simple thing, but I’m new to ue4.

https://learn.unrealengine.com/course/2582838