Hi there, I'd like to start off by saying that my shader coding knowledge is pretty limited. I know the basics and I can eventually understand how a shader works, but that's about it. I've made a simpler scene and updated my original question to better explain the problem that I'm having. Please take a look at the following image: I have 4 objects in the scene above. The ground (beige), one red cube on the left side that's above the ground, one red cube on the right side that's half above and half under the ground and a blue wall in front of the 2 cubes. The red cubes render only if they're behind the wall so if I was to delete the wall they would become invisible. What I would like to achieve is to have the red cubes be visible when behind the wall, but not the area that's under ground. So the right cube should only be rendering the top red part and not the bottom beige part as well. Here are the 3 shaders that I'm using: Cubes: https://pastebin.com/msuyi1zj Ground: https://pastebin.com/ttL45Gjm Wall: https://pastebin.com/QcL0uY8j To gives you a scenario where I would be using something like this, imagine an RTS game where you want units behind walls or other objects to be visible so the cube shader would be like an outline or silhouette shader. Now imagine that you also want these units to hide by going underground. Currently, if they were to go underground but were also behind a wall, they would be visible. Thank you very much in advance!