Unity Shader, masking a specific layer?

Hi all,

I have some experience and am comfortable with Unity’s JavaScript and Unity environment, however I am a complete novice when it comes to shader programming, so I need some pointers or help, here’s the situation:

I have found this great simple shader that masks out everything from pixelplacement.com. However, I would need to expand it so that I have control over which layer I want to mask out. Here is the code:

Shader "Depth Mask" {
    SubShader {
        Tags {"Queue" = "Geometry-10" }       
        Lighting Off
        ZTest LEqual
        ZWrite On
        ColorMask 0
        Pass {}
    }
}

Is there a way to do this? Can anyone help me out with this, please? Many thanks in advance! :slight_smile:

Voja

Layers do not exist in shaders. It’s a Unity runtime feature. The best way is to use multiple cameras for the different layers. That way you can render the layers seperately.

Take a look at the cullingMask and of course depth.