From be7a20fef23b55c6a8a3412f377710ee6a6ec2cb Mon Sep 17 00:00:00 2001 From: Stenzek Date: Tue, 26 Nov 2024 13:08:11 +1000 Subject: [PATCH] GPU/TextureCache: Map replacement non-255 alpha to fully transparent That way if during the scaling process you end up with interpolated colours, the cutout alpha is preserved. Ideally we'd blend it, but that tends to create more problems than it solves on PSX. --- src/core/gpu_hw_shadergen.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/gpu_hw_shadergen.cpp b/src/core/gpu_hw_shadergen.cpp index 5179c5ed5..55db9921a 100644 --- a/src/core/gpu_hw_shadergen.cpp +++ b/src/core/gpu_hw_shadergen.cpp @@ -1842,6 +1842,9 @@ std::string GPU_HW_ShaderGen::GenerateReplacementMergeFragmentShader(bool semitr #else // Leave (0,0,0,0) as 0000 for opaque replacements for cutout alpha. o_col0.a = color.a; + + // Map anything with an alpha below 0.5 to transparent. + o_col0 = lerp(o_col0, float4(0.0, 0.0, 0.0, 0.0), float(o_col0.a < 0.5)); #endif } )";