Spine-Skeleton-OutlineOnly-ZWrite.shader 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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][MaterialToggle(_USE_SCREENSPACE_OUTLINE_WIDTH)] _UseScreenSpaceOutlineWidth("Width in Screen Space", Float) = 0
  12. [HideInInspector] _OutlineColor("Outline Color", Color) = (1,1,0,1)
  13. [HideInInspector] _OutlineReferenceTexWidth("Reference Texture Width", Int) = 1024
  14. [HideInInspector] _ThresholdEnd("Outline Threshold", Range(0,1)) = 0.25
  15. [HideInInspector] _OutlineSmoothness("Outline Smoothness", Range(0,1)) = 1.0
  16. [HideInInspector][MaterialToggle(_USE8NEIGHBOURHOOD_ON)] _Use8Neighbourhood("Sample 8 Neighbours", Float) = 1
  17. [HideInInspector] _OutlineOpaqueAlpha("Opaque Alpha", Range(0,1)) = 1.0
  18. [HideInInspector] _OutlineMipLevel("Outline Mip Level", Range(0,3)) = 0
  19. }
  20. SubShader {
  21. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" "PreviewType"="Plane" }
  22. Fog { Mode Off }
  23. Cull Off
  24. ZWrite Off
  25. Blend One OneMinusSrcAlpha
  26. Lighting Off
  27. Stencil {
  28. Ref[_StencilRef]
  29. Comp[_StencilComp]
  30. Pass Keep
  31. }
  32. Pass
  33. {
  34. Name "DepthOnly"
  35. ZWrite On
  36. ColorMask 0
  37. Cull Off
  38. CGPROGRAM
  39. #pragma vertex DepthOnlyVertex
  40. #pragma fragment DepthOnlyFragment
  41. #include "../CGIncludes/Spine-DepthOnlyPass.cginc"
  42. ENDCG
  43. }
  44. Pass {
  45. Name "Outline"
  46. CGPROGRAM
  47. #pragma vertex vertOutline
  48. #pragma fragment fragOutline
  49. #pragma shader_feature _ _USE8NEIGHBOURHOOD_ON
  50. #pragma shader_feature _ _USE_SCREENSPACE_OUTLINE_WIDTH
  51. #include "CGIncludes/Spine-Outline-Pass.cginc"
  52. ENDCG
  53. }
  54. }
  55. FallBack "Spine/Skeleton"
  56. CustomEditor "SpineShaderWithOutlineGUI"
  57. }