- Home /
How can I use depth-mask shader
Hello,
I am trying to use plane for hiding objects behind it. I used shader from wiki.
http://wiki.unity3d.com/index.php?title=DepthMask
I followed instructions, added script to object that I want to hide. And added shader to mask object. While it hides object that I want, it also creates a odd effect on plane. I just want to see skybox on the plane.
Note that I don't know anything about shaders and computer graphics.
Thank you :)
Did you apply the proper RenderQueue values for your shader(s) like the post you linked to described?
Answer by cainehoratio · Aug 29, 2018 at 02:33 PM
I have some problems with the SetRenderQueue script.
It says the "renderer.materials" part not correct.,I have a problem with the SetRenderQueue script.
renderer.materials part not correct.
isn't my intention to make nechro-bumping, just give a comment if someone in the future get the same problem, the script of the wiki was developed to unity 3.4.1 in order to solve this problem, in unity 5 change on line 19:
$$anonymous$$aterial[] materials = renderer.materials;
to
$$anonymous$$aterial[] materials = (($$anonymous$$eshRenderer)transform.GetComponent<$$anonymous$$eshRenderer>()).materials;
this will get all the materials to the object you want to hide, assu$$anonymous$$g u have a mesh renderer atached to this object, and this have at least one material...
Answer by umurcg · Feb 01, 2017 at 06:50 PM
Okay, I found the solution. Actually I was doing everything right except my values was 3000 and 3020 for queue. But I saw in another question, it should be 2999 on mask and 3000 on objects that I want to hide.
I don't know the reason but it works with those values.
Your answer

Follow this Question
Related Questions
Shader For cut hole and alpha blend 1 Answer
Depth mask shader and Unity shadows 0 Answers
Punching holes through a texture and making them regenerate back again in an efficient way 0 Answers
shader material showing over every object. 0 Answers
Shader Semi-Transparent to self, but masks what's behind it 1 Answer