Lux URP Clear Coat Inputs.hlsl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  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 Clear Coat 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. half _ClearCoatSmoothness;
  16. half _ClearCoatThickness;
  17. half4 _ClearCoatSpecular;
  18. half4 _BaseColor; // URP 10.1: half4 instead of half3
  19. half4 _SecondaryColor;
  20. half _Smoothness;
  21. half _Metallic;
  22. // Needed by LitMetaPass
  23. float4 _BaseMap_ST;
  24. float4 _BumpMap_ST;
  25. half _BumpScale;
  26. float4 _CoatMask_ST;
  27. half _Occlusion;
  28. half4 _RimColor;
  29. half _RimPower;
  30. half _RimMinPower;
  31. half _RimFrequency;
  32. half _RimPerPositionFrequency;
  33. //#if defined(_MASKMAPSECONDARY)
  34. float4 _SecondaryMask_ST;
  35. //#endif
  36. float _Surface; // URP 10.1
  37. float _Cutoff; // URP 10.1
  38. CBUFFER_END
  39. // Additional textures
  40. #if defined(_MASKMAP)
  41. TEXTURE2D(_CoatMask); SAMPLER(sampler_CoatMask);
  42. #endif
  43. #if defined(_MASKMAPSECONDARY)
  44. TEXTURE2D(_SecondaryMask); SAMPLER(sampler_SecondaryMask);
  45. #endif
  46. // Global Inputs
  47. // Structs
  48. struct VertexInput
  49. {
  50. float3 positionOS : POSITION;
  51. float3 normalOS : NORMAL;
  52. float4 tangentOS : TANGENT;
  53. float2 texcoord : TEXCOORD0;
  54. float2 lightmapUV : TEXCOORD1;
  55. // half4 color : COLOR;
  56. UNITY_VERTEX_INPUT_INSTANCE_ID
  57. };
  58. struct VertexOutput
  59. {
  60. float4 positionCS : SV_POSITION;
  61. #if defined(_MASKMAP)
  62. float4 uv : TEXCOORD0;
  63. #else
  64. float2 uv : TEXCOORD0;
  65. #endif
  66. #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(DEPTHONLYPASS)
  67. DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
  68. #if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
  69. float3 positionWS : TEXCOORD2;
  70. #endif
  71. float3 normalWS : TEXCOORD3;
  72. float3 viewDirWS : TEXCOORD4;
  73. #if defined(_NORMALMAP)
  74. float4 tangentWS : TEXCOORD5;
  75. #endif
  76. half4 fogFactorAndVertexLight : TEXCOORD6;
  77. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  78. float4 shadowCoord : TEXCOORD7;
  79. #endif
  80. #endif
  81. UNITY_VERTEX_INPUT_INSTANCE_ID
  82. UNITY_VERTEX_OUTPUT_STEREO
  83. };
  84. struct SurfaceDescription
  85. {
  86. half3 albedo;
  87. half alpha;
  88. half3 normalTS;
  89. half3 emission;
  90. half metallic;
  91. half3 specular;
  92. half smoothness;
  93. half occlusion;
  94. half clearCoatSmoothness;
  95. half clearCoatThickness;
  96. };
  97. #endif