How to achieve masking similar to a fog of war effect?

Hello,

I am working on a side scrolling game and I need to have an interactive fog of war type mask that is positioned in world space and is applied on all materials in the game. Ive looked into using a TargetTextureRender2D, but I don’t know how to make it render only specific elements that i want to use as a mask. Ive included a picture illustrating what i mean.

Only thing i could come up with is to use the custom depth buffer as a mask, but that would be pretty limiting to what i want to achieve. I did however tried to add the custom depth blendable to the TargetTextureRender2D camera… but it does not work.

I’m wondering what my options are. Can someone point me in the right direction? Are there better ways of doing this? The game I am working on is for mobile platforms. so I am limited in using certain material nodes such as SceneTexture.

You can still use the SceneCapture2d effect. Create a blueprint with a SceneCapture2d component and stash it somewhere away from the actual level. Put a cube static mesh component in front of it as a background and use a white material for it. Once the game starts change the texture of the material to the render texture. Imagine this as your minimap. If you create a black circle component between the cube and the scene capture2d components and move it around it would leave a black trail on the render texture. Use the same render texture as an alpha mask to create a material for a horizontal plane above all objects in your level and you’re done. It would look a bit pixelated though.

Thank you for your reply.

Thats what i was thinking as well, I’d have to create some kind of a parallel level that will be rendered as a mask. But that just didnt seem like the way to do it, I was hoping there was perhaps a more straight forward and efficient way of achieving something like this. Do I have any other options?