Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

ParticlesUnlit.shader 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310
  1. Shader "Universal Render Pipeline/Particles/Unlit"
  2. {
  3. Properties
  4. {
  5. [MainTexture] _BaseMap("Base Map", 2D) = "white" {}
  6. [MainColor] _BaseColor("Base Color", Color) = (1,1,1,1)
  7. _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
  8. _BumpMap("Normal Map", 2D) = "bump" {}
  9. [HDR] _EmissionColor("Color", Color) = (0,0,0)
  10. _EmissionMap("Emission", 2D) = "white" {}
  11. // -------------------------------------
  12. // Particle specific
  13. _SoftParticlesNearFadeDistance("Soft Particles Near Fade", Float) = 0.0
  14. _SoftParticlesFarFadeDistance("Soft Particles Far Fade", Float) = 1.0
  15. _CameraNearFadeDistance("Camera Near Fade", Float) = 1.0
  16. _CameraFarFadeDistance("Camera Far Fade", Float) = 2.0
  17. _DistortionBlend("Distortion Blend", Range(0.0, 1.0)) = 0.5
  18. _DistortionStrength("Distortion Strength", Float) = 1.0
  19. // -------------------------------------
  20. // Hidden properties - Generic
  21. _Surface("__surface", Float) = 0.0
  22. _Blend("__mode", Float) = 0.0
  23. _Cull("__cull", Float) = 2.0
  24. [ToggleUI] _AlphaClip("__clip", Float) = 0.0
  25. [HideInInspector] _BlendOp("__blendop", Float) = 0.0
  26. [HideInInspector] _SrcBlend("__src", Float) = 1.0
  27. [HideInInspector] _DstBlend("__dst", Float) = 0.0
  28. [HideInInspector] _SrcBlendAlpha("__srcA", Float) = 1.0
  29. [HideInInspector] _DstBlendAlpha("__dstA", Float) = 0.0
  30. [HideInInspector] _ZWrite("__zw", Float) = 1.0
  31. [HideInInspector] _AlphaToMask("__alphaToMask", Float) = 0.0
  32. // Particle specific
  33. _ColorMode("_ColorMode", Float) = 0.0
  34. [HideInInspector] _BaseColorAddSubDiff("_ColorMode", Vector) = (0,0,0,0)
  35. [ToggleOff] _FlipbookBlending("__flipbookblending", Float) = 0.0
  36. [ToggleUI] _SoftParticlesEnabled("__softparticlesenabled", Float) = 0.0
  37. [ToggleUI] _CameraFadingEnabled("__camerafadingenabled", Float) = 0.0
  38. [ToggleUI] _DistortionEnabled("__distortionenabled", Float) = 0.0
  39. [HideInInspector] _SoftParticleFadeParams("__softparticlefadeparams", Vector) = (0,0,0,0)
  40. [HideInInspector] _CameraFadeParams("__camerafadeparams", Vector) = (0,0,0,0)
  41. [HideInInspector] _DistortionStrengthScaled("Distortion Strength Scaled", Float) = 0.1
  42. // Editmode props
  43. _QueueOffset("Queue offset", Float) = 0.0
  44. // ObsoleteProperties
  45. [HideInInspector] _FlipbookMode("flipbook", Float) = 0
  46. [HideInInspector] _Mode("mode", Float) = 0
  47. [HideInInspector] _Color("color", Color) = (1,1,1,1)
  48. }
  49. HLSLINCLUDE
  50. //Particle shaders rely on "write" to CB syntax which is not supported by DXC
  51. #pragma never_use_dxc
  52. ENDHLSL
  53. SubShader
  54. {
  55. Tags
  56. {
  57. "RenderType" = "Opaque"
  58. "IgnoreProjector" = "True"
  59. "PreviewType" = "Plane"
  60. "PerformanceChecks" = "False"
  61. "RenderPipeline" = "UniversalPipeline"
  62. }
  63. // ------------------------------------------------------------------
  64. // Forward pass.
  65. Pass
  66. {
  67. Name "ForwardLit"
  68. // -------------------------------------
  69. // Render State Commands
  70. BlendOp[_BlendOp]
  71. Blend[_SrcBlend][_DstBlend], [_SrcBlendAlpha][_DstBlendAlpha]
  72. ZWrite[_ZWrite]
  73. Cull[_Cull]
  74. AlphaToMask[_AlphaToMask]
  75. HLSLPROGRAM
  76. #pragma target 2.0
  77. // -------------------------------------
  78. // Shader Stages
  79. #pragma vertex vertParticleUnlit
  80. #pragma fragment fragParticleUnlit
  81. // -------------------------------------
  82. // Material Keywords
  83. #pragma shader_feature_local _NORMALMAP
  84. #pragma shader_feature_local_fragment _EMISSION
  85. // -------------------------------------
  86. // Particle Keywords
  87. #pragma shader_feature_local _FLIPBOOKBLENDING_ON
  88. #pragma shader_feature_local _SOFTPARTICLES_ON
  89. #pragma shader_feature_local _FADING_ON
  90. #pragma shader_feature_local _DISTORTION_ON
  91. #pragma shader_feature_local_fragment _ALPHATEST_ON
  92. #pragma shader_feature_local_fragment _SURFACE_TYPE_TRANSPARENT
  93. #pragma shader_feature_local_fragment _ _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON
  94. #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
  95. // -------------------------------------
  96. // Unity defined keywords
  97. #pragma multi_compile_fog
  98. #pragma multi_compile_instancing
  99. #pragma multi_compile_fragment _ _SCREEN_SPACE_OCCLUSION
  100. #pragma multi_compile_fragment _ DEBUG_DISPLAY
  101. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/ProbeVolumeVariants.hlsl"
  102. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  103. #pragma instancing_options procedural:ParticleInstancingSetup
  104. // -------------------------------------
  105. // Includes
  106. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl"
  107. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitForwardPass.hlsl"
  108. ENDHLSL
  109. }
  110. // ------------------------------------------------------------------
  111. // Depth Only pass.
  112. Pass
  113. {
  114. Name "DepthOnly"
  115. Tags
  116. {
  117. "LightMode" = "DepthOnly"
  118. }
  119. // -------------------------------------
  120. // Render State Commands
  121. ZWrite On
  122. ColorMask R
  123. Cull[_Cull]
  124. HLSLPROGRAM
  125. #pragma target 2.0
  126. // -------------------------------------
  127. // Shader Stages
  128. #pragma vertex DepthOnlyVertex
  129. #pragma fragment DepthOnlyFragment
  130. // -------------------------------------
  131. // Material Keywords
  132. #pragma shader_feature_local _ _ALPHATEST_ON
  133. #pragma shader_feature_local _ _FLIPBOOKBLENDING_ON
  134. #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
  135. // -------------------------------------
  136. // Unity defined keywords
  137. #pragma multi_compile_instancing
  138. #pragma instancing_options procedural:ParticleInstancingSetup
  139. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  140. // -------------------------------------
  141. // Includes
  142. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl"
  143. #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthOnlyPass.hlsl"
  144. ENDHLSL
  145. }
  146. // This pass is used when drawing to a _CameraNormalsTexture texture with the forward renderer or the depthNormal prepass with the deferred renderer.
  147. Pass
  148. {
  149. Name "DepthNormalsOnly"
  150. Tags
  151. {
  152. "LightMode" = "DepthNormalsOnly"
  153. }
  154. // -------------------------------------
  155. // Render State Commands
  156. ZWrite On
  157. Cull[_Cull]
  158. HLSLPROGRAM
  159. #pragma target 2.0
  160. // -------------------------------------
  161. // Shader Stages
  162. #pragma vertex DepthNormalsVertex
  163. #pragma fragment DepthNormalsFragment
  164. // -------------------------------------
  165. // Material Keywords
  166. #pragma shader_feature_local _ _NORMALMAP
  167. #pragma shader_feature_local _ _ALPHATEST_ON
  168. #pragma shader_feature_local_fragment _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
  169. // -------------------------------------
  170. // Unity defined keywords
  171. #pragma multi_compile_fragment _ _GBUFFER_NORMALS_OCT // forward-only variant
  172. //--------------------------------------
  173. // GPU Instancing
  174. #pragma multi_compile_instancing
  175. #pragma instancing_options procedural:ParticleInstancingSetup
  176. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  177. // -------------------------------------
  178. // Includes
  179. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl"
  180. #include "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesDepthNormalsPass.hlsl"
  181. ENDHLSL
  182. }
  183. // ------------------------------------------------------------------
  184. // Scene view outline pass.
  185. Pass
  186. {
  187. Name "SceneSelectionPass"
  188. Tags
  189. {
  190. "LightMode" = "SceneSelectionPass"
  191. }
  192. // -------------------------------------
  193. // Render State Commands
  194. BlendOp Add
  195. Blend One Zero
  196. ZWrite On
  197. Cull Off
  198. HLSLPROGRAM
  199. #define PARTICLES_EDITOR_META_PASS
  200. #pragma target 2.0
  201. // -------------------------------------
  202. // Shader Stages
  203. #pragma vertex vertParticleEditor
  204. #pragma fragment fragParticleSceneHighlight
  205. // -------------------------------------
  206. // Particle Keywords
  207. #pragma shader_feature_local_fragment _ALPHATEST_ON
  208. #pragma shader_feature_local _FLIPBOOKBLENDING_ON
  209. // -------------------------------------
  210. // Unity defined keywords
  211. #pragma multi_compile_instancing
  212. #pragma instancing_options procedural:ParticleInstancingSetup
  213. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  214. // -------------------------------------
  215. // Includes
  216. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl"
  217. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesEditorPass.hlsl"
  218. ENDHLSL
  219. }
  220. // ------------------------------------------------------------------
  221. // Scene picking buffer pass.
  222. Pass
  223. {
  224. Name "ScenePickingPass"
  225. Tags
  226. {
  227. "LightMode" = "Picking"
  228. }
  229. // -------------------------------------
  230. // Render State Commands
  231. BlendOp Add
  232. Blend One Zero
  233. ZWrite On
  234. Cull Off
  235. HLSLPROGRAM
  236. #define PARTICLES_EDITOR_META_PASS
  237. #pragma target 2.0
  238. // -------------------------------------
  239. // Shader Stages
  240. #pragma vertex vertParticleEditor
  241. #pragma fragment fragParticleScenePicking
  242. // -------------------------------------
  243. // Particle Keywords
  244. #pragma shader_feature_local_fragment _ALPHATEST_ON
  245. #pragma shader_feature_local _FLIPBOOKBLENDING_ON
  246. // -------------------------------------
  247. // Unity defined keywords
  248. #pragma multi_compile_instancing
  249. #pragma instancing_options procedural:ParticleInstancingSetup
  250. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/ShaderLibrary/DOTS.hlsl"
  251. // -------------------------------------
  252. // Includes
  253. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesUnlitInput.hlsl"
  254. #include_with_pragmas "Packages/com.unity.render-pipelines.universal/Shaders/Particles/ParticlesEditorPass.hlsl"
  255. ENDHLSL
  256. }
  257. }
  258. FallBack "Hidden/Universal Render Pipeline/FallbackError"
  259. CustomEditor "UnityEditor.Rendering.Universal.ShaderGUI.ParticlesUnlitShader"
  260. }