It would be great if UE4 would allow for custom masks. Masks are widely used in Film/TV post production and they would also benefit games greatly.

It should be like you mask something in a material and that mask takes then over to the post processing material. So it is possible to apply different effects to different parts of the world and objects. Masks can then be applied to whole objects or on a texture/UV basis and even vertex colors.

For this to work 2 key components are required:

  • Custom material output: The user can add a new custom output in the material.
  • Custom SceneTexture: The user can add a new custom scene texture input in the post processing material this can then be linked to the custom material output. This Custom SceneTexture behaves then like SceneColor except it only renders the colors of that defined Custom Material output (while also occluding)

As of now the only mask in post processing materials that can be used is Custom Scene depth but having only 1 useable mask is obviously very constraining and it has no color and it is only on a object level with a tickbox.

The movie Sin City is great example for a wide use of masks, at first glance it looks like heavy color grading but it really uses lots of masking and not just for the red, otherwise it would look really cheap. While with 3D rendering making masks would obviously be much easier.

You man something like MaterialID?

Defining it inside the materials would be better, then textures, vertex color and other material stuff can be also used as a mask. That rendering isn’t something out of UE4 or? MaterialID pass would be also nice.

Nothing yet on this one? Even RGB masks would do.

It would be so awesome to be able to have a mask that you could maybe edit in real time. Like a mask in After Effects, with vectors and vector points. So maybe setting a certain amount of vector points, then setting the position from a blueprint for example.

I believe you can use Custom Depth with Custom Stencil enabled to be able to render all meshes with a different value that can be determined in a Post Process shader. I believe this has a limit of 255 masks due to the size of the Custom Stencil buffer.

Some examples here.

You could create simple shape masks and then pan and rotate them around inside another texture to create a dynamic mask.
Sounds like an interesting little challenge :slight_smile:
If I have some time, ill give it a go…