SpritesPixelLit-Outline.shader 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. // Outline shader variant of "Spine/Sprite/Pixel Lit"
  2. Shader "Spine/Outline/Sprite/Pixel Lit"
  3. {
  4. Properties
  5. {
  6. _MainTex ("Main Texture", 2D) = "white" {}
  7. _Color ("Color", Color) = (1,1,1,1)
  8. _BumpScale("Scale", Float) = 1.0
  9. _BumpMap ("Normal Map", 2D) = "bump" {}
  10. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  11. _EmissionColor("Color", Color) = (0,0,0,0)
  12. _EmissionMap("Emission", 2D) = "white" {}
  13. _EmissionPower("Emission Power", Float) = 2.0
  14. _Glossiness("Smoothness", Range(0.0, 1.0)) = 0.5
  15. _GlossMapScale("Smoothness Scale", Range(0.0, 1.0)) = 1.0
  16. [Gamma] _Metallic("Metallic", Range(0.0, 1.0)) = 0.0
  17. _MetallicGlossMap("Metallic", 2D) = "white" {}
  18. _DiffuseRamp ("Diffuse Ramp Texture", 2D) = "gray" {}
  19. _FixedNormal ("Fixed Normal", Vector) = (0,0,1,1)
  20. _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.5
  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 200
  50. Stencil {
  51. Ref[_StencilRef]
  52. Comp[_StencilComp]
  53. Pass Keep
  54. }
  55. UsePass "Spine/Outline/Skeleton/OUTLINE"
  56. UsePass "Spine/Sprite/Pixel Lit/FORWARD"
  57. UsePass "Spine/Sprite/Pixel Lit/FORWARD_DELTA"
  58. UsePass "Spine/Sprite/Pixel Lit/SHADOWCASTER"
  59. }
  60. FallBack "Spine/Sprite/Pixel Lit"
  61. CustomEditor "SpineSpriteShaderGUI"
  62. }