Advertisement
Guest User

ripple

a guest
Nov 21st, 2014
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.36 KB | None | 0 0
  1. Shader "Sprites/Ripple"
  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 One OneMinusSrcAlpha
  26.  
  27.         Pass
  28.         {
  29.         CGPROGRAM
  30.             #pragma vertex vert
  31.             #pragma fragment frag
  32.             #pragma multi_compile DUMMY PIXELSNAP_ON
  33.             #include "UnityCG.cginc"
  34.            
  35.             struct appdata_t
  36.             {
  37.                 float4 vertex   : POSITION;
  38.                 float4 color    : COLOR;
  39.                 float2 texcoord : TEXCOORD0;
  40.             };
  41.  
  42.             struct v2f
  43.             {
  44.                 float4 vertex   : SV_POSITION;
  45.                 fixed4 color    : COLOR;
  46.                 half2 texcoord  : TEXCOORD0;
  47.             };
  48.            
  49.             fixed4 _Color;
  50.  
  51.             v2f vert(appdata_t IN)
  52.             {
  53.                 v2f OUT;
  54.                 OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
  55.                 OUT.texcoord = IN.texcoord;
  56.                 OUT.color = IN.color * _Color;
  57.                 #ifdef PIXELSNAP_ON
  58.                 OUT.vertex = UnityPixelSnap (OUT.vertex);
  59.                 #endif
  60.  
  61.                 return OUT;
  62.             }
  63.  
  64.             sampler2D _MainTex;
  65.  
  66.             fixed4 frag(v2f IN) : SV_Target
  67.             {
  68.                 fixed4 c = tex2D(_MainTex, IN.texcoord) * IN.color;
  69.                 c.rgb *= c.a;
  70.                 return c;
  71.             }
  72.         ENDCG
  73.         }
  74.     }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement