Spine-Skeleton-Fill-Outline.shader 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Outline shader variant of "Spine/Skeleton Fill"
  2. Shader "Spine/Outline/Skeleton Fill" {
  3. Properties {
  4. _FillColor ("FillColor", Color) = (1,1,1,1)
  5. _FillPhase ("FillPhase", Range(0, 1)) = 0
  6. [NoScaleOffset] _MainTex ("MainTex", 2D) = "white" {}
  7. _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
  8. [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
  9. [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
  10. [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
  11. // Outline properties are drawn via custom editor.
  12. [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
  13. [HideInInspector][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
  14. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  15. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  16. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  17. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  18. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  19. [HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
  20. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  21. }
  22. SubShader {
  23. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
  24. Blend One OneMinusSrcAlpha
  25. Cull Off
  26. ZWrite Off
  27. Lighting Off
  28. Stencil {
  29. Ref[_StencilRef]
  30. Comp[_StencilComp]
  31. Pass Keep
  32. }
  33. UsePass "Spine/Outline/Skeleton/OUTLINE"
  34. UsePass "Spine/Skeleton Fill/NORMAL"
  35. UsePass "Spine/Skeleton Fill/CASTER"
  36. }
  37. FallBack "Spine/Skeleton Fill"
  38. CustomEditor "SpineShaderWithOutlineGUI"
  39. }