To resolve the default rendering pipeline after translucent rendering overlap, you can use depth test and depth write to solve the problem. Specifically, you can add the following code to the shader:
Tags{ "Queue" = "Transparent" "RenderType" = "Transparent" }
Pass
{
ZWrite Off // 禁止写入深度缓冲
Blend SrcAlpha OneMinusSrcAlpha // 使用透明混合
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
// 省略其他代码
ENDCG
}
This ensures that when drawing a translucent object, only pixels closer to the camera will be drawn, thus avoiding overlapping problems. Also, since depth writing is disabled, such a translucent object does not affect the depth information of subsequent objects, thus avoiding the depth collision problem.