Hi,
we think that we found a bug in the FFT bloom implementation. We found it in a modified UE v5.6 and could reproduce it with v5.8 form the Epic launcher.
The example just has an emissive sphere and a postprocessing volume that defines a custom bloom kernel of size 4096x4096. The `r.Bloom.ScreenPercentage` is set to `50` and the viewport is configured to be at a resolution of `1024x768`. If you click play, the viewport should pop up at the correct resolution and the bloom of the emissive sphere will not be visible. If you resize the viewport window slightly, the bloom will appear again. The bloom also completely disappears, if the viewport is resized to a very small size.
We think that this behaviour is related to the calculation of `SurveyGroupGridSize` in `PostProcessFFTBloom.cpp`:
This is what one of my colleagues figured out when investigating the issue:
In `BloomSurveyMaxScatterDispersion.usf`, the minimum/maximum PixelOffset is
int2 PixelOffset = int2(0, 0) + 8 * (0 - SurveyGroupGridSize / 2) = int(0, 0) - 4 * SurveyGroupGridSize
and
int2 PixelOffset = int2(63 % 8, 63 / 8) + 8 * (SurveyGroupGridSize - 1 - SurveyGroupGridSize / 2) = int2(0, 0) + 4 * SurveyGroupGridSize - 1
because TILE_SIZE = SurveyTileSize = 8 and GroupThreadIndex goes from 0 to TILE_SIZE * TILE_SIZE - 1 = 63. To determine the centerZone we basically compare 2.0 * ViewTexelRadiusInKernelTexels + 1.0 with max(abs(PixelOffset.x), abs(PixelOffset.y)).
In the original code, we have
SurveyGroupGridSize = 2 * FMath::DivideAndRoundUp(FMath::CeilToInt(ViewTexelRadiusInKernelTexels) + 4, SurveyTileSize)
(approx) = 2 * (ViewTexelRadiusInKernelTexels + 4) / 8
(approx) = ViewTexelRadiusInKernelTexels / 4 + 1
which means the maximum value max(abs(PixelOffset.x), abs(PixelOffset.y)) was 4 * SurveyGroupGridSize,
(approx) = ViewTexelRadiusInKernelTexels + 4
This means that for certain ViewTexelRadiusInKernelTexels, where no (or not a lot) of rounding up (due to DivideAndRoundUp) is done, all pixels that we look at in the shader are inside the center zone.
This could be fixed this by adding the missing factor of 2.0f to the ViewTexelRadiusInKernelTexels, which will make the maximum value max(abs(PixelOffset.x), abs(PixelOffset.y)) be (approx) = 2 * ViewTexelRadiusInKernelTexels + 4. Which is more reasonable and consistent with the IsEdgeOrCenterZone.
We therefore think, that the code should be changed to:
int32 SurveyGroupGridSize = 2 * FMath::DivideAndRoundUp(FMath::CeilToInt(2.0f * ViewTexelRadiusInKernelTexels) + 4, SurveyTileSize)
We did some testing with the modified code and it appeared to have fixed the issue. Would be nice if you could doublecheck it and potentially fix this in the engine as well.
Best regards,
Ilja
[Attachment Removed]