SpritesPixelLit-Outline.shader 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
  40. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  41. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  42. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  43. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  44. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  45. [HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
  46. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  47. }
  48. SubShader
  49. {
  50. Tags { "Queue"="Transparent" "RenderType"="Sprite" "AlphaDepth"="False" "CanUseSpriteAtlas"="True" "IgnoreProjector"="True" }
  51. LOD 200
  52. Stencil {
  53. Ref[_StencilRef]
  54. Comp[_StencilComp]
  55. Pass Keep
  56. }
  57. UsePass "Spine/Outline/Skeleton/OUTLINE"
  58. UsePass "Spine/Sprite/Pixel Lit/FORWARD"
  59. UsePass "Spine/Sprite/Pixel Lit/FORWARD_DELTA"
  60. UsePass "Spine/Sprite/Pixel Lit/SHADOWCASTER"
  61. }
  62. FallBack "Spine/Sprite/Pixel Lit"
  63. CustomEditor "SpineSpriteShaderGUI"
  64. }