docs.unity3d.com
    Show / Hide Table of Contents

    Limitation

    AlphaTest pragma in Surface Shaders

    In projects using the Built-in Render Pipeline, rendering objects with surface shaders which use alphatest pragma may cause Render nodes to output the alpha of those objects incorrectly, which will then be propagated to the subsequent nodes in the Compositor Graph.

    One example of such shaders is the leaf shader used by Tree Editor in Unity.

    To work around this issue, at the moment, we have to change the shader file by replacing alphatest with clip.
    Please refer to the following code snippet:

    float _Cutoff;
    
    void surf (Input IN, inout SurfaceOutput o) {
        half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
        o.Albedo = c.rgb;
        o.Alpha = c.a;
        clip(o.Alpha - _Cutoff);    
    }
    
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023