Spine-Special-Skeleton-Ghost.shader 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. // - Unlit + no shadow
  2. // - Premultiplied Alpha Blending (One OneMinusSrcAlpha)
  3. // - Double-sided, no depth
  4. Shader "Spine/Special/SkeletonGhost" {
  5. Properties {
  6. _Color ("Main Color", Color) = (1,1,1,1)
  7. [NoScaleOffset] _MainTex ("Base (RGB) Alpha (A)", 2D) = "white" {}
  8. _TextureFade ("Texture Fade Out", Range(0,1)) = 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. }
  12. SubShader {
  13. Tags {
  14. "Queue"="Transparent"
  15. "IgnoreProjector"="False"
  16. "RenderType"="Transparent"
  17. }
  18. Fog { Mode Off }
  19. Blend One OneMinusSrcAlpha
  20. ZWrite Off
  21. Cull Off
  22. Stencil {
  23. Ref[_StencilRef]
  24. Comp[_StencilComp]
  25. Pass Keep
  26. }
  27. Pass {
  28. CGPROGRAM
  29. #pragma vertex vert
  30. #pragma fragment frag
  31. #include "UnityCG.cginc"
  32. sampler2D _MainTex;
  33. fixed4 _Color;
  34. fixed _TextureFade;
  35. struct VertexInput {
  36. float4 vertex : POSITION;
  37. float2 uv : TEXCOORD0;
  38. float4 color : COLOR;
  39. };
  40. struct VertexOutput {
  41. float4 pos : SV_POSITION;
  42. float2 uv : TEXCOORD0;
  43. float4 color : COLOR;
  44. };
  45. VertexOutput vert (VertexInput v) {
  46. VertexOutput o;
  47. o.pos = UnityObjectToClipPos(v.vertex);
  48. o.uv = v.uv;
  49. o.color = v.color;
  50. return o;
  51. }
  52. fixed4 frag (VertexOutput i) : SV_Target {
  53. fixed4 tc = tex2D(_MainTex, i.uv);
  54. tc = fixed4(max(_TextureFade, tc.r), max(_TextureFade, tc.g), max(_TextureFade, tc.b), tc.a);
  55. return tc * ((i.color * _Color) * tc.a);
  56. }
  57. ENDCG
  58. }
  59. }
  60. }