2

image

I want to get rid strange colored regions in the outline of the tree. Here's my shader's code for tree sprite:

    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 

         } 
    }
}
}

Additionally, a tree's sorting order is 7 and background brick's sorting order is 14. and tree's z position is -11, and brick's z positions is a -8.8.

1 Answer 1

0

You commented out "ZTest Always" so the fallback "ZTest LEqual" is used instead. The outline you see is the mesh (with the "Tight" option in the Sprite properties) being written to the Z-buffer, preventing the brick from being drawn properly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.