验证中...
码云 Gitee IDE 全新上线——支持 Git 管理的轻量在线编码环境
Gray.shader
原始数据 复制代码
Shader "Custom/Gray"
{
Properties
{
_MainTex ("Texture", 2D) = "white" {}
_Alpha ("Alpha", Range(0, 1)) = 1
_Contrast ("Contrast", Range(0, 2)) = 1
}
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 200
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf Lambert
sampler2D _MainTex;
half _Alpha;
fixed _Contrast;
struct Input
{
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o)
{
half4 c = tex2D (_MainTex, IN.uv_MainTex);
o.Albedo = dot(c.rgb, float3(0.299, 0.587, 0.114));
o.Alpha = _Alpha;
// 对比度
float3 avgLumin = float3(0.5, 0.5, 0.5);
o.Albedo = lerp(avgLumin, o.Albedo, _Contrast);
}
ENDCG
}
FallBack "Diffuse"
}

评论列表( 0 )

你可以在登录后,发表评论

搜索帮助