Unity3d 图片Image置灰shader

置灰公式:    value=color.r x 0.299 +color.g x 0.587 + color.b * 0.114

color.rgb = lerp(color.rgb, Luminance(color.rgb), _Factor);

color.rgb = dot(color.rgb, fixed3(0.299, 0.587, 0.114));

Shader "UI/Custom/UIGray"
{
	Properties
	{
		[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
		_Color("Tint", Color) = (1,1,1,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
		{
			Tags
			{
				"Queue" = "Transparent"
				"IgnoreProj

你可能感兴趣的:(Unity+Shader,unity)