1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| #ifndef UI_CG #define UI_CG inline half4 GreyUI(sampler2D _MainTex,sampler2D _AlphaTex,half2 texUV,half4 vColor) { half4 alphaColor = tex2D(_AlphaTex,texUV); half4 mainColor = tex2D(_MainTex, texUV); mainColor.a *= alphaColor.r;
float t1 = step(0.001,vColor.r - 0.49); float t2 = step(0.001,0.51 - vColor.r); half tmp = t1 * t2; //half tmp = step(0.001,vColor.r - 0.49) * step(0.001,0.51 - vColor.r); half grey = dot(mainColor.rgb, half3(0.299, 0.587, 0.114)); mainColor = tmp * half4(grey,grey,grey,mainColor.a) + (1 - tmp) * mainColor * vColor; return mainColor; } #endif
|