Fix: EEVEE: Volume probe bad shading if resolution is divisible by 3

This was caused by uninitialized values at border. The correct
number of bricks were reserved but only the unpadded volume
was uploaded. Which was not touching the data of the border
bricks if the size was divisible by `IRRADIANCE_GRID_BRICK_SIZE - 1`.

Fix #127215

Pull Request: https://projects.blender.org/blender/blender/pulls/129810
This commit is contained in:
Clément Foucault 2024-11-04 17:48:23 +01:00 committed by Clément Foucault
parent 7a19fe8f97
commit b1185a4736

View File

@ -435,8 +435,11 @@ void VolumeProbeModule::set_view(View & /*view*/)
grid_upload_ps_.bind_texture("visibility_c_tx", use_vis ? &visibility_c_tx : &irradiance_c_tx);
grid_upload_ps_.bind_texture("visibility_d_tx", use_vis ? &visibility_d_tx : &irradiance_d_tx);
/* Runtime grid is padded for blending with surrounding probes. */
int3 grid_size_with_padding = grid_size + 2;
/* Note that we take into account the padding border of each brick. */
int3 grid_size_in_bricks = math::divide_ceil(grid_size, int3(IRRADIANCE_GRID_BRICK_SIZE - 1));
int3 grid_size_in_bricks = math::divide_ceil(grid_size_with_padding,
int3(IRRADIANCE_GRID_BRICK_SIZE - 1));
grid_upload_ps_.dispatch(grid_size_in_bricks);
/* Sync with next load. */
grid_upload_ps_.barrier(GPU_BARRIER_TEXTURE_FETCH);