Spine-Skeleton-OutlineOnly-ZWrite.shader 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. Shader "Spine/Outline/OutlineOnly-ZWrite" {
  2. Properties {
  3. _Cutoff ("Depth alpha cutoff", Range(0,1)) = 0.1
  4. _ZWriteOffset ("Depth offset", Range(0,1)) = 0.01
  5. [NoScaleOffset] _MainTex ("Main Texture", 2D) = "black" {}
  6. [Toggle(_STRAIGHT_ALPHA_INPUT)] _StraightAlphaInput("Straight Alpha Texture", Int) = 0
  7. [HideInInspector] _StencilRef("Stencil Reference", Float) = 1.0
  8. [HideInInspector][Enum(UnityEngine.Rendering.CompareFunction)] _StencilComp("Stencil Comparison", Float) = 8 // Set to Always as default
  9. // Outline properties are drawn via custom editor.
  10. [HideInInspector] _OutlineWidth("Outline Width", Range(0,8)) = 3.0
  11. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  12. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  13. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  14. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  15. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  16. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  17. }
  18. SubShader {
  19. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
  20. Fog { Mode Off }
  21. Cull Off
  22. ZWrite Off
  23. Blend One OneMinusSrcAlpha
  24. Lighting Off
  25. Stencil {
  26. Ref[_StencilRef]
  27. Comp[_StencilComp]
  28. Pass Keep
  29. }
  30. Pass
  31. {
  32. Name "DepthOnly"
  33. ZWrite On
  34. ColorMask 0
  35. Cull Off
  36. CGPROGRAM
  37. #pragma vertex DepthOnlyVertex
  38. #pragma fragment DepthOnlyFragment
  39. #include "../CGIncludes/Spine-DepthOnlyPass.cginc"
  40. ENDCG
  41. }
  42. Pass {
  43. Name "Outline"
  44. CGPROGRAM
  45. #pragma vertex vertOutline
  46. #pragma fragment fragOutline
  47. #pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
  48. #include "CGIncludes/Spine-Outline-Pass.cginc"
  49. ENDCG
  50. }
  51. }
  52. FallBack "Spine/Skeleton"
  53. CustomEditor "SpineShaderWithOutlineGUI"
  54. }