SpritesVertexLit.shader 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. Shader "Spine/Sprite/Vertex Lit"
  2. {
  3. Properties
  4. {
  5. _MainTex ("Main Texture", 2D) = "white" {}
  6. _Color ("Color", Color) = (1,1,1,1)
  7. _BumpScale("Scale", Float) = 1.0
  8. _BumpMap ("Normal Map", 2D) = "bump" {}
  9. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  10. _EmissionColor("Color", Color) = (0,0,0,0)
  11. _EmissionMap("Emission", 2D) = "white" {}
  12. _EmissionPower("Emission Power", Float) = 2.0
  13. _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
  14. _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
  15. [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
  16. _MetallicGlossMap("Metallic", 2D) = "white" {}
  17. _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {}
  18. _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1)
  19. _ZWrite ("Depth Write", Float) = 0.0
  20. _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.0
  21. _ShadowAlphaCutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
  22. _CustomRenderQueue ("Custom Render Queue", Float) = 0.0
  23. _OverlayColor ("Overlay Color", Color) = (0,0,0,0)
  24. _Hue("Hue", Range(-0.5,0.5)) = 0.0
  25. _Saturation("Saturation", Range(0,2)) = 1.0
  26. _Brightness("Brightness", Range(0,2)) = 1.0
  27. _RimPower("Rim Power", Float) = 2.0
  28. _RimColor ("Rim Color", Color) = (1,1,1,1)
  29. _BlendTex ("Blend Texture", 2D) = "white" {}
  30. _BlendAmount ("Blend", Range(0,1)) = 0.0
  31. [HideInInspector] _SrcBlend ("__src", Float) = 1.0
  32. [HideInInspector] _DstBlend ("__dst", Float) = 0.0
  33. [HideInInspector] _RenderQueue ("__queue", Float) = 0.0
  34. [HideInInspector] _Cull ("__cull", Float) = 0.0
  35. [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
  36. [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
  37. // Outline properties are drawn via custom editor.
  38. [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
  39. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  40. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  41. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  42. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  43. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  44. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  45. }
  46. SubShader
  47. {
  48. Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
  49. LOD 150
  50. Stencil {
  51. Ref[_StencilRef]
  52. Comp[_StencilComp]
  53. Pass Keep
  54. }
  55. Pass
  56. {
  57. Name "Vertex"
  58. Tags { "LightMode" = "Vertex" }
  59. Blend [_SrcBlend] [_DstBlend]
  60. ZWrite [_ZWrite]
  61. ZTest LEqual
  62. Cull [_Cull]
  63. Lighting On
  64. CGPROGRAM
  65. #pragma target 3.0
  66. #pragma shader_feature _ _ALPHABLEND_ON _ALPHAPREMULTIPLY_ON _ADDITIVEBLEND _ADDITIVEBLEND_SOFT _MULTIPLYBLEND _MULTIPLYBLEND_X2
  67. #pragma shader_feature _ _FIXED_NORMALS_VIEWSPACE _FIXED_NORMALS_VIEWSPACE_BACKFACE _FIXED_NORMALS_MODELSPACE _FIXED_NORMALS_MODELSPACE_BACKFACE _FIXED_NORMALS_WORLDSPACE
  68. #pragma shader_feature _ _SPECULAR _SPECULAR_GLOSSMAP
  69. #pragma shader_feature _NORMALMAP
  70. #pragma shader_feature _ALPHA_CLIP
  71. #pragma shader_feature _EMISSION
  72. #pragma shader_feature _DIFFUSE_RAMP
  73. #pragma shader_feature _ _FULLRANGE_HARD_RAMP _FULLRANGE_SOFT_RAMP _OLD_HARD_RAMP _OLD_SOFT_RAMP
  74. #pragma shader_feature _COLOR_ADJUST
  75. #pragma shader_feature _RIM_LIGHTING
  76. #pragma shader_feature _TEXTURE_BLEND
  77. #pragma shader_feature _SPHERICAL_HARMONICS
  78. #pragma shader_feature _FOG
  79. #pragma fragmentoption ARB_precision_hint_fastest
  80. #pragma multi_compile_fog
  81. #pragma multi_compile _ PIXELSNAP_ON
  82. #pragma multi_compile _ ETC1_EXTERNAL_ALPHA
  83. #pragma vertex vert
  84. #pragma fragment frag
  85. #include "CGIncludes/SpriteVertexLighting.cginc"
  86. ENDCG
  87. }
  88. Pass
  89. {
  90. Name "ShadowCaster"
  91. Tags { "LightMode"="ShadowCaster" }
  92. Offset 1, 1
  93. Fog { Mode Off }
  94. ZWrite On
  95. ZTest LEqual
  96. Cull Off
  97. Lighting Off
  98. CGPROGRAM
  99. #pragma fragmentoption ARB_precision_hint_fastest
  100. #pragma multi_compile_shadowcaster
  101. #pragma multi_compile _ PIXELSNAP_ON
  102. #pragma multi_compile _ ETC1_EXTERNAL_ALPHA
  103. #pragma vertex vert
  104. #pragma fragment frag
  105. #include "CGIncludes/SpriteShadows.cginc"
  106. ENDCG
  107. }
  108. }
  109. FallBack "Spine/Sprite/Unlit"
  110. CustomEditor "SpineSpriteShaderGUI"
  111. }