SphereMask at wrong view space

Hello everyone,

I hope you can help me. I’m working on an occlusion mask. I have a masked material and want to cut out a sphere around the player, fairly simple. I write the player location in a MaterialParameterCollection and I use that in my material.

The issue: The mask is offset, when I view it at an angle. If the player is in the center of the screen it’s fine, but the further the player is at the edge of the screen the more the cut out is offset to the player position.

I don’t get why the center of the SphereMask is there. I feel stupid.

I still don’t know what exactly caused the issue, but I found a solution. I guess the issue has to do with FOV warping the image (specially at the edges), thus leading to the wrong position of the sphere, but I’m not sure.

The solution was instead of using a transform (world to view space), I use a substraction and normalize that to get the correct location. (Set the Radius = 400 and Hardness = 100!)

If you want a little bit more then just having the sphere at the right position, here is my solution for occlusion masking so far:

  • Cuts out the sphere + noise between the area
  • Keeps a lower half of the object + noise
  • Doesn’t cut when object is infront of the player + noise

Here is my final result so far: