NGUI图片变灰Shader修改
来源:互联网 发布:python cgi库 编辑:程序博客网 时间:2024/04/29 10:46
NGUI是强大的插件,但是在UI设计中,很多时候设计者把不可点击的按钮或者图片希望用灰白颜色表示,遗憾的NGUI没有直接提供这样的功能,但是可以通过修改NGUI的几个shader达到这样的效果,我们指定一旦把组件的颜色设置为黑色时,就是默认变灰的效果。以下代码是Shader "Unlit/Transparent Colored"的片段函数修改方法。类似的Transparent Colored的其他几个shader也可以如此修改。如果大家还要更好的方案欢迎讨论。
fixed4 frag (v2f i) : COLOR
{
fixed4 col;
if(i.color.r < 0.01 && i.color.g < 0.01 && i.color.b < 0.01 )
{
col = tex2D(_MainTex, i.texcoord);
float grey = dot(col.rgb, float3(0.299, 0.587, 0.114));
col.rgb = float3(grey, grey, grey);
}
else
{
col = tex2D(_MainTex, i.texcoord)* i.color;
}
return col;
}
fixed4 frag (v2f i) : COLOR
{
fixed4 col;
if(i.color.r < 0.01 && i.color.g < 0.01 && i.color.b < 0.01 )
{
col = tex2D(_MainTex, i.texcoord);
float grey = dot(col.rgb, float3(0.299, 0.587, 0.114));
col.rgb = float3(grey, grey, grey);
}
else
{
col = tex2D(_MainTex, i.texcoord)* i.color;
}
return col;
}
0 0
- NGUI图片变灰Shader修改
- ngui 图片变灰Shader
- 模型或NGUI图片变灰shader
- NGUI sprite 变灰shader
- 图片变灰shader mark
- NGUI 通过shader设置图片置灰效果
- unity shader 彩图变灰
- opengl shader 图片变灰及还原,使用自己的shader崩溃问题
- Swing图片变灰
- WPF 图片变灰
- css 图片变灰
- 图片变灰
- Unity 图片变灰&修改UIWidget颜色不起作用的问题
- NGUI 置灰的4歌shader
- Cocos2dx 使用Shader使精灵变灰
- CSS使图片变灰
- WM图片变灰处理
- cocos2d-x 图片变灰
- benchmarksql4.1.0测试情况记录
- Background Modes in iOS Tutorial
- 运行Hadoop示例程序WordCount
- Ng在coursera上的机器学习公开课——最终总结
- 《结网——互联网产品经理改变世界》读后书摘
- NGUI图片变灰Shader修改
- 为你的SQLite开发选择一款比较好的工具
- 欢迎使用CSDN-markdown编辑器
- Android 第三方开源强大的图片下载项目ImageLoader的使用方法
- Android strings.xml 显示特殊符号
- 数据挖掘领域顶级会议期刊及其分析
- iOS7 edgesForExtendedLayout
- 作业3.23
- 新改进了系列软件版本!