在网络上找到了这个透明的内部发光着色器:
Shader "Cell/MainTransparentFresnel" {
Properties
{
_InnerColor ("Inner Color", Color) = (1.0, 1.0, 1.0, 1.0)
_RimColor ("Rim Color", Color) = (0.26,0.19,0.16,0.0)
_RimPower ("Rim Power", Range(0.5,8.0)) = 3.0
}
SubShader {
Tags { "Queue" = "Transparent" }
Blend one one
CGPROGRAM
#pragma surface surf Lambert
struct Input {
float3 viewDir;
};
float4 _InnerColor;
float4 _RimColor;
float _RimPower;
void surf (Input IN, inout SurfaceOutput o)
{
o.Albedo = _InnerColor.rgb;
half rim = 1.0 - saturate(dot (normalize(IN.viewDir), o.Normal));
o.Emission = _RimColor.rgb * pow (rim, _RimPower);
}
ENDCG
}
Fallback "Diffuse"
这是我从此着色器混合两个网格时的结果: result 1
我尝试过模版缓冲区:
stencil {
ref 2
comp notequal
pass replace
,结果如下: result 2
我希望隐藏两个十字路口
类似 this
有什么主意吗?