Shader to hide everything in front of an object

I’m trying to find some way (I think a shader is probably going to be what works) to make everything in front of a mesh disappear. Basically, what i want the shader to act like the mask shader on the wiki but to mask everything IN FRONT of the object rather than behind it. I have messed around with the mask shader and gotten something that kind of approaches what i want. As far as i can tell it causes everything in front of the object with the shader not to obscure other objects, but does not cause it not to be rendered; the result is that things look kind of ghostly and semi-transparent in the area in front of the object with the shader. I feel like it’s close to working but i don’t know what I need to do to make it work! Can anyone give me any tips about what to do to make this work?
Here’s what I have so far:

Shader "Masked/BackMask" {
    SubShader {
        
        Tags {"Queue" = "Geometry" }
        
        Lighting Off

        ZTest GEqual
        Blend One One
        ZWrite On

        ColorMask 0


       	Pass {
        }
    }
}

Tags { “Queue” = “Transparent +1” }

or something maybe??

http://unity3d.com/support/documentation/Components/SL-SubshaderTags.html

What you are looking for sounds like a clipping plane shader (assuming you want to hide all between you and the object distance, not just the stuff that is occluding it, in which case a shader won’t do it)

There is a thread on this board for something like this which might actually give you exactly what you are looking for

What I want is basically something that does the same thing as the camera’s near clip plane, except that i can position it however I want (eg. not perpendicular to the camera).

I searched for it but I couldn’t find it. Do you have a link?

Sure, here is the link http://forum.unity3d.com/viewtopic.php?t=12583

What you want to do actually sounds exactly like a clip plane :slight_smile: