Shader "URP/SceneBase/JR_Scene_Pbr"
{
	Properties
	{
		[MainColor] _BaseColor("Color", Color) = (1,1,1,1)
		[MainTexture] _BaseMap("Albedo", 2D) = "white" {}
	}
		SubShader
	{
		Name "ForwardLit"
		Tags{"LightMode" = "UniversalForward"}

		ZWrite On
		ZTest LEqual
		Cull[_Cull]
		LOD 100


		Pass
		{
			HLSLPROGRAM

			#define _MAIN_LIGHT_SHADOWS

			#pragma vertex LitPassVertex
			#pragma fragment LitPassFragment


			//#include "Assets/URP/Shader/HLSL/Environment/Sky&Fog/VolumetricFogForObject.hlsl"

						#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
						#include "Packages/com.unity.render-pipelines.universal/Shaders/LitForwardPass.hlsl"

			struct Attributes1
			{
				float4 positionOS   : POSITION;
				float3 normalOS     : NORMAL;
				half4 color         : COLOR;
				float2 texcoord     : TEXCOORD0;
			};

			struct Varyings1
			{
				float2 uv                       : TEXCOORD0;

				float4 positionCS               : SV_POSITION;
			};

			///////////////////////////////////////////////////////////////////////////////
			//                  Vertex and Fragment functions                            //
			///////////////////////////////////////////////////////////////////////////////

			// Used in Standard (Physically Based) shader
			Varyings1 LitPassVertex(Attributes1 input)
			{
				Varyings1 output = (Varyings1)0;

				VertexPositionInputs vertexInput = GetVertexPositionInputs(input.positionOS.xyz);
				output.uv = TRANSFORM_TEX(input.texcoord, _BaseMap);

				output.positionCS = vertexInput.positionCS;

				return output;
			}

			SamplerComparisonState ShadowSampler2
			{
				// sampler state
					//Filter = COMPARISON_MIN_MAG_LINEAR_MIP_POINT;
				Filter = MIN_MAG_MIP_LINEAR;
					AddressU = MIRROR;
					AddressV = MIRROR;

					// sampler comparison state
						ComparisonFunc = LESS;
					};

					SamplerState MeshTextureSampler2
					{
						Filter = MIN_MAG_MIP_LINEAR;
						AddressU = Wrap;
						AddressV = Wrap;
					};

					// Used in Standard (Physically Based) shader
					half4 LitPassFragment(Varyings1 input) : SV_Target
					{
							half4 color = half4(0, 0, 0, 1);
							//color.r = _BaseMap.SampleCmp(ShadowSampler2, float2(0, 0), 1);
							color.r = SAMPLE_TEXTURE2D_SHADOW(_BaseMap, ShadowSampler2, float3(0, 0, 1));
							//color = SAMPLE_TEXTURE2D(_BaseMap, MeshTextureSampler2, input.uv);

						return color;
					}




							ENDHLSL
						}
	}
		FallBack "Hidden/Universal Render Pipeline/FallbackError"
						CustomEditor "PBRShaderGUI"
}
