Hide Actor In Post Process?

Nevermind I found a solution!

I took the section I used to draw the shadow mask and made that into a material function so I could use it as an opacity mask for the actors I wanted to hide.

Hi, so I’m working on a line of sight system, I create a fake shadow mask in post process using a custom mask created by line traces fired off from the character.

Using the mask itself will render the shadows 100% black including the actor I want to hide but since I don’t want the shadows to be that dark I lerped the mask with the scene texture and a color vector so I could control how dark the shadows are.

My problem is when doing this, since the shadows are revealing the scene its also revealing the actor I want to hide

I know how to mask out the actor using custom stencils but I’m not sure how to make it so they’re invisible in the shadow portion. Currently I have 3 parts masked out; the level itself, the shadow mask, and the actors

Heres what I would like to acheive.

I’d like the red portion (the part of the mesh hidden in shadow) to be invisible so the background is rendered in its place like in this picture

Any help would be appreciated thank you!