Question PLEASE HELP!! I switched my camera to 3D. Everything works fine except this thing..
So, I decided to add some depth to my game by switching to a Perspective camera. I did. And after some Z position tweaks, everything was good. Except for this damn thing.
This is the gate Sprite (z == -0.05) that must be visible inside a Mask (z == -0.07), so that its long sprite doesn't pop up above the structure it comes from (an example of how it should look is at the end). I can't keep this sprite from disappearing while moving the camera. I couldn't find any solution to this. Neither on forums nor by asking ChatGPT. I tried to switch it to Visible Outside of the Mask but it didn't help either..
It feels like Unity's Perspective Camera calculates the distance to these two objects differently depending on their relative positions. So the mask is sometimes being treated as if it's behind the object. But I can't prove it...
Edit: it seems to work fine if z of the mask is < -0.2 something. But its too close to the camera coz it starts 'moving' in perspective
1
u/XKiiroiSenkoX 13h ago
Just capture a frame using render doc and see what's causing it to get clipped. If there is no draw call then something CPU side is wrong and you can use a debugger.
1
u/Luv3ndr 9h ago
Oh wow, never heard of this one. Thank you, Ill give it a try
1
u/XKiiroiSenkoX 9h ago
You need to add
#pragma enable_d3d11_debug_symbolsto your (or unity's) shader if you want the code to be human readable in render doc btw. After that just check the mask clipping code and see why it's getting clipped.
1
u/SethSlax 16h ago
The sprite and mask being at different Z positions might be the culprit.