Spine-SkeletonGraphic-Outline.shader 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Outline shader variant of "Spine/SkeletonGraphic"
  2. Shader "Spine/Outline/SkeletonGraphic"
  3. {
  4. Properties
  5. {
  6. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  7. [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
  8. [Toggle(_CANVAS_GROUP_COMPATIBLE)] _CanvasGroupCompatible("CanvasGroup Compatible", Int) = 0
  9. _Color ("Tint", Color) = (1,1,1,1)
  10. [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp ("Stencil Comparison", Float) = 8
  11. [HideInInspector] _Stencil ("Stencil ID", Float) = 0
  12. [HideInInspector][Enum(UnityEngine.Rendering.StencilOp)] _StencilOp ("Stencil Operation", Float) = 0
  13. [HideInInspector] _StencilWriteMask ("Stencil Write Mask", Float) = 255
  14. [HideInInspector] _StencilReadMask ("Stencil Read Mask", Float) = 255
  15. [HideInInspector] _ColorMask ("Color Mask", Float) = 15
  16. [Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
  17. // Outline properties are drawn via custom editor.
  18. [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
  19. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  20. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  21. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  22. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  23. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  24. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  25. }
  26. SubShader
  27. {
  28. Tags
  29. {
  30. "Queue"="Transparent"
  31. "IgnoreProjector"="True"
  32. "RenderType"="Transparent"
  33. "PreviewType"="Plane"
  34. "CanUseSpriteAtlas"="True"
  35. }
  36. Stencil
  37. {
  38. Ref [_Stencil]
  39. Comp [_StencilComp]
  40. Pass [_StencilOp]
  41. ReadMask [_StencilReadMask]
  42. WriteMask [_StencilWriteMask]
  43. }
  44. Cull Off
  45. Lighting Off
  46. ZWrite Off
  47. ZTest [unity_GUIZTestMode]
  48. Fog { Mode Off }
  49. Blend One OneMinusSrcAlpha
  50. ColorMask [_ColorMask]
  51. Pass {
  52. Name "Outline"
  53. CGPROGRAM
  54. #pragma vertex vertOutlineGraphic
  55. #pragma fragment fragOutline
  56. #define SKELETON_GRAPHIC
  57. #pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
  58. #include "../CGIncludes/Spine-Outline-Pass.cginc"
  59. ENDCG
  60. }
  61. UsePass "Spine/SkeletonGraphic/NORMAL"
  62. }
  63. FallBack "Spine/SkeletonGraphic"
  64. CustomEditor "SpineShaderWithOutlineGUI"
  65. }