Shader that always renders in front but behind some objects

Hello! :smiley:

Hope this question makes sense but is there a way to have a shader that always renders in front of another shader but always stays behind another shader? May sound strange but basically I need a shader that renders in between two other shaders.

I’ve attached a screen shot that may help. I want that green line material to always stay behind walls but always render in front of that button object.

Thanks for any help! :slight_smile:

I’m note sure I quite understand what’s going on the picture, but you can explicitly set the order in which shaders are rendered by assigning them to different render queues - http://docs.unity3d.com/Documentation/Components/SL-SubshaderTags.html

In addition to the built in “Geometry”, “Transparent” etc., you can manually specify that a given shader should be rendered at Tags { “Queue” = “Geometry+10” }, which will be after all other normal objects, but before any transparent objects, for example. And you could have another shader with Tags { “Queue” = “Geometry+20” }, which will be rendered after the first. And a shader with Tags { “Queue” = “Geometry+15” } will be rendered between them.

Does that help?!

You can try to set texture shader: GUI → Text Shader