From d42c572a67f871c76b34fcbb514a9fa7aa68103f Mon Sep 17 00:00:00 2001 From: John Haddon Date: Wed, 20 Dec 2023 09:54:47 +0000 Subject: [PATCH] StandardStyle : Discard fragments with zero texture alpha We were already trying to discard fragments with zero alpha so that they don't affect selection hits. But we were doing that before taking the texture alpha into account. Although the original motivation was selection hits, discarding zero alpha also avoids depth buffer writes, which is important now that Backdrops use depth buffering to control the order of nesting. --- src/GafferUI/StandardStyle.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/GafferUI/StandardStyle.cpp b/src/GafferUI/StandardStyle.cpp index f2970096b79..7e1d74ade7a 100644 --- a/src/GafferUI/StandardStyle.cpp +++ b/src/GafferUI/StandardStyle.cpp @@ -1499,11 +1499,6 @@ static const std::string &fragmentSource() " OUTCOLOR.a *= ieFilteredPulse( 0.2, 0.8, gl_TexCoord[0].x );" " }" - " if( OUTCOLOR.a == 0.0 )" - " {" - " discard;" - " }" - /// \todo Deal with all colourspace nonsense outside of the shader. Ideally the shader would accept only linear" /// textures and output only linear data." @@ -1524,6 +1519,11 @@ static const std::string &fragmentSource() " OUTCOLOR = vec4( OUTCOLOR.rgb, OUTCOLOR.a * texture2D( texture, gl_TexCoord[0].xy ).a );" " }\n" + " if( OUTCOLOR.a == 0.0 )" + " {" + " discard;" + " }\n" + "#if __VERSION__ >= 330\n" " ieCoreGLNameOut = ieCoreGLNameIn;\n" "#endif\n"