Render Scanline

Ive been thinking about this for a while and I’ve thought of two things. Both of which are probably completely wrong but maybe someone else can think of a better idea.

  1. make a small 64x64 texture that is black at the top and clear (alpha channeled) at the bottom. Tile that over the screen.
  2. Line Render a black line multiple times across the screen.

Thoughts? I hope we can figure it out. Its been bothering me for a while.

Maybe something like this.

Shader "Cg basic shader"
{
	Properties
		{
			_LinesColor("LinesColor", Color) = (0,0,0,1)
			_LinesSize("LinesSize", Range(1,10)) = 1
		}
   SubShader {
      Pass {
		
		ZTest Always
		Tags { "Queue" = "Geometry-1" }

         CGPROGRAM
 
         #pragma vertex vert 
         #pragma fragment frag
		 #include "UnityCG.cginc"

		 fixed4 _LinesColor;
		 fixed _LinesSize;

		 struct v2f
		 {
			half4 pos:POSITION;
			half4 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
         {
			half2 p = i.sPos.xy / i.sPos.w;
			if((int)(p.y*_ScreenParams.y/(int)_LinesSize)%2==0)
				discard;

            return _LinesColor; 
         }
 
         ENDCG
      }
   }
}
`
`