I got this Scanlines shader off this forum. Where it says Depth it used to say Overlay. Now I have no idea what I'm doing but the Shader was overlaying over everything in the scene so i typed depth to see if it would do anything. To my amazement it did. But now I have this error: Undefined Queue: 'Depth' UnityEditor.DockArea:OnGUI() Do I need to worry about it? How Do I make it go away. Code (csharp): { Properties { _LinesColor("LinesColor", Color) = (0,0,0,1) _LinesSize("LinesSize", Range(1,10)) = 1 } SubShader { Tags {"IgnoreProjector" = "True" "Queue" = "Depth"} Fog { Mode Off } Pass { ZTest Always ZWrite On Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" fixed4 _LinesColor; half _LinesSize; struct v2f { half4 pos:POSITION; fixed4 sPos:TEXCOORD; }; v2f vert(appdata_base v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.sPos = ComputeScreenPos(o.pos); return o; } fixed4 frag(v2f i) : COLOR { fixed p = i.sPos.y / i.sPos.w; if((int)(p*_ScreenParams.y/floor(_LinesSize))%2==0) discard; return _LinesColor; } ENDCG } } }
There is no queue called Depth. This is the documentation on the Queue tags. http://docs.unity3d.com/Documentation/Components/SL-SubshaderTags.html
Code (csharp): hader "Scanlines" { Properties { _LinesColor("LinesColor", Color) = (0,0,0,1) _LinesSize("LinesSize", Range(1,10)) = 1 } SubShader { Tags {"IgnoreProjector" = "True" "Queue" = "Geometry"} Fog { Mode Off } Pass { ZTest Always ZWrite On Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" fixed4 _LinesColor; half _LinesSize; struct v2f { half4 pos:POSITION; fixed4 sPos:TEXCOORD; }; v2f vert(appdata_base v) { v2f o; o.pos = mul(UNITY_MATRIX_MVP, v.vertex); o.sPos = ComputeScreenPos(o.pos); return o; } fixed4 frag(v2f i) : COLOR { fixed p = i.sPos.y / i.sPos.w; if((int)(p*_ScreenParams.y/floor(_LinesSize))%2==0) discard; return _LinesColor; } ENDCG } } } Ok, I have another issue with this shader. In Unitys Game view port the shader works fine. But when I build the game it seems to go back to Overlay mode. What's wrong?
I don't know what the shader should behave like, anyway change the line ZTest Always to ZTest LEqual As it is it renders on top of everything present in the framebuffer at the time of rendering, resulting in popping randomly over other objects.