【问题标题】:Unity shader : can you fix this shader?Unity 着色器:你能修复这个着色器吗?
【发布时间】:2018-01-11 00:52:35
【问题描述】:

我想去掉树轮廓中的奇怪颜色区域。这是我的树精灵着色器代码:

    Shader "Unlit/Transparent Color Z on 2" {
Properties {
    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
    _Color ("Main Color", Color) = (1,1,1,1) 
}

SubShader {
    Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
    LOD 100

    ZWrite On Blend One OneMinusSrcAlpha Cull Off
    //ZTest Always
    Blend SrcAlpha OneMinusSrcAlpha 

    Pass {

        Lighting Off
        SetTexture [_MainTex] {

            constantColor [_Color]

            Combine texture * constant, texture * constant 

         } 
    }
}
}

另外,一棵树的排序顺序是7,背景砖的排序顺序是14。树的z位置是-11,砖的z位置是-8.8。

【问题讨论】:

    标签: unity3d shader


    【解决方案1】:

    您注释掉了“ZTest Always”,因此使用了后备“ZTest LEqual”。您看到的轮廓是正在写入 Z 缓冲区的网格(在 Sprite 属性中具有“紧”选项),从而阻止了正确绘制砖块。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多