SeeObjectsBehindOthers

From Unify Community Wiki
Revision as of 17:52, 15 August 2011 by HandsomePATT (Talk | contribs)

Jump to: navigation, search

A shader to see object even if they are behind others. I used for making popups when hitting certain objects, so when they instantiated at that position, if there were a little inside the object it wouldnt get cut off. Could be used for a HUD using raycasting instead of the Unity GUI, or seeing a player through a wall.



SeeThrough.png




<shaderlab>Shader "Pat/VisibleBehindObjects" { Properties { _MainTex ("Base (RGB) TransGloss (A)", 2D) = "white" {} }

SubShader {

CGPROGRAM

  1. pragma surface surf BlinnPhong alpha

sampler2D _MainTex;

struct Input { float2 uv_MainTex; };

void surf (Input IN, inout SurfaceOutput o) { fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); } ENDCG }

Category {

   SubShader 
   {
   Tags
   {
   "Queue"="Overlay"
   "IgnoreProjector"="True"
   "RenderType"="Transparent"
   }
      	Pass
       {
           ZTest Greater
           
           AlphaTest Greater 0.5

SetTexture [_MainTex] { combine texture }

       }
       Pass 
       {
           ZTest Less
           
           AlphaTest Greater 0.5

SetTexture [_MainTex] { combine texture }

       }
   }

}

Fallback "Transparent/VertexLit" }</shaderlab>

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox