Fix: EEVEE-Next: Wrong sphere probe normalization with no volume prove

This was caused by 2 issues:
- The probe selection was running before the volume set_view
  copying undefined data.
- Missing half voxel offset which was making L1 data incorrectly
  blended with other coefficients.
This commit is contained in:
Clément Foucault
2024-04-24 20:19:51 +02:00
parent 1e61cf7cf4
commit 211b726f48
4 changed files with 10 additions and 2 deletions

View File

@@ -422,6 +422,7 @@ void ForwardPipeline::render(View &view,
inst_.shadows.set_view(view, extent);
inst_.volume_probes.set_view(view);
inst_.sphere_probes.set_view(view);
if (has_opaque_) {
combined_fb.bind();
@@ -733,6 +734,7 @@ GPUTexture *DeferredLayer::render(View &main_view,
inst_.hiz_buffer.update();
inst_.volume_probes.set_view(render_view);
inst_.sphere_probes.set_view(render_view);
inst_.shadows.set_view(render_view, extent);
inst_.gbuffer.bind(gbuffer_fb);
@@ -1227,6 +1229,7 @@ void DeferredProbePipeline::render(View &view,
inst_.lights.set_view(view, extent);
inst_.shadows.set_view(view, extent);
inst_.volume_probes.set_view(view);
inst_.sphere_probes.set_view(view);
/* Update for lighting pass. */
inst_.hiz_buffer.update();
@@ -1343,6 +1346,7 @@ void PlanarProbePipeline::render(View &view,
inst_.lights.set_view(view, extent);
inst_.shadows.set_view(view, extent);
inst_.volume_probes.set_view(view);
inst_.sphere_probes.set_view(view);
inst_.gbuffer.bind(gbuffer_fb);
inst_.manager->submit(gbuffer_ps_, view);

View File

@@ -119,6 +119,10 @@ class SphereProbeModule {
pass.bind_ubo(SPHERE_PROBE_BUF_SLOT, &data_buf_);
}
/**
* Select which probes are used for rendering.
* NOTE: Must run after `volume_probe.set_view` as it reads the volume probe data.
*/
void set_view(View &view);
/**

View File

@@ -120,7 +120,6 @@ void ShadingView::render()
/* TODO(fclem): Move it after the first prepass (and hiz update) once pipeline is stabilized. */
inst_.lights.set_view(render_view_, extent_);
inst_.sphere_probes.set_view(render_view_);
inst_.pipelines.background.render(render_view_);

View File

@@ -198,7 +198,8 @@ SphericalHarmonicL1 lightprobe_irradiance_sample(
SphericalHarmonicL1 lightprobe_irradiance_world()
{
return lightprobe_irradiance_sample_atlas(irradiance_atlas_tx, vec3(0.0));
/* We need a 0.5 offset because of filtering. */
return lightprobe_irradiance_sample_atlas(irradiance_atlas_tx, vec3(0.5001));
}
SphericalHarmonicL1 lightprobe_irradiance_sample(vec3 P)