标签:style blog http color strong 2014
原创文章如需转载请注明:转载自 脱莫柔Unity3D学习之旅 QQ群:【119706192】 本文链接地址: 灰度shader
废话不多说,直接图解流程:
打开NGUI自带的shader:(Unlit - Transparent Colored)
将代码A:
fixed4 frag (v2f i) : COLOR
{
fixed4 col = tex2D(_MainTex, i.texcoord) * i.color;
return col;
}改为代码B:
fixed4 frag (v2f i) : COLOR
{
fixed4 col;
if (i.color.r < 0.001)
{
col = tex2D(_MainTex, i.texcoord);
float grey = dot(col.rgb, float3(0.299, 0.587, 0.114));
col.rgb = float3(grey, grey, grey);
col.a = i.color.a;
}
else
{
col = tex2D(_MainTex, i.texcoord) * i.color;
}
return col;
}
Unity3D 灰度shader(改编自NGUI),布布扣,bubuko.com
标签:style blog http color strong 2014
原文地址:http://www.cnblogs.com/mengfanrong/p/3816927.html