I am using UE4 for an animation project and I’m trying to render out a custom pass which only masks out a selected character. I tried the Custom Depth method, but it doesnt occlude the objects in front of the character. How do I go about getting an alpha mask just for one character?
I also tried the Opacity render pass. It almost works the way I want to, though I have no idea how it decides what to render and what not to. As you can see, it doesnt include the character’s hiar, eyes and shoe materials. But i do like how it occludes the foreground objects unlike the Custom Depth
Custom depth was the right thing to use in this instance you just need a little bit of extra work to get the effect you want. Here is an example of a material graph that will mask out things assigned a custom stencil value of one and still gets occluded by the environment (assuming you only need a stencil value of 1 for the alpha).
Please make a new post in the rendering section regarding to your question. We like to keep separate threads for each question so that those searching through answer hub can find what they are looking for easier.