源战役客户端
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.5 KiB

  1. // Spine/Skeleton Tint Black
  2. // - Two color tint
  3. // - UV2 and UV3 as Black Tint color.
  4. // - Final black tint is (UV black data and _Black/"Black Point")
  5. // - unlit
  6. // - Premultiplied alpha blending
  7. // - No depth, no backface culling, no fog.
  8. Shader "Spine/Skeleton Tint Black" {
  9. Properties {
  10. _Color ("Tint Color", Color) = (1,1,1,1)
  11. _Black ("Black Point", Color) = (0,0,0,0)
  12. [NoScaleOffset] _MainTex ("MainTex", 2D) = "black" {}
  13. _Cutoff ("Shadow alpha cutoff", Range(0,1)) = 0.1
  14. }
  15. SubShader {
  16. Tags { "Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent" }
  17. LOD 100
  18. Fog { Mode Off }
  19. Cull Off
  20. ZWrite Off
  21. Blend One OneMinusSrcAlpha
  22. Lighting Off
  23. Pass {
  24. CGPROGRAM
  25. #pragma vertex vert
  26. #pragma fragment frag
  27. #include "UnityCG.cginc"
  28. sampler2D _MainTex;
  29. float4 _Color;
  30. float4 _Black;
  31. struct VertexInput {
  32. float4 vertex : POSITION;
  33. float2 uv : TEXCOORD0;
  34. float2 uv1 : TEXCOORD1;
  35. float2 uv2 : TEXCOORD2;
  36. float4 vertexColor : COLOR;
  37. };
  38. struct VertexOutput {
  39. float4 pos : SV_POSITION;
  40. float2 uv : TEXCOORD0;
  41. float2 uv1 : TEXCOORD1;
  42. float2 uv2 : TEXCOORD2;
  43. float4 vertexColor : COLOR;
  44. };
  45. VertexOutput vert (VertexInput v) {
  46. VertexOutput o;
  47. o.pos = UnityObjectToClipPos(v.vertex); // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  48. o.uv = v.uv;
  49. o.vertexColor = v.vertexColor * float4(_Color.rgb * _Color.a, _Color.a); // Combine a PMA version of _Color with vertexColor.
  50. o.uv1 = v.uv1;
  51. o.uv2 = v.uv2;
  52. return o;
  53. }
  54. float4 frag (VertexOutput i) : COLOR {
  55. float4 texColor = tex2D(_MainTex, i.uv);
  56. return (texColor * i.vertexColor) + float4(((1-texColor.rgb) * (_Black.rgb + float3(i.uv1.r, i.uv1.g, i.uv2.r)) * texColor.a*_Color.a*i.vertexColor.a), 0);
  57. }
  58. ENDCG
  59. }
  60. Pass {
  61. Name "Caster"
  62. Tags { "LightMode"="ShadowCaster" }
  63. Offset 1, 1
  64. ZWrite On
  65. ZTest LEqual
  66. CGPROGRAM
  67. #pragma vertex vert
  68. #pragma fragment frag
  69. #pragma multi_compile_shadowcaster
  70. #pragma fragmentoption ARB_precision_hint_fastest
  71. #include "UnityCG.cginc"
  72. sampler2D _MainTex;
  73. fixed _Cutoff;
  74. struct v2f {
  75. V2F_SHADOW_CASTER;
  76. float2 uv : TEXCOORD1;
  77. };
  78. v2f vert (appdata_base v) {
  79. v2f o;
  80. TRANSFER_SHADOW_CASTER(o)
  81. o.uv = v.texcoord;
  82. return o;
  83. }
  84. float4 frag (v2f i) : COLOR {
  85. fixed4 texcol = tex2D(_MainTex, i.uv);
  86. clip(texcol.a - _Cutoff);
  87. SHADOW_CASTER_FRAGMENT(i)
  88. }
  89. ENDCG
  90. }
  91. }
  92. }