// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
|
|
Shader "Unlit/Gray"
|
{
|
Properties
|
{
|
_Color ("Main Color", Color) = (1,1,1,1)
|
_MainTex ("Base (RGB) Trans (A)", 2D) = "black" {}
|
_Grey ("Grey Value", Float) = 1
|
|
_StencilComp ("Stencil Comparison", Float) = 8
|
_Stencil ("Stencil ID", Float) = 0
|
_StencilOp ("Stencil Operation", Float) = 0
|
_StencilWriteMask ("Stencil Write Mask", Float) = 255
|
_StencilReadMask ("Stencil Read Mask", Float) = 255
|
|
_ColorMask ("Color Mask", Float) = 15
|
|
[Toggle(UNITY_UI_ALPHACLIP)] _UseUIAlphaClip ("Use Alpha Clip", Float) = 0
|
}
|
|
SubShader
|
{
|
LOD 100
|
|
Tags
|
{
|
"Queue" = "Transparent"
|
"IgnoreProjector" = "True"
|
"RenderType" = "Transparent"
|
"PreviewType"="Plane"
|
"CanUseSpriteAtlas"="True"
|
}
|
|
Stencil
|
{
|
Ref [_Stencil]
|
Comp [_StencilComp]
|
Pass [_StencilOp]
|
ReadMask [_StencilReadMask]
|
WriteMask [_StencilWriteMask]
|
}
|
|
Cull Off
|
Lighting Off
|
ZWrite Off
|
ZTest [unity_GUIZTestMode]
|
Blend SrcAlpha OneMinusSrcAlpha
|
ColorMask [_ColorMask]
|
|
Pass
|
{
|
CGPROGRAM
|
#pragma vertex vert
|
#pragma fragment frag
|
|
#include "UnityCG.cginc"
|
|
|
struct appdata_t
|
{
|
float4 vertex : POSITION;
|
float2 texcoord : TEXCOORD0;
|
fixed4 color : COLOR;
|
};
|
|
struct v2f
|
{
|
float4 vertex : SV_POSITION;
|
half2 texcoord : TEXCOORD0;
|
fixed4 color : COLOR;
|
fixed4 gray :TEXCOORD1;
|
};
|
|
sampler2D _MainTex;
|
float4 _MainTex_ST;
|
|
v2f vert (appdata_t v)
|
{
|
v2f o;
|
o.vertex = UnityObjectToClipPos(v.vertex);
|
o.texcoord = v.texcoord;
|
o.color = v.color;
|
o.gray = dot(v.color,fixed4(1,1,1,0));
|
return o;
|
}
|
|
fixed4 frag (v2f i) : COLOR
|
{
|
fixed4 col = tex2D(_MainTex, i.texcoord);
|
col.rgb = dot(col.rgb,fixed3(.222,.707,.071));
|
return col;
|
}
|
ENDCG
|
}
|
}
|
}
|