SpeedTree8.shader 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. Shader "Universal Render Pipeline/Nature/SpeedTree8"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Base (RGB) Transparency (A)", 2D) = "white" {}
  6. _Color ("Color", Color) = (1,1,1,1)
  7. [Toggle(EFFECT_HUE_VARIATION)] _HueVariationKwToggle("Hue Variation", Float) = 0
  8. _HueVariationColor ("Hue Variation Color", Color) = (1.0,0.5,0.0,0.1)
  9. [Toggle(EFFECT_BUMP)] _NormalMapKwToggle("Normal Mapping", Float) = 0
  10. _BumpMap("Normal Map", 2D) = "bump" {}
  11. _ExtraTex ("Smoothness (R), Metallic (G), AO (B)", 2D) = "(0.5, 0.0, 1.0)" {}
  12. _Glossiness ("Smoothness", Range(0.0, 1.0)) = 0.5
  13. _Metallic ("Metallic", Range(0.0, 1.0)) = 0.0
  14. [Toggle(EFFECT_SUBSURFACE)] _SubsurfaceKwToggle("Subsurface", Float) = 0
  15. _SubsurfaceTex ("Subsurface (RGB)", 2D) = "white" {}
  16. _SubsurfaceColor ("Subsurface Color", Color) = (1,1,1,1)
  17. _SubsurfaceIndirect ("Subsurface Indirect", Range(0.0, 1.0)) = 0.25
  18. [Toggle(EFFECT_BILLBOARD)] _BillboardKwToggle("Billboard", Float) = 0
  19. _BillboardShadowFade ("Billboard Shadow Fade", Range(0.0, 1.0)) = 0.5
  20. [Enum(No,2,Yes,0)] _TwoSided ("Two Sided", Int) = 2 // enum matches cull mode
  21. [KeywordEnum(None,Fastest,Fast,Better,Best,Palm)] _WindQuality ("Wind Quality", Range(0,5)) = 0
  22. }
  23. SubShader
  24. {
  25. Tags
  26. {
  27. "Queue"="AlphaTest"
  28. "IgnoreProjector"="True"
  29. "RenderType"="TransparentCutout"
  30. "DisableBatching"="LODFading"
  31. "RenderPipeline" = "UniversalPipeline"
  32. }
  33. LOD 400
  34. Cull [_TwoSided]
  35. Pass
  36. {
  37. Name "ForwardLit"
  38. Tags { "LightMode" = "UniversalForward" }
  39. HLSLPROGRAM
  40. #pragma vertex SpeedTree8Vert
  41. #pragma fragment SpeedTree8Frag
  42. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS
  43. #pragma multi_compile _ _MAIN_LIGHT_SHADOWS_CASCADE
  44. #pragma multi_compile _ _ADDITIONAL_LIGHTS_VERTEX _ADDITIONAL_LIGHTS
  45. #pragma multi_compile _ _ADDITIONAL_LIGHT_SHADOWS
  46. #pragma multi_compile _ _SHADOWS_SOFT
  47. #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
  48. #pragma multi_compile __ LOD_FADE_CROSSFADE
  49. #pragma multi_compile_fog
  50. #pragma multi_compile_instancing
  51. #pragma instancing_options assumeuniformscaling maxcount:50
  52. #pragma shader_feature_local _WINDQUALITY_NONE _WINDQUALITY_FASTEST _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
  53. #pragma shader_feature_local EFFECT_BILLBOARD
  54. #pragma shader_feature_local EFFECT_HUE_VARIATION
  55. //#pragma shader_feature_local EFFECT_SUBSURFACE // GI dependent.
  56. #pragma shader_feature_local EFFECT_BUMP
  57. #pragma shader_feature_local EFFECT_EXTRA_TEX
  58. #define ENABLE_WIND
  59. #define EFFECT_BACKSIDE_NORMALS
  60. #include "SpeedTree8Input.hlsl"
  61. #include "SpeedTree8Passes.hlsl"
  62. ENDHLSL
  63. }
  64. Pass
  65. {
  66. Name "SceneSelectionPass"
  67. Tags{"LightMode" = "SceneSelectionPass"}
  68. ColorMask 0
  69. HLSLPROGRAM
  70. #pragma vertex SpeedTree8VertDepth
  71. #pragma fragment SpeedTree8FragDepth
  72. #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
  73. #pragma multi_compile __ LOD_FADE_CROSSFADE
  74. #pragma multi_compile_instancing
  75. #pragma instancing_options assumeuniformscaling maxcount:50
  76. #pragma shader_feature_local _WINDQUALITY_NONE _WINDQUALITY_FASTEST _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
  77. #pragma shader_feature_local EFFECT_BILLBOARD
  78. #define ENABLE_WIND
  79. #define DEPTH_ONLY
  80. #define SCENESELECTIONPASS
  81. #include "SpeedTree8Input.hlsl"
  82. #include "SpeedTree8Passes.hlsl"
  83. ENDHLSL
  84. }
  85. Pass
  86. {
  87. Name "ShadowCaster"
  88. Tags{"LightMode" = "ShadowCaster"}
  89. HLSLPROGRAM
  90. #pragma vertex SpeedTree8VertDepth
  91. #pragma fragment SpeedTree8FragDepth
  92. #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
  93. #pragma multi_compile __ LOD_FADE_CROSSFADE
  94. #pragma multi_compile_instancing
  95. #pragma instancing_options assumeuniformscaling maxcount:50
  96. #pragma shader_feature_local _WINDQUALITY_NONE _WINDQUALITY_FASTEST _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
  97. #pragma shader_feature_local EFFECT_BILLBOARD
  98. #define ENABLE_WIND
  99. #define DEPTH_ONLY
  100. #define SHADOW_CASTER
  101. #include "SpeedTree8Input.hlsl"
  102. #include "SpeedTree8Passes.hlsl"
  103. ENDHLSL
  104. }
  105. Pass
  106. {
  107. Name "DepthOnly"
  108. Tags{"LightMode" = "DepthOnly"}
  109. ZWrite On
  110. ColorMask 0
  111. HLSLPROGRAM
  112. #pragma vertex SpeedTree8VertDepth
  113. #pragma fragment SpeedTree8FragDepth
  114. #pragma multi_compile_vertex LOD_FADE_PERCENTAGE
  115. #pragma multi_compile __ LOD_FADE_CROSSFADE
  116. #pragma multi_compile_instancing
  117. #pragma instancing_options assumeuniformscaling maxcount:50
  118. #pragma shader_feature_local _WINDQUALITY_NONE _WINDQUALITY_FASTEST _WINDQUALITY_FAST _WINDQUALITY_BETTER _WINDQUALITY_BEST _WINDQUALITY_PALM
  119. #pragma shader_feature_local EFFECT_BILLBOARD
  120. #define ENABLE_WIND
  121. #define DEPTH_ONLY
  122. #include "SpeedTree8Input.hlsl"
  123. #include "SpeedTree8Passes.hlsl"
  124. ENDHLSL
  125. }
  126. }
  127. CustomEditor "SpeedTree8ShaderGUI"
  128. }