Shader "Custom/BlameWall" {
	Properties {
		_MainTex ("Base (RGB)", 2D) = "white" {}
		_Hole("wall hole size", float) = .2
	}
	SubShader {
		Blend SrcAlpha OneMinusSrcAlpha
		Tags { "Queue" = "Transparent" }
		LOD 200
		
		CGPROGRAM
		#pragma surface surf Lambert

		sampler2D _MainTex;
		float4 _Player;
		float _Hole;

		struct Input {
			float2 uv_MainTex;
			float4 screenPos;
		};

		void surf (Input IN, inout SurfaceOutput o) {
			half4 c = tex2D (_MainTex, IN.uv_MainTex);
			o.Albedo = c.rgb;
			
			if(_Player.z> IN.screenPos.z){
				float2 screen = IN.screenPos.xy/IN.screenPos.w*_ScreenParams.xy-_ScreenParams.xy*0.5;
				o.Alpha =  floor(length(screen.xy)/_Hole);
			}else{
				o.Alpha=  1;
			}
			
		}
		ENDCG
	} 
	FallBack "Diffuse"
}
