//角色卡通渲染 高级（半透明）
Shader "URP/Character/ToonAdvancedFoliage" 
{
	Properties
	{
		_Color("Main Color", Color) = (1,1,1,1)
		//_LightInfo("LightInfo", vector) = (0, 1, 0, 0)
		_MainTex("Texture", 2D) = "white" {}
		[HideInInspector][Toggle(_Change)]_Change("Change", Float) = 0
		[HideInInspector]_ChangeTex("Change Texture", 2D) = "white" {}
		[HideInInspector]_ChangeRamp("ChangeRamp", 2D) = "white"{}
		[HideInInspector]_EdgeColor("Edge Color", Color) = (1,1,1,1)
		[HideInInspector]_Noise("Noise", 2D) = "black" {}
		[HideInInspector]_NoiseT("Noise Tiling", Vector) = (1, 1, 0, 0)
		[HideInInspector]_ChangeRange("Change Range",Range(-1, 10)) = -1
		[HideInInspector]_EdgeWidth("EdgeWidth",Range(0, 1.2)) = 1.05
		[HideInInspector]_StartPoint("Start Point",float) = 0
		[HideInInspector][Toggle(_NORMALMAP)]_NORMALMAP("NORMALMAP",Float) = 0
		_BumpMap("Normalmap", 2D) = "white" {}
		[Toggle(_)]_Alpha_Change("Alpha Change",Float) = 0
        [HideInInspector] _Surface("__surface", Float) = 0.0
        [HideInInspector] _AlphaClip("__clip", Float) = 0.0
        [HideInInspector] _SrcBlend("__src", Float) = 1.0
        [HideInInspector] _DstBlend("__dst", Float) = 0.0
        [HideInInspector] _ZWrite("__zw", Float) = 1.0
        [HideInInspector] _Cull("__cull", Float) = 2.0
		_Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
		_MainAlpha("MainAlpha", Range(0.0, 1.0)) = 1
		_env_shadow_color("Env Shadow Color", Color) = (0.5, 0.5, 0.5, 1)
		_shadowFalloff("shadow Falloff", Range(0,1)) = 1
		[Toggle(Receive_Shadows)]_Receive_Shadows("Receive Shadows", Float) = 0
		[ToggleOff]_Illumin_On ("Illumin On", Float ) = 0
		_TimeScale ("Time Scale", Float ) = 1
		_IlluminStrength("Illumin Strength" , Range(0,30)) = 0
		[HDR]_IlluminColor("Illumin Color", Color) = (1,1,1,1)

		//[Toggle(USE_MAIN_LIGHT_DIR)]_UseMainLightDir("Use Main Light Dir",Float) = 0
		_MaskTex("Mask", 2D) = "white" {}
		[HideInInspector]_LightMask_Off ("LightMask Off", Float ) = 0
		[Toggle]_Billboard ("Billboard", Float ) = 0
		[ToggleOff]_FACEDIR ("FACEDIR", Float ) = 0
		_LightMaskTex("LightMask", 2D) = "black" {}
		_LightMaskParam("_LightMaskParam", Range(-1.0,1.0)) = 0.7
		_LightMaskBackParam("_LightMaskBackParam", Range(0.0,1.0)) = 0.7
		_Gamma("Gamma Lut", Range(1.0,3.0)) = 1.0
		[Toggle(_USE_Ramp_Num4)]_Ramp_Num4("Ramp_Num4",Float) = 1
		[Toggle]_USE_GrayMask("Use GrayMask", Float) = 0
		_RampNum("RampNum", Range(0,20)) = 10
		//[Enum(Ramp4,4,Ramp5,5,Ramp10,10)]_RampNum("RampNum", Float) = 10
		_RampTex("Ramp", 2D) = "white"{}
		_RampColor("Ramp Color", Color) = (1,1,1,1)

		_HighLight("HighLight",range(0,1)) = 0.9		// 高光范围
		_HighLightColor("HighLight Color", Color) = (1,1,1,1)
		_HighLightStrength("HighLightStrength", range(0,1000)) = 5

		[HDR]_SpecColor("Specular Color", Color) = (0.5, 0.5, 0.5, 1)
		//[HDR]_HLColor("HLColor", Color) = (0.5, 0.5, 0.5, 1)
		_Shininess("Shininess", Range(0.01,4)) = 0.1
		//_HLShininess("HLShininess", Range(0.01,2)) = 0.1
		_SpecSmooth("Smoothness", Range(0,1)) = 0.05
		_SpecStrength("SpecStrength", Range(0,5)) = 1
		//_Specrange("Spec Gradient", Range(0.01,2)) = 0.1


		[Toggle(_)]_BrightnessFactor("MinBrightness", range(0, 1)) = 0

		_LightInfo("LightInfo", Vector) = (0.9, -1, 0.5, 0.005)
		_LightColor("LightColor",color) = (1,1,1,1)

		_BrightnessRatio("Brightness Ratio", range(0,10)) = 0
		_BrightnessIncrease("Brightness Increase", range(0,10)) = 4

		// _FlashTex("FlashTex", 2D) = "black" {}
		// _FlashFactor("FlashFactor", Vector) = (0, -2, 1, 1)
		// _FlashMixedColor("FlashMixedColor",Color) = (0.4,0.2,0,1)
		// _FlashStrength("FlashStrength", Range(0, 5)) = 1
		// _FlashMixedColorAdd("FlashMixedColorAdd",Color) = (0.4,0.2,0,1)
		// _FlashStrengthAdd("FlashStrengthAdd", Range(0, 5)) = 1
		// _FlashSpeed("FlashSpeed", Range(0, 5)) = 0.2

		// _ShadowTex("Shadow (RGB) Trans (A)", 2D) = "white" {}
		//_DirX("DirX", Range(0,5)) = 0.5
		//_DirY("DirY", Range(0,5)) = 0.5
		// _Speed("Speed", Range(-1,1)) = 0.1
		// _ShadowAlphaRatio("ShadowAlphaRatio", Range(0.5,1.5)) = 1

		_LightInfoShadow("LightInfoShadow", Vector) = (0.9, -1, 0.5, 0.05)
		_TerrainHeight("TerrainHeight", range(0,1)) = 0
		//_Transparency("Transparency", range(0,1)) = 1
		_ShadowColor("Shadow Color", color) = (0.05,0.05,0.05,0.7)

		[Toggle(_Tangent)]_Tangent("Tangent",Float) = 0
		_OutlineColor("Outline Color", Color) = (0.3,0.3,0.3,1)
		_Outline("Outline Width", range(0,10)) = 0.24
		_OutlineStrength("OutLine Strength", range(0,5)) = 0.6
		[HideInInspector]_Offset_Z ("Offset Z", float) = 0
		[Toggle]_NewRamp("NewRamp", Range(0,1)) = 0

		[Toggle(_IsColoration)]_IsColoration("Is Coloration", Float) = 0
		//[Header(White Channel)]
		_HueShift("HueShiftW", Float ) = 0
		_Sat("SaturationW", range(0,100)) = 1
		_Val("BrightnessW", range(-0.5,2)) = 0.5
		_Coloration("ColorationW Color", Color) = (1,1,1,1)
		[Toggle(_WhiteChannel)]_WhiteChannel("White Channel", Float) = 0
		//[Header(Gray Channel)]
		_HueShiftG("HueShiftG", Float ) = 0
		_SatG("SaturationG", range(0,100)) = 1
		_ValG("BrightnessG", range(-0.5,2)) = 0.5
		_ColorationG("ColorationG Color", Color) = (1,1,1,1)

		[HideInInspector][HDR]_RimColor("Rim Color", color) = (0,0,0,1)
		[HideInInspector]_RimWidth("D:\DBT\YYZYOnline\Assets\URP\Shader\HLSL\FX\Particle Alpha Blend Dis.shaderRim Width", Range(0,1)) = 0
		[HDR]_BackRimColor("Back Rim Color", color) = (0,0,0,1)
		_BackRimMax("Back Rim Max", Range(0,1)) = 1
		_BackRimMin ("Back Rim Min", Range(0,1)) = 1
		[HideInInspector][Toggle(FLASH_SWITCH)]_FLASH_SWITCH("FLASH SWITCH", Float) = 0
		[HideInInspector]_FlashTex("FlashTex", 2D) = "white" {}
		[HideInInspector]_FlashFactor("FlashFactor", Vector) = (0, -2, 1, 1)
		[HideInInspector]_FlashStrength("FlashStrength", Range(0, 5)) = 1
		_DissolveTex("DissolveTex", 2D) = "white" {}
		_DissolveFactor("DissolveFactor",Range(0, 1)) = 0
		_BloomFactor("Bloom Factor", Range(0, 1)) = 0
		_QueueOffset("Queue offset", Float) = 0.0
		//_RefDepth("RefDepth", Vector) = (1,1,0,0)
			
	}
	SubShader
	{
		Tags
		{
			"IgnoreProjector" = "true"
			"RenderType"="Opaque"
			"Queue"="Geometry"
		}

		UsePass "HiddenURP/Character/Basic/CHAR_BASIC_Foliage"
		UsePass "HiddenURP/Character/Basic/a"
		UsePass "HiddenURP/Character/Outline/CHAR_OUTLINE" 

		 Pass
		{
			Name "DepthOnly"
			Tags{"LightMode" = "DepthOnly"}

			ZWrite On
			ColorMask 0
			Cull[_Cull]

			HLSLPROGRAM
		// Required to compile gles 2.0 with standard srp library
		#pragma prefer_hlslcc gles
		#pragma exclude_renderers d3d11_9x
		#pragma target 2.0

		#pragma vertex DepthOnlyVertex
		#pragma fragment DepthOnlyFragment

		// -------------------------------------
		// Material Keywords
		#pragma shader_feature _ALPHATEST_ON
		#pragma shader_feature _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A

		//--------------------------------------
		// GPU Instancing
		#pragma multi_compile_instancing

		#include "Packages/com.unity.render-pipelines.universal/Shaders/LitInput.hlsl"
		#include "Packages/com.unity.render-pipelines.universal/Shaders/DepthOnlyPass.hlsl"
		ENDHLSL
	
	
	}
	UsePass "URP/Character/ToonAdvanced/ShadowCaster"
		

		//UsePass "Universal Render Pipeline/Lit/DepthOnly"
		//UsePass "Universal Render Pipeline/Lit/ShadowCaster"

		//UsePass "URP/Toon/Char/Shadow/CHAR_SHADOW"		
	}
	CustomEditor "Valkyrie.AdvancedShaderGUI"
	//FallBack "VertexLit" 
}