Skip to content

Commit

Permalink
make sure FXAA resets alpha channel when it's the last postfx (#8412)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pixelflinger authored and poweifeng committed Feb 4, 2025
1 parent 0a5b85f commit b204b92
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions filament/src/details/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit b204b92

Please sign in to comment.