I am new to shaders and to shader code, I would like to make a shader that makes an object invisible and also what is behind it like walls (objects with a specific Layer), i was able to achieve a good resoult with just render features but then when i went outside of the room I noticed that even when the walls were in front of the cude they became transparent, if someone have experience in shaders and know how to help me I would be greatfull.
the first image show what I want to achieve, the cube makes the walls trasparent but the ball under remain visible, the second image show how the cube makes the walls and the Player trasparent even tho they are in front of the cube itself, also it shows what I tried to do with the render features:
The cube is in the layer Mask and the walls are in the layer SeeThrough
sharing code would be really helpfull, thanks.
P.S.
it didn’y let me post multiple pictures so I had to put them like this.
In that case prefer to use Shader Graph.
Is it possible in Shader graph? and if it is can you show me?
Did you actually write shader code or are you just using the transparency feature in the materials inspector? You should be able to do this without writing any shader code or building any shader graph. That is why the options are there. But IIRC you need the correct material types, and I don’t recall what I used, it’s been a couple years.
edit: forget what i said, I see what you are trying to do? You want to make a visual hole in the wall in the shape of the square, yes???
yes I want to make a hole in the wall in the shape of the object, but using the given features the hole is both in the walls behind the object and in the walls in front of the object, I thought that with shader code is possible to prevent it from making the walls in front invisible but I have no knoledge of shader code and it look really complex, also it seems like a very simple task that learning all of that dosn’t seem worth it.
but if you know some good tutorials i am willing to learn.