From b204b92e35dbdb604c1a8ca9bf2d617240b663b2 Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Tue, 4 Feb 2025 11:52:37 -0800 Subject: [PATCH] make sure FXAA resets alpha channel when it's the last postfx (#8412) If FXAA is the last post process effect (i.e. no upscaling), and color grading produced a luma channel, then FXAA needs to reset the alpha channel to 1. --- filament/src/details/Renderer.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/filament/src/details/Renderer.cpp b/filament/src/details/Renderer.cpp index 186c6249c7..768d16b28f 100644 --- a/filament/src/details/Renderer.cpp +++ b/filament/src/details/Renderer.cpp @@ -1351,8 +1351,11 @@ void FRenderer::renderJob(RootArenaScope& rootArenaScope, FView& view) { } if (hasFXAA) { - bool const preserveAlphaChannel = needsAlphaChannel || - (hasColorGrading && colorGradingConfig.outputLuminance); + bool const preserveAlphaChannel = + // we're transparent -- alpha channel has user data + needsAlphaChannel || + // the color-grading pass outputted the luminance channel, and we have an upscaling pass + (hasColorGrading && colorGradingConfig.outputLuminance && scaled); input = ppm.fxaa(fg, input, xvp, colorGradingConfig.ldrFormat, preserveAlphaChannel); // the padded buffer is resolved now xvp.left = xvp.bottom = 0;