I have three problems I need to solve. I am trying to make a opacity mask that is in the shape of a cylinder with the other end pointy and the other flat. Both of the ends are pointy right now. The cylinder should rotate to always face the camera and apply the opacity mask to faces that are facing away from the character. It should always reveal the player if he goes behind any object with the material attached to it, no matter how far away he is or how many objects is in between the player and the camera. A simple sphere doesn’t do the job since it can’t mask all the objects that are in between the player and the camera: a long cylinder would do it.
The opacity mask is in the shape of this right now, always positioned around the player, but doesn’t rotate to face the camera.
Round shape of the cylinder.
This cube face shouldn’t be masked, since it is facing the player.
This is how I create the opacity mask shape from a world position.
This is how I get the player position and translate that to either be closer or further away from the player.
BONUS: How would I make the opacity masked materials still cast a full shadow, even if parts of the textures are inside the opacity mask?