Unity3D研究院之处理摄像机与角色之间被挡时的局部透明效果
1.通过shader的修改实现局部透明效果
Shader "Custom/PlayerDiffuse"
{
Properties
{
_NotVisibleColor ("NotVisibleColor (RGB)", Color) = (0.3, 0.3, 0.3, 1)
_MainTex("Base (RGB)", 2D) = "white" {}
}
SubShader
{
Tags { "Queue" = "Geometry+500" "RenderType"="Opaque" }
LOD 200
Pass
{
ZTest Greater
Lighting Off
ZWrite Off
// Color [_NotVisibleColor]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] { ConstantColor [_NotVisibleColor] combine constant * texture }
}
Pass {
ZTest LEqual
Material
{
Diffuse (1,1,1,1)
Ambient (1,1,1,1)
}
Lighting Off
SetTexture [_MainTex] { combine texture }
}
}
FallBack "Diffuse"
}