- Home /
Post-process masking?
Hi everyone,
I have a problem. I am using an edge-detection post-processing effect. I want normal objects to have a light grey outline and special objects to have a gold outline. Problem is: The effect of the latter seems to be rendered above everything else. Normal objects make up walls and what not so edges are rendered properly, however as the special objects are sparse and rarely block each other in the camera, they can be seen through walls.
I am using 2 cameras with 2 separate layers, with each camera only rendering one layer as seen below:
https://i.imgur.com/5rIlbbr.png
I have tried messing with the depth options, which works for the object but not the actual outline, as it is a post-process effect.
I was wondering if it was possible to "mask" the second camera so it only renders pixels which should be visible (as I tried to demonstrate), using other objects as the mask without them actually being rendered by the camera? I think the solution lies within render textures and having to generate an actual black and white mask on the fly but I have no idea where to start with that. Maybe there is a much easier approach?