You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

333 lines
9.0 KiB

  1. // Unity built-in shader source. Copyright (c) 2016 Unity Technologies. MIT license (see license.txt)
  2. Shader "Animmal/Custom Standard (Specular setup)"
  3. {
  4. Properties
  5. {
  6. _Color("Color", Color) = (1,1,1,1)
  7. _MainTex("Albedo", 2D) = "white" {}
  8. _Cutoff("Alpha Cutoff", Range(0.0, 1.0)) = 0.5
  9. _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
  10. _GlossMapScale("Smoothness Factor", Range(0.0, 1.0)) = 1.0
  11. [Enum(Specular Alpha,0,Albedo Alpha,1)] _SmoothnessTextureChannel ("Smoothness texture channel", Float) = 0
  12. _SpecColor("Specular", Color) = (0.2,0.2,0.2)
  13. _SpecGlossMap("Specular", 2D) = "white" {}
  14. [ToggleOff] _SpecularHighlights("Specular Highlights", Float) = 1.0
  15. [ToggleOff] _GlossyReflections("Glossy Reflections", Float) = 1.0
  16. _BumpScale("Scale", Float) = 1.0
  17. _BumpMap("Normal Map", 2D) = "bump" {}
  18. _Parallax ("Height Scale", Range (0.005, 0.08)) = 0.02
  19. _ParallaxMap ("Height Map", 2D) = "black" {}
  20. _OcclusionStrength("Strength", Range(0.0, 1.0)) = 1.0
  21. _OcclusionMap("Occlusion", 2D) = "white" {}
  22. _EmissionColor("Color", Color) = (0,0,0)
  23. _EmissionMap("Emission", 2D) = "white" {}
  24. _DetailMask("Detail Mask", 2D) = "white" {}
  25. _DetailAlbedoMap("Detail Albedo x2", 2D) = "grey" {}
  26. _DetailNormalMapScale("Scale", Float) = 1.0
  27. _DetailNormalMap("Normal Map", 2D) = "bump" {}
  28. [Enum(UV0,0,UV1,1)] _UVSec ("UV Set for secondary textures", Float) = 0
  29. // Blending state
  30. [HideInInspector] _Mode ("__mode", Float) = 0.0
  31. [HideInInspector] _SrcBlend ("__src", Float) = 1.0
  32. [HideInInspector] _DstBlend ("__dst", Float) = 0.0
  33. [HideInInspector] _ZWrite ("__zw", Float) = 1.0
  34. }
  35. CGINCLUDE
  36. #define UNITY_SETUP_BRDF_INPUT SpecularSetup
  37. ENDCG
  38. SubShader
  39. {
  40. Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
  41. LOD 300
  42. // ------------------------------------------------------------------
  43. // Base forward pass (directional light, emission, lightmaps, ...)
  44. Pass
  45. {
  46. Name "FORWARD"
  47. Tags { "LightMode" = "ForwardBase" }
  48. Blend [_SrcBlend] [_DstBlend]
  49. ZWrite [_ZWrite]
  50. Cull Off
  51. CGPROGRAM
  52. #pragma target 3.0
  53. // -------------------------------------
  54. #pragma shader_feature _NORMALMAP
  55. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  56. #pragma shader_feature _EMISSION
  57. #pragma shader_feature _SPECGLOSSMAP
  58. #pragma shader_feature ___ _DETAIL_MULX2
  59. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  60. #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
  61. #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
  62. #pragma shader_feature _PARALLAXMAP
  63. #pragma multi_compile_fwdbase
  64. #pragma multi_compile_fog
  65. #pragma multi_compile_instancing
  66. #pragma vertex vertBase
  67. #pragma fragment fragBase
  68. #include "UnityStandardCoreForward.cginc"
  69. ENDCG
  70. }
  71. // ------------------------------------------------------------------
  72. // Additive forward pass (one light per pass)
  73. Pass
  74. {
  75. Name "FORWARD_DELTA"
  76. Tags { "LightMode" = "ForwardAdd" }
  77. Blend [_SrcBlend] One
  78. Fog { Color (0,0,0,0) } // in additive pass fog should be black
  79. ZWrite Off
  80. ZTest LEqual
  81. Cull Off
  82. CGPROGRAM
  83. #pragma target 3.0
  84. // -------------------------------------
  85. #pragma shader_feature _NORMALMAP
  86. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  87. #pragma shader_feature _SPECGLOSSMAP
  88. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  89. #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
  90. #pragma shader_feature ___ _DETAIL_MULX2
  91. #pragma shader_feature _PARALLAXMAP
  92. #pragma multi_compile_fwdadd_fullshadows
  93. #pragma multi_compile_fog
  94. #pragma vertex vertAdd
  95. #pragma fragment fragAdd
  96. #include "UnityStandardCoreForward.cginc"
  97. ENDCG
  98. }
  99. // ------------------------------------------------------------------
  100. // Shadow rendering pass
  101. Pass {
  102. Name "ShadowCaster"
  103. Tags { "LightMode" = "ShadowCaster" }
  104. ZWrite On ZTest LEqual
  105. CGPROGRAM
  106. #pragma target 3.0
  107. // -------------------------------------
  108. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  109. #pragma shader_feature _SPECGLOSSMAP
  110. #pragma shader_feature _PARALLAXMAP
  111. #pragma multi_compile_shadowcaster
  112. #pragma multi_compile_instancing
  113. #pragma vertex vertShadowCaster
  114. #pragma fragment fragShadowCaster
  115. #include "UnityStandardShadow.cginc"
  116. ENDCG
  117. }
  118. // ------------------------------------------------------------------
  119. // Deferred pass
  120. Pass
  121. {
  122. Name "DEFERRED"
  123. Tags { "LightMode" = "Deferred" }
  124. CGPROGRAM
  125. #pragma target 3.0
  126. #pragma exclude_renderers nomrt
  127. // -------------------------------------
  128. #pragma shader_feature _NORMALMAP
  129. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  130. #pragma shader_feature _EMISSION
  131. #pragma shader_feature _SPECGLOSSMAP
  132. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  133. #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
  134. #pragma shader_feature ___ _DETAIL_MULX2
  135. #pragma shader_feature _PARALLAXMAP
  136. #pragma multi_compile_prepassfinal
  137. #pragma multi_compile_instancing
  138. #pragma vertex vertDeferred
  139. #pragma fragment fragDeferred
  140. #include "UnityStandardCore.cginc"
  141. ENDCG
  142. }
  143. // ------------------------------------------------------------------
  144. // Extracts information for lightmapping, GI (emission, albedo, ...)
  145. // This pass it not used during regular rendering.
  146. Pass
  147. {
  148. Name "META"
  149. Tags { "LightMode"="Meta" }
  150. Cull Off
  151. CGPROGRAM
  152. #pragma vertex vert_meta
  153. #pragma fragment frag_meta
  154. #pragma shader_feature _EMISSION
  155. #pragma shader_feature _SPECGLOSSMAP
  156. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  157. #pragma shader_feature ___ _DETAIL_MULX2
  158. #pragma shader_feature EDITOR_VISUALIZATION
  159. #include "UnityStandardMeta.cginc"
  160. ENDCG
  161. }
  162. }
  163. SubShader
  164. {
  165. Tags { "RenderType"="Opaque" "PerformanceChecks"="False" }
  166. LOD 150
  167. // ------------------------------------------------------------------
  168. // Base forward pass (directional light, emission, lightmaps, ...)
  169. Pass
  170. {
  171. Name "FORWARD"
  172. Tags { "LightMode" = "ForwardBase" }
  173. Blend [_SrcBlend] [_DstBlend]
  174. ZWrite [_ZWrite]
  175. CGPROGRAM
  176. #pragma target 2.0
  177. #pragma shader_feature _NORMALMAP
  178. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  179. #pragma shader_feature _EMISSION
  180. #pragma shader_feature _SPECGLOSSMAP
  181. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  182. #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
  183. #pragma shader_feature _ _GLOSSYREFLECTIONS_OFF
  184. #pragma shader_feature ___ _DETAIL_MULX2
  185. // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
  186. #pragma skip_variants SHADOWS_SOFT DYNAMICLIGHTMAP_ON DIRLIGHTMAP_COMBINED
  187. #pragma multi_compile_fwdbase
  188. #pragma multi_compile_fog
  189. #pragma vertex vertBase
  190. #pragma fragment fragBase
  191. #include "UnityStandardCoreForward.cginc"
  192. ENDCG
  193. }
  194. // ------------------------------------------------------------------
  195. // Additive forward pass (one light per pass)
  196. Pass
  197. {
  198. Name "FORWARD_DELTA"
  199. Tags { "LightMode" = "ForwardAdd" }
  200. Blend [_SrcBlend] One
  201. Fog { Color (0,0,0,0) } // in additive pass fog should be black
  202. ZWrite Off
  203. ZTest LEqual
  204. CGPROGRAM
  205. #pragma target 2.0
  206. #pragma shader_feature _NORMALMAP
  207. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  208. #pragma shader_feature _SPECGLOSSMAP
  209. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  210. #pragma shader_feature _ _SPECULARHIGHLIGHTS_OFF
  211. #pragma shader_feature ___ _DETAIL_MULX2
  212. // SM2.0: NOT SUPPORTED shader_feature _PARALLAXMAP
  213. #pragma skip_variants SHADOWS_SOFT
  214. #pragma multi_compile_fwdadd_fullshadows
  215. #pragma multi_compile_fog
  216. #pragma vertex vertAdd
  217. #pragma fragment fragAdd
  218. #include "UnityStandardCoreForward.cginc"
  219. ENDCG
  220. }
  221. // ------------------------------------------------------------------
  222. // Shadow rendering pass
  223. Pass {
  224. Name "ShadowCaster"
  225. Tags { "LightMode" = "ShadowCaster" }
  226. ZWrite On ZTest LEqual
  227. CGPROGRAM
  228. #pragma target 2.0
  229. #pragma shader_feature _ _ALPHATEST_ON _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON
  230. #pragma shader_feature _SPECGLOSSMAP
  231. #pragma skip_variants SHADOWS_SOFT
  232. #pragma multi_compile_shadowcaster
  233. #pragma vertex vertShadowCaster
  234. #pragma fragment fragShadowCaster
  235. #include "UnityStandardShadow.cginc"
  236. ENDCG
  237. }
  238. // ------------------------------------------------------------------
  239. // Extracts information for lightmapping, GI (emission, albedo, ...)
  240. // This pass it not used during regular rendering.
  241. Pass
  242. {
  243. Name "META"
  244. Tags { "LightMode"="Meta" }
  245. Cull Off
  246. CGPROGRAM
  247. #pragma vertex vert_meta
  248. #pragma fragment frag_meta
  249. #pragma shader_feature _EMISSION
  250. #pragma shader_feature _SPECGLOSSMAP
  251. #pragma shader_feature _ _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
  252. #pragma shader_feature ___ _DETAIL_MULX2
  253. #pragma shader_feature EDITOR_VISUALIZATION
  254. #include "UnityStandardMeta.cginc"
  255. ENDCG
  256. }
  257. }
  258. FallBack "VertexLit"
  259. CustomEditor "StandardShaderGUI"
  260. }