Lux URP Terrain Blend Inputs.hlsl 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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 Blend 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. float3 _TerrainPos;
  16. float3 _TerrainSize;
  17. float4 _TerrainHeightNormal_TexelSize;
  18. float _Shift;
  19. half _AlphaShift;
  20. half _AlphaWidth;
  21. float _ShadowShiftThreshold;
  22. float _ShadowShift;
  23. float _ShadowShiftView;
  24. half _NormalShift;
  25. half _NormalWidth;
  26. half _NormalThreshold;
  27. half _BumpScale;
  28. half4 _BaseColor;
  29. half _Cutoff;
  30. float4 _BaseMap_ST;
  31. half _Smoothness;
  32. half4 _SpecColor;
  33. //half _OcclusionStrength;
  34. CBUFFER_END
  35. // Additional textures
  36. //TEXTURE2D(_TopDownBaseMap); SAMPLER(sampler_TopDownBaseMap);
  37. //TEXTURE2D(_TopDownNormalMap); SAMPLER(sampler_TopDownNormalMap);
  38. TEXTURE2D(_TerrainHeightNormal); SAMPLER(sampler_TerrainHeightNormal);
  39. // Global Inputs
  40. // Structs
  41. struct VertexInput
  42. {
  43. float3 positionOS : POSITION;
  44. float3 normalOS : NORMAL;
  45. float4 tangentOS : TANGENT;
  46. float2 texcoord : TEXCOORD0;
  47. float2 lightmapUV : TEXCOORD1;
  48. half4 color : COLOR;
  49. UNITY_VERTEX_INPUT_INSTANCE_ID
  50. };
  51. struct VertexOutput
  52. {
  53. float4 positionCS : SV_POSITION;
  54. float2 uv : TEXCOORD0;
  55. #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(DEPTHONLYPASS)
  56. DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
  57. //#ifdef _ADDITIONAL_LIGHTS
  58. float3 positionWS : TEXCOORD2;
  59. //#endif
  60. float3 normalWS : TEXCOORD3;
  61. float3 viewDirWS : TEXCOORD4;
  62. #if defined(_NORMALMAP)
  63. float4 tangentWS : TEXCOORD5;
  64. #endif
  65. half4 fogFactorAndVertexLight : TEXCOORD6;
  66. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  67. float4 shadowCoord : TEXCOORD7;
  68. #endif
  69. #endif
  70. UNITY_VERTEX_INPUT_INSTANCE_ID
  71. UNITY_VERTEX_OUTPUT_STEREO
  72. };
  73. struct SurfaceDescription
  74. {
  75. half3 albedo;
  76. half alpha;
  77. half3 normalTS;
  78. half3 emission;
  79. half metallic;
  80. half3 specular;
  81. half smoothness;
  82. half occlusion;
  83. };
  84. #endif