ParticlesInput.hlsl 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. #ifndef UNIVERSAL_PARTICLES_INPUT_INCLUDED
  2. #define UNIVERSAL_PARTICLES_INPUT_INCLUDED
  3. #include "Packages/com.unity.render-pipelines.universal/ShaderLibrary/Lighting.hlsl"
  4. struct AttributesParticle
  5. {
  6. float4 positionOS : POSITION;
  7. half4 color : COLOR;
  8. #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED)
  9. float4 texcoords : TEXCOORD0;
  10. float texcoordBlend : TEXCOORD1;
  11. #else
  12. float2 texcoords : TEXCOORD0;
  13. #endif
  14. #if !defined(PARTICLES_EDITOR_META_PASS)
  15. float3 normalOS : NORMAL;
  16. float4 tangentOS : TANGENT;
  17. #endif
  18. UNITY_VERTEX_INPUT_INSTANCE_ID
  19. };
  20. struct VaryingsParticle
  21. {
  22. float4 clipPos : SV_POSITION;
  23. float2 texcoord : TEXCOORD0;
  24. half4 color : COLOR;
  25. #if defined(_FLIPBOOKBLENDING_ON)
  26. float3 texcoord2AndBlend : TEXCOORD5;
  27. #endif
  28. #if !defined(PARTICLES_EDITOR_META_PASS)
  29. float4 positionWS : TEXCOORD1;
  30. #ifdef _NORMALMAP
  31. half4 normalWS : TEXCOORD2; // xyz: normal, w: viewDir.x
  32. half4 tangentWS : TEXCOORD3; // xyz: tangent, w: viewDir.y
  33. half4 bitangentWS : TEXCOORD4; // xyz: bitangent, w: viewDir.z
  34. #else
  35. half3 normalWS : TEXCOORD2;
  36. half3 viewDirWS : TEXCOORD3;
  37. #endif
  38. #if defined(_SOFTPARTICLES_ON) || defined(_FADING_ON) || defined(_DISTORTION_ON)
  39. float4 projectedPosition: TEXCOORD6;
  40. #endif
  41. #if defined(REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR)
  42. float4 shadowCoord : TEXCOORD7;
  43. #endif
  44. half3 vertexSH : TEXCOORD8; // SH
  45. #endif
  46. UNITY_VERTEX_INPUT_INSTANCE_ID
  47. UNITY_VERTEX_OUTPUT_STEREO
  48. };
  49. struct AttributesDepthOnlyParticle
  50. {
  51. float4 vertex : POSITION;
  52. #if defined(_ALPHATEST_ON)
  53. half4 color : COLOR;
  54. #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED)
  55. float4 texcoords : TEXCOORD0;
  56. float texcoordBlend : TEXCOORD1;
  57. #else
  58. float2 texcoords : TEXCOORD0;
  59. #endif
  60. #endif
  61. UNITY_VERTEX_INPUT_INSTANCE_ID
  62. };
  63. struct VaryingsDepthOnlyParticle
  64. {
  65. float4 clipPos : SV_POSITION;
  66. #if defined(_ALPHATEST_ON)
  67. float2 texcoord : TEXCOORD0;
  68. half4 color : COLOR;
  69. #if defined(_FLIPBOOKBLENDING_ON)
  70. float3 texcoord2AndBlend : TEXCOORD5;
  71. #endif
  72. #endif
  73. UNITY_VERTEX_INPUT_INSTANCE_ID
  74. UNITY_VERTEX_OUTPUT_STEREO
  75. };
  76. struct AttributesDepthNormalsParticle
  77. {
  78. float4 vertex : POSITION;
  79. #if defined(_ALPHATEST_ON)
  80. half4 color : COLOR;
  81. #endif
  82. #if defined(_ALPHATEST_ON) || defined(_NORMALMAP)
  83. #if defined(_FLIPBOOKBLENDING_ON) && !defined(UNITY_PARTICLE_INSTANCING_ENABLED)
  84. float4 texcoords : TEXCOORD0;
  85. float texcoordBlend : TEXCOORD1;
  86. #else
  87. float2 texcoords : TEXCOORD0;
  88. #endif
  89. #endif
  90. float3 normal : NORMAL;
  91. float4 tangent : TANGENT;
  92. UNITY_VERTEX_INPUT_INSTANCE_ID
  93. };
  94. struct VaryingsDepthNormalsParticle
  95. {
  96. float4 clipPos : SV_POSITION;
  97. #if defined(_ALPHATEST_ON)
  98. half4 color : COLOR;
  99. #endif
  100. #if defined(_ALPHATEST_ON) || defined(_NORMALMAP)
  101. float2 texcoord : TEXCOORD0;
  102. #if defined(_FLIPBOOKBLENDING_ON)
  103. float3 texcoord2AndBlend : TEXCOORD5;
  104. #endif
  105. #endif
  106. #if defined(_NORMALMAP)
  107. float4 normalWS : TEXCOORD2; // xyz: normal, w: viewDir.x
  108. float4 tangentWS : TEXCOORD3; // xyz: tangent, w: viewDir.y
  109. float4 bitangentWS : TEXCOORD4; // xyz: bitangent, w: viewDir.z
  110. #else
  111. float3 normalWS : TEXCOORD2;
  112. float3 viewDirWS : TEXCOORD3;
  113. #endif
  114. UNITY_VERTEX_INPUT_INSTANCE_ID
  115. UNITY_VERTEX_OUTPUT_STEREO
  116. };
  117. #endif // UNIVERSAL_PARTICLES_INPUT_INCLUDED