Shader "URP/Effects/Transparent-Simple-ZOff" {
	Properties {
		_BaseMap ("Base (RGB)", 2D) = "white" {}
		[Enum(Off,0,On,1)]_ZWrite("ZWrite", Float) = 0
		_Cutoff ("Alpha cutoff", Range(0,1)) = 0.5
		[Toggle]_Light_On("Light On",Float) = 1
		[Toggle(_Fog)]_Fog("Fog",Float) = 1
	}

	SubShader {
		Tags { "RenderType"="Transparent" "Queue"="Transparent" "RenderPipeline" = "UniversalPipeline"}
		LOD 200

		HLSLINCLUDE
		#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
		#include "../Common/Function/BlackHole.hlsl"
		ENDHLSL
		Pass{
			Tags{"LightMode" = "UniversalForward"}
			Blend SrcAlpha OneMinusSrcAlpha
			ZWrite[_ZWrite]
			Cull Back
			HLSLPROGRAM
			#pragma vertex vert
			#pragma fragment frag
			#pragma shader_feature _Fog
			#pragma multi_compile_fog

			struct unlit_v2f 
			{
				float4 pos : SV_POSITION;
				float2 texcoord : TEXCOORD0;
				float fogCoord : TEXCOORD1;
				float3 positionWS :TEXCOORD2;
				//float color : COLOR;
			};
			half _Light_On;
			
			struct appdata
			{
				float4 vertex : POSITION;
				float2 uv : TEXCOORD0;
				
				//float4 color : COLOR;
			};

			unlit_v2f vert(appdata v)
			{
				unlit_v2f o;

				VertexPositionInputs vertexInput = GetVertexPositionInputs(v.vertex.xyz);
				o.pos = vertexInput.positionCS;
				o.fogCoord = vertexInput.positionCS.z;
				o.texcoord = TRANSFORM_TEX(v.uv, _BaseMap);
				o.positionWS = vertexInput.positionWS;
				//o.color = v.color;
				return o;
			}

			half4 frag(unlit_v2f i) : SV_Target
			{
				half4 col = SampleAlbedoAlpha(i.texcoord, TEXTURE2D_ARGS(_BaseMap, sampler_BaseMap));
				//col.rgb *= lerp(1,_MainLightColor.w,_Light_On);
				#ifdef _Fog
				half density = ComputeFogFactor(i.fogCoord);
				col.rgb = MixFog(col.rgb, density);
				#endif
				col.rgb *= BalckHole_GetLightIntensity(i.positionWS.xyz);
				//col.a = _SceneBloomFactor;
				return col;
			}
		ENDHLSL
		}
		Pass
            {
                Name "a"
                Tags{ "LightMode" = "SRPDefaultUnlit" }
                //Cull Off
                Lighting Off
                ZWrite Off
                Blend SrcAlpha  OneMinusSrcAlpha
                ColorMask A
                CGPROGRAM
                #pragma vertex vert
                #pragma fragment frag
                #pragma multi_compile_fog
				#include "UnityCG.cginc"
				uniform half _SceneBloomFactor;
            struct appdata
            {
                float4 vertex : POSITION;
                float2 uv : TEXCOORD0;
            };

            struct v2f
            {
                float2 uv : TEXCOORD0;
                float4 vertex : SV_POSITION;
            };

            sampler2D _MainTex;
            v2f vert(appdata v)
            {
                v2f o;
                o.vertex = UnityObjectToClipPos(v.vertex);
                o.uv = v.uv;
                return o;
            }

            fixed4 frag(v2f i) : SV_Target
            { 
            fixed4 col = tex2D(_MainTex, i.uv);
			col.a = _SceneBloomFactor;
            return col;
        }
		ENDCG
		}
	}
}
