Lux URP Toon Inputs.hlsl 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 Toon 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. half _Cutoff;
  17. float4 _BaseMap_ST;
  18. half _Smoothness;
  19. half4 _SpecColor;
  20. // Toon
  21. half4 _ShadedBaseColor;
  22. half _Steps;
  23. half _DiffuseStep;
  24. half _DiffuseFallOff;
  25. half _Anisotropy;
  26. half _EnergyConservation;
  27. half _SpecularStep;
  28. half _SpecularFallOff;
  29. half _ColorizedShadowsMain;
  30. half _ColorizedShadowsAdd;
  31. half _LightColorContribution;
  32. half _AddLightFallOff;
  33. half _ShadowFallOff;
  34. half _ShadoBiasDirectional;
  35. half _ShadowBiasAdditional;
  36. half4 _SpecColor2nd;
  37. half4 _ToonRimColor;
  38. half _ToonRimPower;
  39. half _ToonRimFallOff;
  40. half _ToonRimAttenuation;
  41. half4 _EmissionColor;
  42. // Simple
  43. half _BumpScale;
  44. float4 _MaskMap_ST;
  45. half _OcclusionStrength;
  46. half _ShadowOffset;
  47. half4 _RimColor;
  48. half _RimPower;
  49. half _RimMinPower;
  50. half _RimFrequency;
  51. half _RimPerPositionFrequency;
  52. // Outline
  53. half4 _OutlineColor;
  54. half _Border;
  55. float4 _BaseMap_TexelSize;
  56. CBUFFER_END
  57. // Additional textures
  58. // Toon
  59. #if defined(_TEXMODE_TWO)
  60. TEXTURE2D(_ShadedBaseMap);
  61. #endif
  62. #if defined(_MASKMAP)
  63. TEXTURE2D(_MaskMap); SAMPLER(sampler_MaskMap);
  64. #endif
  65. // Global Inputs
  66. // Structs
  67. struct VertexInput
  68. {
  69. float3 positionOS : POSITION;
  70. float3 normalOS : NORMAL;
  71. #if defined(_NORMALMAP) || (defined(_ANISOTROPIC) && !defined(_SPECULARHIGHLIGHTS_OFF))
  72. float4 tangentOS : TANGENT;
  73. #endif
  74. #if defined(_TEXMODE_ONE) || defined(_TEXMODE_TWO) || defined(_NORMALMAP) || defined(_MASKMAP)
  75. float2 texcoord : TEXCOORD0;
  76. #endif
  77. #if defined(LIGHTMAP_ON)
  78. float2 lightmapUV : TEXCOORD1;
  79. #endif
  80. //half4 color : COLOR;
  81. UNITY_VERTEX_INPUT_INSTANCE_ID
  82. };
  83. struct VertexOutput
  84. {
  85. float4 positionCS : SV_POSITION;
  86. #if defined(_TEXMODE_ONE) || defined(_TEXMODE_TWO) || defined(_TEXMODE_TWO) || defined(_NORMALMAP) || defined(_MASKMAP)
  87. float2 uv : TEXCOORD0;
  88. #endif
  89. #if !defined(UNITY_PASS_SHADOWCASTER) && !defined(DEPTHONLYPASS)
  90. DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1);
  91. #if defined(REQUIRES_WORLD_SPACE_POS_INTERPOLATOR)
  92. float3 positionWS : TEXCOORD2;
  93. #endif
  94. float3 normalWS : TEXCOORD3;
  95. float3 viewDirWS : TEXCOORD4;
  96. #if defined(_NORMALMAP) || (defined(_ANISOTROPIC) && !defined(_SPECULARHIGHLIGHTS_OFF))
  97. float4 tangentWS : TEXCOORD5;
  98. #endif
  99. half4 fogFactorAndVertexLight : TEXCOORD6;
  100. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  101. float4 shadowCoord : TEXCOORD7;
  102. #endif
  103. #endif
  104. UNITY_VERTEX_INPUT_INSTANCE_ID
  105. UNITY_VERTEX_OUTPUT_STEREO
  106. };
  107. struct SurfaceDescription
  108. {
  109. half3 albedo;
  110. half3 albedoShaded;
  111. half alpha;
  112. half3 normalTS;
  113. half3 emission;
  114. half metallic;
  115. half3 specular;
  116. half smoothness;
  117. half occlusion;
  118. };
  119. #endif