Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Sprite/Palettized"
- {
- Properties
- {
- _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
- _GColor ("Color (green channel)", Color) = (0,1,0,1)
- _BColor ("Color (blue channel)", Color) = (0,0,1,1)
- }
- SubShader
- {
- Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
- ZWrite Off Lighting Off Cull Off Fog { Mode Off } Blend SrcAlpha OneMinusSrcAlpha
- LOD 110
- Pass
- {
- CGPROGRAM
- #pragma vertex vert_vct
- #pragma fragment frag_mult
- #pragma fragmentoption ARB_precision_hint_fastest
- #include "UnityCG.cginc"
- sampler2D _MainTex;
- float4 _MainTex_ST;
- float4 _GColor;
- float4 _BColor;
- struct vin_vct
- {
- float4 vertex : POSITION;
- float4 color : COLOR;
- float2 texcoord : TEXCOORD0;
- };
- struct v2f_vct
- {
- float4 vertex : POSITION;
- fixed4 color : COLOR;
- float2 texcoord : TEXCOORD0;
- };
- v2f_vct vert_vct(vin_vct v)
- {
- v2f_vct o;
- o.vertex = mul(UNITY_MATRIX_MVP, v.vertex);
- o.color = v.color;
- o.texcoord = v.texcoord;
- return o;
- }
- half4 frag_mult(v2f_vct i) : COLOR
- {
- half4 profile = tex2D(_MainTex, i.texcoord);
- half4 col = i.color * profile.r;
- col += _GColor * profile.g;
- col += _BColor * profile.b;
- col.a = i.color.a * profile.a;
- return col;
- }
- ENDCG
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment