Lux URP Particles Simple Lit Tess.shader 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. Shader "Lux URP/Particles/Simple Lit Tess"
  2. {
  3. // ------------------------------------------
  4. // All lights are supported for lit particles
  5. // Per pixel or per vertex shadows
  6. Properties
  7. {
  8. [HeaderHelpLuxURP_URL(hgrc26wf1x5s)]
  9. [Header(Tessellation)]
  10. [Space(8)]
  11. [IntRange] _Tess ("Tessellation", Range(1, 15)) = 3
  12. [LuxURPVectorTwoDrawer]
  13. _TessRange ("Near (X) Far (Y)", Vector) = (5,15,0,0)
  14. [Header(Surface Options)]
  15. [Space(8)]
  16. [Enum(UnityEngine.Rendering.CompareFunction)]
  17. _ZTest ("ZTest", Float) = 4 // "LessEqual"
  18. [Enum(UnityEngine.Rendering.CullMode)]
  19. _Cull ("Cull", Float) = 2.0
  20. [HideInInspector]
  21. [Enum(Off,0,On,1)]_ZWrite ("ZWrite", Float) = 0.0
  22. [Space(5)]
  23. [Enum(Alpha,0,Premultiply,1,Additive,2,Multiply,3)]
  24. _Blend ("Blending Mode", Float) = 0
  25. [Enum(Multiply,0,Additive,1,Subtractive,2,Overlay,3,Color,4,Difference,5)]
  26. _ColorMode ("Color Mode", Float) = 0.0
  27. [Space(5)]
  28. [ToggleOff(_RECEIVE_SHADOWS_OFF)]
  29. _ReceiveShadows ("Receive Shadows", Float) = 0.0
  30. [Toggle(_ADDITIONALLIGHT_SHADOWS)]
  31. _AdditionalLightShadows ("Additional Light Shadows", Float) = 1.0
  32. [Toggle(_PERVERTEX_SHADOWS)]
  33. _PerVertexShadows (" Per Vertex Shadows", Float) = 0.0
  34. _SampleOffset (" Sample Offset", Range(0, 2)) = 0.1
  35. [Header(Surface Inputs)]
  36. [Space(8)]
  37. _BaseColor ("Base Color", Color) = (1,1,1,1)
  38. _BaseMap ("Base Map", 2D) = "white" {}
  39. _Cutoff ("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
  40. [Space(5)]
  41. [ToggleOff] _SpecularHighlights ("Specular Highlights", Float) = 1.0
  42. [Toggle]
  43. _EnableSpecGloss (" Enable Spec Gloss Map", Float) = 0.0
  44. [NoScaleOffset] _SpecGlossMap (" Spec Gloss Map", 2D) = "white" {}
  45. _SpecColor (" Specular (RGB) Smoothness(A)", Color) = (1.0, 1.0, 1.0, .5)
  46. //_Smoothness (" Smoothness", Range(0.0, 1.0)) = 0.5
  47. [Space(5)]
  48. [Toggle(_NORMALMAP)]
  49. _ApplyNormal ("Enable Normal Map", Float) = 0.0
  50. [NoScaleOffset] _BumpMap (" Normal Map", 2D) = "bump" {}
  51. //_BumpScale (" Scale", Float) = 1.0
  52. [Space(5)]
  53. [Toggle(_EMISSION)]
  54. _EnabelEmission ("Enable Emission", Float) = 0.0
  55. [NoScaleOffset] _EmissionMap (" Emission Map", 2D) = "white" {}
  56. [HDR]_EmissionColor (" Color", Color) = (1,1,1)
  57. [Space(5)]
  58. [Toggle(_TRANSMISSION)]
  59. _EnableTransmission ("Enable Transmission", Float) = 0.0
  60. _Transmission (" Transmission", Range(0.0, 1.0)) = 0.5
  61. _TransmissionDistortion (" Distortion", Range(0.01, 0.5)) = 0.01
  62. // Hidden properties - Generic
  63. [HideInInspector] _BlendOp("__blendop", Float) = 0.0
  64. // Particle specific
  65. [Header(Particle Options)]
  66. [Space(5)]
  67. [Toggle(_FLIPBOOKBLENDING_ON)]
  68. _FlipbookBlending ("Enable Flipbook Blending", Float) = 0.0
  69. [Space(5)]
  70. [Toggle(_DISTORTION_ON)]
  71. _DistortionEnabled ("Enable Distortion", Float) = 0.0
  72. _DistortionStrength (" Strength", Float) = 1.0
  73. _DistortionBlend (" Blend", Range(0.0, 1.0)) = 0.5
  74. [HideInInspector]
  75. _DistortionStrengthScaled (" Distortion Strength Scaled", Float) = 0.1
  76. [Space(5)]
  77. [Toggle(_SOFTPARTICLES_ON)]
  78. _SoftParticlesEnabled ("Enable Soft Particles", Float) = 0.0
  79. [LuxURPVectorTwoDrawer]
  80. _SoftParticleFadeParams (" Near (X) Far (Y)", Vector) = (0,1,0,0)
  81. [Space(5)]
  82. [Toggle(_FADING_ON)]
  83. _CameraFadingEnabled ("Enable Camera Fading", Float) = 0.0
  84. [LuxURPVectorTwoDrawer]
  85. _CameraFadeParamsRaw (" Near (X) Far (Y)", Vector) = (1,2,0,0)
  86. [HideInInspector]_CameraFadeParams (" Near (X) Far (Y)", Vector) = (1,1,0,0)
  87. // Hidden props
  88. [HideInInspector] _Surface("__surface", Float) = 0.0
  89. [HideInInspector] _AlphaClip("__clip", Float) = 0.0
  90. [HideInInspector] [Enum(UnityEngine.Rendering.BlendMode)] _SrcBlend("__src", Float) = 1.0
  91. [HideInInspector] [Enum(UnityEngine.Rendering.BlendMode)] _DstBlend("__dst", Float) = 0.0
  92. [HideInInspector] _BaseColorAddSubDiff ("_ColorMode", Vector) = (0,0,0,0)
  93. // Editmode props
  94. [HideInInspector] _QueueOffset("Queue offset", Float) = 0.0
  95. // ObsoleteProperties
  96. [HideInInspector] _FlipbookMode("flipbook", Float) = 0
  97. [HideInInspector] _Glossiness("gloss", Float) = 0
  98. [HideInInspector] _Mode("mode", Float) = 0
  99. [HideInInspector] _Color("color", Color) = (1,1,1,1)
  100. // Lightmapper and outline selection shader need _MainTex, _Color and _Cutoff
  101. [HideInInspector] _MainTex ("Albedo", 2D) = "white" {}
  102. [HideInInspector] _Color ("Color", Color) = (1,1,1,1)
  103. [HideInInspector] _Cutoff ("Alpha Cutoff", Range(0.0, 1.0)) = 0.0
  104. }
  105. SubShader
  106. {
  107. Tags {
  108. "RenderType" = "Transparent"
  109. "Queue" = "Transparent"
  110. "IgnoreProjector" = "True"
  111. "PreviewType" = "Plane"
  112. "PerformanceChecks" = "False"
  113. "RenderPipeline" = "UniversalPipeline"
  114. }
  115. // ------------------------------------------------------------------
  116. // Forward pass.
  117. Pass
  118. {
  119. // Lightmode matches the ShaderPassName set in LightweightRenderPipeline.cs. SRPDefaultUnlit and passes with
  120. // no LightMode tag are also rendered by Lightweight Render Pipeline
  121. Name "ForwardLit"
  122. Tags {"LightMode" = "UniversalForward"}
  123. BlendOp[_BlendOp]
  124. Blend[_SrcBlend][_DstBlend]
  125. ZWrite[_ZWrite]
  126. Cull[_Cull]
  127. HLSLPROGRAM
  128. // Required to compile gles 2.0 with standard SRP library
  129. // All shaders must be compiled with HLSLcc and currently only gles is not using HLSLcc by default
  130. #pragma prefer_hlslcc gles
  131. #pragma exclude_renderers d3d11_9x
  132. #pragma target 4.6
  133. // -------------------------------------
  134. // Material Keywords
  135. #pragma shader_feature_local _NORMALMAP
  136. #pragma shader_feature_local_fragment _EMISSION
  137. //#pragma shader_feature _SPECULARHIGHLIGHTS_OFF
  138. #pragma shader_feature _SPECULARHIGHLIGHTS_OFF _SPECGLOSSMAP _SPECULAR_COLOR
  139. // _RECEIVE_SHADOWS_OFF drives AdditionalLightRealtimeShadow() in shadows.hlsl. Without it being set no sampling will happen
  140. // shadows.hlsl differs in LWRP and URP
  141. #pragma shader_feature _RECEIVE_SHADOWS_OFF
  142. #pragma shader_feature_local _PERVERTEX_SHADOWS
  143. #pragma shader_feature_local _PERVERTEX_SAMPLEOFFSET
  144. #pragma shader_feature_local _ADDITIONALLIGHT_SHADOWS
  145. #pragma shader_feature_local_fragment _TRANSMISSION
  146. // -------------------------------------
  147. // Particle Keywords
  148. #pragma shader_feature _ _ALPHAPREMULTIPLY_ON _ALPHAMODULATE_ON _ADDITIVE
  149. //#pragma shader_feature _ALPHATEST_ON
  150. #pragma shader_feature _ _COLOROVERLAY_ON _COLORCOLOR_ON _COLORADDSUBDIFF_ON
  151. #pragma shader_feature _FLIPBOOKBLENDING_ON
  152. #pragma shader_feature _SOFTPARTICLES_ON
  153. #pragma shader_feature _FADING_ON
  154. #pragma shader_feature _DISTORTION_ON
  155. // -------------------------------------
  156. // Universal Pipeline keywords
  157. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  158. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  159. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  160. #pragma multi_compile_fragment _ _ADDITIONAL_LIGHT_SHADOWS
  161. #pragma multi_compile_fragment _ _SHADOWS_SOFT
  162. #if defined(_SHADOWS_SOFT) && defined(_PERVERTEX_SHADOWS)
  163. #undef _SHADOWS_SOFT
  164. #endif
  165. //--------------------------------------
  166. // GPU Instancing
  167. #pragma multi_compile_instancing
  168. // #pragma multi_compile _ DOTS_INSTANCING_ON // needs shader target 4.5
  169. // -------------------------------------
  170. // Unity defined keywords
  171. #pragma multi_compile_fog
  172. #pragma hull ParticlesLitHull
  173. #pragma domain ParticlesLitDomain
  174. #pragma vertex ParticlesLitTessVertex
  175. #pragma fragment ParticlesLitFragment
  176. #define BUMP_SCALE_NOT_SUPPORTED 1
  177. #define _USESTESSELLATION
  178. #include "Includes/Lux URP Particles Simple Lit Inputs.hlsl"
  179. #include "Includes/Lux URP Particles Simple Lit Forward Pass.hlsl"
  180. ENDHLSL
  181. }
  182. }
  183. Fallback "Lux URP/Particles/Simple Lit"
  184. CustomEditor "LuxURPParticlesCustomShaderGUI"
  185. }