Lux URP Skin Inputs Custom Toon.hlsl 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193
  1. #ifndef INPUT_LUXLWRP_BASE_INCLUDED
  2. #define INPUT_LUXLWRP_BASE_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Core.hlsl"
  4. // defines a bunch of helper functions (like lerpwhiteto)
  5. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/CommonMaterial.hlsl"
  6. // defines SurfaceData, textures and the functions Alpha, SampleAlbedoAlpha, SampleNormal, SampleEmission
  7. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/SurfaceInput.hlsl"
  8. // defines e.g. "DECLARE_LIGHTMAP_OR_SH"
  9. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  10. #include "../Includes/Lux URP Skin Lighting.hlsl"
  11. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/Color.hlsl"
  12. #include "Packages/com.unity.render-pipelines.core/ShaderLibrary/UnityInstancing.hlsl"
  13. // Material Inputs
  14. CBUFFER_START(UnityPerMaterial)
  15. half4 _BaseColor;
  16. half4 _SpecularColor;
  17. float4 _BaseMap_ST;
  18. half _Smoothness;
  19. half _BumpScale;
  20. half _Bias;
  21. half _SkinShadowBias;
  22. half _SkinShadowSamplingBias;
  23. half _OcclusionStrength;
  24. half4 _SubsurfaceColor;
  25. half _SampleCurvature;
  26. half _Curvature;
  27. float2 _DistanceFade;
  28. half _TranslucencyPower;
  29. half _TranslucencyStrength;
  30. half _ShadowStrength;
  31. half _MaskByShadowStrength;
  32. half _Distortion;
  33. half _AmbientReflectionStrength;
  34. //#if defined(_RIMLIGHTING)
  35. half4 _RimColor;
  36. half _RimPower;
  37. half _RimMinPower;
  38. half _RimFrequency;
  39. half _RimPerPositionFrequency;
  40. //#endif
  41. // Needed by URP 10.1. and depthnormal
  42. half _Cutoff;
  43. half _Surface;
  44. half _Backscatter;
  45. half _VertexNormal;
  46. // Custom Inputs
  47. // Emission
  48. float3 _EmissionColor;
  49. // Mask
  50. float4 _MakeUpMask1_RGB_ST;
  51. float4 _MakeUpMask2_RGB_ST;
  52. float4 _Mask1_Rchannel_ColorAmountA;
  53. float4 _Mask1_Gchannel_ColorAmountA;
  54. float4 _Mask1_Bchannel_ColorAmountA;
  55. float4 _Mask1_Achannel_ColorAmountA;
  56. float4 _Mask2_Rchannel_ColorAmountA;
  57. float4 _Mask2_Gchannel_ColorAmountA;
  58. float4 _Mask2_Bchannel_ColorAmountA;
  59. float4 _Mask1_Rchannel_TextureAmountA_ST;
  60. float4 _Mask1_Gchannel_TextureAmountA_ST;
  61. float4 _Mask1_Bchannel_TextureAmountA_ST;
  62. float4 _Mask1_Achannel_TextureAmountA_ST;
  63. float4 _Mask2_Rchannel_TextureAmountA_ST;
  64. float4 _Mask2_Gchannel_TextureAmountA_ST;
  65. float4 _Mask2_Bchannel_TextureAmountA_ST;
  66. //catoon
  67. float _ToonThesHold;
  68. float _ToonHardness;
  69. float4 _SpecColor;
  70. float _SpecSize;
  71. float4 _RimLightDir;
  72. float4 _RimLightColor;
  73. CBUFFER_END
  74. // Additional textures
  75. TEXTURE2D(_SSSAOMap); SAMPLER(sampler_SSSAOMap);
  76. // Custom Textures
  77. // Emission (defined in SurfaceInput.hlsl)
  78. // TEXTURE2D(_EmissionMap);
  79. // SAMPLER(sampler_EmissionMap);
  80. // cloth mask
  81. // TEXTURE2D(_ClothMask1);
  82. // SAMPLER(sampler_ClothMask1);
  83. // TEXTURE2D(_ClothMask2);
  84. // SAMPLER(sampler_ClothMask2);
  85. // TEXTURE2D(_ClothMask3);
  86. // SAMPLER(sampler_ClothMask3);
  87. Texture2D _ClothMask1;
  88. Texture2D _ClothMask2;
  89. Texture2D _ClothMask3;
  90. // 定义采样器
  91. SamplerState sampler_ClothMask1; // "sampler" + “_MainTex”
  92. SamplerState sampler_ClothMask2;
  93. SamplerState sampler_ClothMask3;
  94. TEXTURE2D(_MakeUpMask1_RGB);
  95. SAMPLER(sampler_MakeUpMask1_RGB);
  96. TEXTURE2D(_MakeUpMask2_RGB);
  97. SAMPLER(sampler_MakeUpMask2_RGB);
  98. TEXTURE2D(_Mask1_Rchannel_TextureAmountA);
  99. SAMPLER(sampler_Mask1_Rchannel_TextureAmountA);
  100. TEXTURE2D(_Mask1_Gchannel_TextureAmountA);
  101. SAMPLER(sampler_Mask1_Gchannel_TextureAmountA);
  102. TEXTURE2D(_Mask1_Bchannel_TextureAmountA);
  103. SAMPLER(sampler_Mask1_Bchannel_TextureAmountA);
  104. TEXTURE2D(_Mask1_Achannel_TextureAmountA);
  105. SAMPLER(sampler_Mask1_Achannel_TextureAmountA);
  106. TEXTURE2D(_Mask2_Rchannel_TextureAmountA);
  107. SAMPLER(sampler_Mask2_Rchannel_TextureAmountA);
  108. TEXTURE2D(_Mask2_Gchannel_TextureAmountA);
  109. SAMPLER(sampler_Mask2_Gchannel_TextureAmountA);
  110. TEXTURE2D(_Mask2_Bchannel_TextureAmountA);
  111. SAMPLER(sampler_Mask2_Bchannel_TextureAmountA);
  112. // Global Inputs
  113. // Structs
  114. struct VertexInput
  115. {
  116. float3 positionOS : POSITION;
  117. float3 normalOS : NORMAL;
  118. float4 tangentOS : TANGENT;
  119. float2 texcoord : TEXCOORD0;
  120. float2 lightmapUV : TEXCOORD1;
  121. half4 color : COLOR;
  122. UNITY_VERTEX_INPUT_INSTANCE_ID
  123. };
  124. struct VertexOutput
  125. {
  126. float4 positionCS : SV_POSITION;
  127. float2 uv : TEXCOORD0;
  128. half fade : TEXCOORD9;
  129. #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(DEPTHONLYPASS)
  130. DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
  131. #if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
  132. float3 positionWS : TEXCOORD2;
  133. #endif
  134. float3 normalWS : TEXCOORD3;
  135. float3 viewDirWS : TEXCOORD4;
  136. #ifdef _NORMALMAP
  137. float4 tangentWS : TEXCOORD5;
  138. #endif
  139. half4 fogFactorAndVertexLight : TEXCOORD6;
  140. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  141. float4 shadowCoord : TEXCOORD7;
  142. #endif
  143. #endif
  144. UNITY_VERTEX_INPUT_INSTANCE_ID
  145. UNITY_VERTEX_OUTPUT_STEREO
  146. };
  147. struct SurfaceDescription
  148. {
  149. half3 albedo;
  150. half alpha;
  151. half3 normalTS;
  152. half3 diffuseNormalTS;
  153. half3 emission;
  154. half metallic;
  155. half3 specular;
  156. half smoothness;
  157. half occlusion;
  158. half translucency;
  159. half skinMask;
  160. half curvature;
  161. };
  162. #endif