进一步远离Unity3D中重叠对象的对象

时间:2013-05-29 11:12:59

标签: unity3d

我有3个不同的平面:前景,中间地面和背景。出于某种原因,进一步的背板定期渲染在我的前景平面之上。

在场景视图中,您可以看到波浪更靠近相机,然后是背景。 enter image description here

然而在游戏中,背景有时会显示更近的平面,如此屏幕截图所示: enter image description here

我正在使用透视相机。

1 个答案:

答案 0 :(得分:2)

我认为您应该能够在着色器中更改渲染顺序。此解决方案不会很好地概括,因为您需要为每个平面设置唯一的着色器。

例如,要修改transparency order,您可能有ShaderFar:

Shader "TransparentFar" {
    SubShader {
        Tags {"Queue" = "Transparent" }
        Pass {
            // rest of the shader body...
        }
    }
} 

和ShaderNear:

Shader "TransparentNear" {
    SubShader {
        Tags {"Queue" = "Transparent+1" } //**note the +1
        Pass {
            // rest of the shader body...
        }
    }
} 

内置着色器可以是downloaded here,并且应该很容易适应。

相关问题