![](https://i-blog.csdnimg.cn/blog_migrate/b7591bf7459a6399cef9c65d9336a980.png)
Shader "Custom/surfaceAlpha" {
Properties {
_RimColor("RimColor",Color)=(1,1,0,0)
_RimPower("RimPower",Range(0.5,8.0))=2
_Alpha("Alpha",Range(0,1))=1
}
SubShader {
Tags { "Queue"="Transparent""RenderTyep"="Transparent"}
LOD 200
Blend SrcAlpha OneMinusSrcColor
CGPROGRAM
#pragma surface surf Lambert
float4 _RimColor;
float _RimPower;
float _Alpha;
float4 _Color;
struct Input {
float3 viewDir;
float3 worldNormal;
};
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo =_RimColor.rgb;
half rim =1.0-saturate(dot(normalize(IN.viewDir),IN.worldNormal));
o.Alpha=rim*_Alpha;
o.Emission=o.Albedo*pow(rim,_RimPower);
}
ENDCG
}
FallBack "Diffuse"
}