Unity 3D双面着色器,带有alpha和深度遮罩

时间:2016-02-16 09:49:31

标签: unity3d shader google-cardboard

我想在Unity 3D中创建一个着色器,您可以添加具有深度和透明度的材质。到目前为止,我已经创建了一个出现在场景中的着色器'具有透明度的模式,但是当我尝试在我的VR设置中预览时,我看不到图像的背面。这是Google Cardboard的设置,所以我需要将相机放在网格中。

到目前为止,这是我的代码:

Shader "Custom/transparentDepth" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
            _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    }
    SubShader {
        Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
        LOD 200

        // extra pass that renders to depth buffer only
        Pass {
            ZWrite On
            ColorMask 0
        }

        // paste in forward rendering passes from Transparent/Diffuse
        UsePass "Transparent/Diffuse/FORWARD"
    }

    Fallback "Transparent/VertexLit"
}

......我只能假设透明度正在发挥作用,因为这是我的场景'输出:

enter image description here

0 个答案:

没有答案
相关问题