Lux URP Tree Creator Inputs.hlsl 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 Tree Creator 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 _Color;
  16. half _Smoothness;
  17. half _Metallic;
  18. half4 _SpecColor;
  19. half _Cutoff;
  20. float4 _MainTex_ST;
  21. // needed by meta pass
  22. float4 _BaseMap_ST;
  23. float4 _BumpMap_ST;
  24. half4 _TranslucencyColor;
  25. half _TranslucencyViewDependency;
  26. half _ShadowStrength;
  27. #if defined (DUMMYSHADER)
  28. half _Shininess;
  29. #endif
  30. CBUFFER_END
  31. // These can't be per material...
  32. UNITY_INSTANCING_BUFFER_START(Props)
  33. UNITY_DEFINE_INSTANCED_PROP(half, _SquashAmount)
  34. UNITY_DEFINE_INSTANCED_PROP(half4, _TreeInstanceColor)
  35. UNITY_DEFINE_INSTANCED_PROP(half4, _TreeInstanceScale)
  36. UNITY_DEFINE_INSTANCED_PROP(half4, _SquashPlaneNormal)
  37. UNITY_DEFINE_INSTANCED_PROP(half4, _Wind)
  38. UNITY_INSTANCING_BUFFER_END(Props)
  39. TEXTURE2D (_MainTex); SAMPLER(sampler_MainTex);
  40. TEXTURE2D (_BumpSpecMap ); SAMPLER(sampler_BumpSpecMap);
  41. TEXTURE2D (_TranslucencyMap); SAMPLER(sampler_TranslucencyMap);
  42. #if defined (DUMMYSHADER)
  43. //TEXTURE2D (_BumpMap); SAMPLER(sampler_BumpMap); // already defined
  44. TEXTURE2D (_GlossMap); SAMPLER(sampler_GlossMap);
  45. // TEXTURE2D (_TranslucencyMap); SAMPLER(sampler_TranslucencyMap); // already defined
  46. #endif
  47. // Additional textures
  48. // Global Inputs
  49. // Structs
  50. struct VertexInput
  51. {
  52. float3 positionOS : POSITION;
  53. float3 normalOS : NORMAL;
  54. float4 tangentOS : TANGENT;
  55. float2 texcoord : TEXCOORD0;
  56. float2 texcoord1 : TEXCOORD1;
  57. half4 color : COLOR;
  58. UNITY_VERTEX_INPUT_INSTANCE_ID
  59. };
  60. struct VertexOutput
  61. {
  62. float4 positionCS : SV_POSITION;
  63. #if defined(_MASKMAP)
  64. float4 uv : TEXCOORD0;
  65. #else
  66. float2 uv : TEXCOORD0;
  67. #endif
  68. #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(DEPTHONLYPASS)
  69. DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
  70. #if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
  71. float3 positionWS : TEXCOORD2;
  72. #endif
  73. half4 normalWS : TEXCOORD3;
  74. half4 tangentWS : TEXCOORD4;
  75. half4 bitangentWS : TEXCOORD5;
  76. half4 fogFactorAndVertexLight : TEXCOORD6;
  77. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  78. float4 shadowCoord : TEXCOORD7;
  79. #endif
  80. #endif
  81. #if defined(BILLBOARD_FACE_CAMERA_POS) && defined(_ENABLEDITHERING)
  82. float4 screenPos : TEXCOORD8;
  83. #endif
  84. half4 color : COLOR;
  85. UNITY_VERTEX_INPUT_INSTANCE_ID
  86. UNITY_VERTEX_OUTPUT_STEREO
  87. };
  88. struct SurfaceDescription
  89. {
  90. half3 albedo;
  91. half alpha;
  92. half3 normalTS;
  93. half3 specular;
  94. half gloss;
  95. half occlusion;
  96. half translucency;
  97. };
  98. #endif