Specify colour masks in Custom Stencil Pass

Good day! I may be going mental with my problem, I would be very grateful if you can help me.
I’m working on a project that needs a render pass, a post process material, that can mask the static meshes into a specific colour. Currently the UE Blueprints don’t have this kind of note or I may be mistaken? I’m not sure what other technique to use, except the custom stencil mask.
This image shows all the 255 Mask in the Custom Stencil Buffer

My team is using UE for machine learning, and we really need to define the colours with an exact RGB values.

Thank you in advance!

Hi! here’s what I used for a short film, you have 52 differents ID’s to use, you’ll need to assign an ID in that range (1-52) to the Custom Depth Stencil Value of each mesh, it’s not the prettiest thing but it works, remember when rendering this pass to disable the tone mapper otherwise your colors might not be accurate.

link text

1 Like

Also if you want to randomly auto assign Custom Depth Stencil Values to all the actors in your scene here’s a BP solution.

link text

Thank you for the comments and your help! I’ve tested the nodes you shared and it works perfectly! ^^

Glad to help!