EEVEE: HiZ Buffer Allocation

EEVEE uses an HiZ buffer. The size of the HiZ buffer is based on the render extent.
Probes assume that the render extent is always bigger than needed for rendering
probes. This assumption is incorrect.

Although this PR fixes this by allocating the required size, it is still renders with
artifacts. These artifacts originate from the lighting module and also needs to be
fixed.

Pull Request: https://projects.blender.org/blender/blender/pulls/117502
This commit is contained in:
Jeroen Bakker 2024-01-26 12:06:42 +01:00
parent b7cf71d567
commit dd0798927f
3 changed files with 15 additions and 1 deletions

View File

@ -19,7 +19,9 @@ void HiZBuffer::sync()
{
int2 render_extent = inst_.film.render_extent_get();
/* Padding to avoid complexity during down-sampling and screen tracing. */
int2 hiz_extent = math::ceil_to_multiple(render_extent, int2(1u << (HIZ_MIP_COUNT - 1)));
int2 probe_extent = int2(inst_.reflection_probes.probe_render_extent());
int2 hiz_extent = math::ceil_to_multiple(math::max(render_extent, probe_extent),
int2(1u << (HIZ_MIP_COUNT - 1)));
int2 dispatch_size = math::divide_ceil(hiz_extent, int2(HIZ_GROUP_SIZE));
eGPUTextureUsage usage = GPU_TEXTURE_USAGE_SHADER_READ | GPU_TEXTURE_USAGE_SHADER_WRITE;

View File

@ -140,6 +140,11 @@ eLightProbeResolution ReflectionProbeModule::reflection_probe_resolution() const
return LIGHT_PROBE_RESOLUTION_2048;
}
int ReflectionProbeModule::probe_render_extent() const
{
return instance_.scene->eevee.gi_cubemap_resolution / 2;
}
void ReflectionProbeModule::init()
{
if (!is_initialized) {

View File

@ -243,6 +243,13 @@ class ReflectionProbeModule {
return probes_tx_.width();
}
/**
* Get the resolution of a single cubemap side when rendering probes.
*
* The cubemaps are rendered half size of the size of the octahedral texture.
*/
int probe_render_extent() const;
ReflectionProbeAtlasCoordinate world_atlas_coord_get() const;
private: