Properly hide parts of objects between camera and character

Hello, I’m trying to experiment with a masked material that becomes transparent when it is between my third-person camera and my player.

I have some setup so far and it almost works except for different results in different dimensions probably due to not accounting for camera direction.

Here is my material function which yields Alpha mask. I use this function for materials that I want to be occluded:

Here is what the result look like:

Note that how the cutout radius is different for front wall and for the ceiling.

Here is what I ideally want to have: constant radius around my character no matter what wall it is but still non-hidden back walls and floor:

Any help or hints is greatly appreciated!

1 Like

Can you explain how you’re doing this? I want to do this with a bunch of existing materials.