Advertisement
tonynogo

Demo 83 - Invert color

Jul 6th, 2017
7,030
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Shader "Custom/2D/InvertColor"
  2. {
  3.     Properties
  4.     {
  5.         _MainTex ("Texture", 2D) = "white" {}
  6.         _Threshold ("Threshold", Range(0., 1.)) = 0
  7.     }
  8.     SubShader
  9.     {
  10.         Tags {"Queue"="Transparent" "RenderType"="Transparent"}
  11.         Cull Off
  12.         Blend SrcAlpha OneMinusSrcAlpha
  13.  
  14.         Pass
  15.         {
  16.             CGPROGRAM
  17.             #pragma vertex vert_img
  18.             #pragma fragment frag
  19.            
  20.             #include "UnityCG.cginc"
  21.  
  22.             sampler2D _MainTex;
  23.             float _Threshold;
  24.  
  25.             fixed4 frag (v2f_img i) : SV_Target
  26.             {
  27.                 fixed4 col = tex2D(_MainTex, i.uv);
  28.                 col.rgb = abs(_Threshold - col.rgb);
  29.                 return col;
  30.             }
  31.             ENDCG
  32.         }
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement