需求:相機和人物之間有遮擋物,将遮擋物做半透明處理
Shader "Custom/Diffuse/Transparent" {
Properties {
_MainTex ("Base (RGB)", 2D) = "white" {}
_TransparentScale("Transparent",Range(0,1)) = 1
}
SubShader {
Tags {"Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert noforwardadd alpha:fade
sampler2D _MainTex;
float _TransparentScale;
struct Input {
float2 uv_MainTex;
};
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
o.Albedo = c.rgb;
o.Alpha = c.a * _TransparentScale;
}
ENDCG
}
Fallback "Mobile/VertexLit"
}