Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fixed4 frag(v2f IN) : SV_Target
  2.            {
  3.                fixed4 c = tex2D (_MainTex, IN.texcoord);
  4.                clip(c.a-1);
  5.  
  6.                // Get the neighbouring four pixels.
  7.                fixed4 pixelUp = tex2D(_MainTex, IN.texcoord + fixed2(0, _MainTex_TexelSize.y));
  8.                fixed4 pixelDown = tex2D(_MainTex, IN.texcoord - fixed2(0, _MainTex_TexelSize.y));
  9.                fixed4 pixelRight = tex2D(_MainTex, IN.texcoord + fixed2(_MainTex_TexelSize.x, 0));
  10.                fixed4 pixelLeft = tex2D(_MainTex, IN.texcoord - fixed2(_MainTex_TexelSize.x, 0));
  11.  
  12.                fixed noAlpha = pixelUp.a * pixelDown.a * pixelRight.a * pixelLeft.a;
  13.                fixed anyAlpha = 1 - noAlpha;
  14.                c = c * IN.color.a + IN.color;
  15.                return c * noAlpha + _Outline * anyAlpha;
  16.            }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement