SHARE
TWEET

Untitled

a guest Nov 19th, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  2.  
  3. Shader "Hidden/PaletteSwapLookup"
  4. {
  5.     Properties
  6.     {
  7.         _MainTex ("Texture", 2D) = "white" {}
  8.         _PaletteTex("Texture", 2D) = "white" {}
  9.     }
  10.     SubShader
  11.     {
  12.         Cull Off ZWrite Off ZTest Always
  13.  
  14.         Pass
  15.         {
  16.             CGPROGRAM
  17.             #pragma vertex vert
  18.             #pragma fragment frag
  19.            
  20.             #include "UnityCG.cginc"
  21.  
  22.             struct appdata
  23.             {
  24.                 float4 vertex : POSITION;
  25.                 float2 uv : TEXCOORD0;
  26.             };
  27.  
  28.             struct v2f
  29.             {
  30.                 float4 vertex : SV_POSITION;
  31.                 float2 uv : TEXCOORD0;
  32.             };
  33.  
  34.             v2f vert (appdata v)
  35.             {
  36.                 v2f o;
  37.                 o.vertex = UnityObjectToClipPos(v.vertex);
  38.                 o.uv = v.uv;
  39.                 return o;
  40.             }
  41.            
  42.             sampler2D _MainTex;
  43.             sampler2D _PaletteTex;
  44.  
  45.             fixed4 frag (v2f i) : SV_Target
  46.             {
  47.                 float x = tex2D(_MainTex, i.uv).r;
  48.                 return tex2D(_PaletteTex, float2(x, 0));
  49.             }
  50.  
  51.             ENDCG
  52.         }
  53.     }
  54. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top