Advertisement
Guest User

Sprites-MultiplyDouble

a guest
Nov 20th, 2013
1,230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. Shader "Sprites/MultiplyDouble"
  2. {
  3. Properties
  4. {
  5. [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
  6. _Color ("Tint", Color) = (1,1,1,1)
  7. [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0
  8. }
  9.  
  10. SubShader
  11. {
  12. Tags
  13. {
  14. "Queue"="Transparent"
  15. "IgnoreProjector"="True"
  16. "RenderType"="Transparent"
  17. "PreviewType"="Plane"
  18. "CanUseSpriteAtlas"="True"
  19. }
  20.  
  21. Cull Off
  22. Lighting Off
  23. ZWrite Off
  24. Fog { Mode Off }
  25. Blend DstColor SrcColor
  26. ColorMask RGB
  27.  
  28. Pass
  29. {
  30. CGPROGRAM
  31. #pragma vertex vert
  32. #pragma fragment frag
  33. #pragma multi_compile DUMMY PIXELSNAP_ON
  34. #include "UnityCG.cginc"
  35.  
  36. struct appdata_t
  37. {
  38. float4 vertex : POSITION;
  39. float4 color : COLOR;
  40. float2 texcoord : TEXCOORD0;
  41. };
  42.  
  43. struct v2f
  44. {
  45. float4 vertex : SV_POSITION;
  46. fixed4 color : COLOR;
  47. half2 texcoord : TEXCOORD0;
  48. };
  49.  
  50. fixed4 _Color;
  51.  
  52. v2f vert(appdata_t IN)
  53. {
  54. v2f OUT;
  55. OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
  56. OUT.texcoord = IN.texcoord;
  57. OUT.color = IN.color * _Color;
  58. #ifdef PIXELSNAP_ON
  59. OUT.vertex = UnityPixelSnap (OUT.vertex);
  60. #endif
  61.  
  62. return OUT;
  63. }
  64.  
  65. sampler2D _MainTex;
  66.  
  67. fixed4 frag(v2f IN) : COLOR
  68. {
  69. fixed4 col;
  70. fixed4 tex = tex2D(_MainTex, IN.texcoord);
  71. col.rgb = tex.rgb * IN.color.rgb * 2;
  72. col.a = IN.color.a * tex.a;
  73. return lerp(fixed4(0.5f,0.5f,0.5f,0.5f), col, col.a);
  74.  
  75.  
  76. }
  77. ENDCG
  78. }
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement