SpriteBitMask.shader 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. Shader "com.unity3d.animation/SpriteBitmask"
  2. {
  3. Properties
  4. {
  5. _MainTex("Sprite Texture", 2D) = "white" {}
  6. }
  7. SubShader
  8. {
  9. Tags
  10. {
  11. "Queue" = "Transparent"
  12. "IgnoreProjector" = "True"
  13. "RenderType" = "Opaque"
  14. "PreviewType" = "Plane"
  15. }
  16. Cull Off
  17. Lighting Off
  18. ZWrite Off
  19. Blend Off
  20. ColorMask A
  21. Pass
  22. {
  23. CGPROGRAM
  24. #pragma vertex vert
  25. #pragma fragment frag
  26. #include "UnityCG.cginc"
  27. struct appdata_t
  28. {
  29. float4 vertex : POSITION;
  30. float4 color : COLOR;
  31. float2 texcoord : TEXCOORD0;
  32. };
  33. struct v2f
  34. {
  35. float4 vertex : SV_POSITION;
  36. fixed4 color : COLOR;
  37. float2 texcoord : TEXCOORD0;
  38. };
  39. sampler2D _MainTex;
  40. v2f vert(appdata_t IN)
  41. {
  42. v2f OUT;
  43. OUT.vertex = UnityObjectToClipPos(IN.vertex);
  44. OUT.texcoord = IN.texcoord;
  45. OUT.color = IN.color;
  46. return OUT;
  47. }
  48. fixed4 SampleSpriteTexture(float2 uv)
  49. {
  50. fixed4 color = tex2D(_MainTex, uv);
  51. return color;
  52. }
  53. fixed4 frag(v2f IN) : SV_Target
  54. {
  55. fixed4 c = SampleSpriteTexture(IN.texcoord);
  56. return c;
  57. }
  58. ENDCG
  59. }
  60. }
  61. }