Is it possible to create a post-process material mask based on tags?

Hi, I am wondering if it is possible to access the tag in the material editor.

I want to create an object mask for my post-process material based on that, if possible.

I am aware of the custom depth and stencil masks. But I am curious if I can use the tags to generate a mask for post-process material.

I don’t think so, tags are variables only accesible from cpu, while postprocess materials are running on gpu. Maybe editing something in the source code, but even then, I don’t think it could be done

1 Like

editing source code isn’t an option because I am building a product that I want to sell in the marketplace.

So the only option is custom depth then?

Yes, custom stencil should work, but it is limited to 256 possibilities (problably more than enough in most cases)

You can add multiple Materials that implement the custom stencil buffer to have different effects. Basically every class that inherits from UMeshComponent gets a custom stencil index property 0-255. You can use the full range or implement a bit mask- but then you are limited to those values.

Each pixel on the screen is aware of what stencil value it is and is also aware of depth (so you can get the stencil value of the object closest to the viewport etc)

You blend your materials together in a post process volume.

But the problem with stencils is, mask will remain visible all the time even if half object is hidden behind other objects

Incorrect - you can mask the object to be aware of depth. See here Outline Material Archives - Tom Looman