EEVEE-Next: Fix Reflection Probes Sampling

When the scene has reflection probes the sampling would be reset
each frame making the viewport always redraw and not resolve.

The reason was a logic error that was introduced when we introduced
a less flickering update for reflection probes.

Pull Request: https://projects.blender.org/blender/blender/pulls/113281
This commit is contained in:
Jeroen Bakker
2023-10-05 11:27:31 +02:00
parent f1c0ec3c4b
commit 355f457cd4
2 changed files with 11 additions and 6 deletions

View File

@@ -13,7 +13,9 @@ namespace blender::eevee {
void ReflectionProbeModule::init()
{
if (probes_.is_empty()) {
if (!is_initialized) {
is_initialized = true;
ReflectionProbeData init_probe_data = {};
init_probe_data.layer = -1;
for (int i : IndexRange(REFLECTION_PROBES_MAX)) {
@@ -131,9 +133,13 @@ void ReflectionProbeModule::sync_object(Object *ob, ObjectHandle &ob_handle)
probe.do_render |= is_dirty;
probe.is_probe_used = true;
/* Only update data when rerendering the probes to reduce flickering. */
if (!instance_.do_probe_sync()) {
const bool probe_sync_active = instance_.do_probe_sync();
if (!probe_sync_active && is_dirty) {
update_probes_next_sample_ = true;
}
/* Only update data when rerendering the probes to reduce flickering. */
if (!probe_sync_active) {
return;
}
@@ -514,9 +520,7 @@ std::optional<ReflectionProbeUpdateInfo> ReflectionProbeModule::update_info_pop(
}
/* Check reset probe updating as we completed rendering all Probes. */
if (probe_type == ReflectionProbe::Type::Probe && update_probes_this_sample_ &&
update_probes_next_sample_)
{
if (probe_type == ReflectionProbe::Type::Probe && update_probes_this_sample_) {
update_probes_next_sample_ = false;
}

View File

@@ -95,6 +95,7 @@ class ReflectionProbeModule {
static constexpr uint64_t world_object_key_ = 0;
bool is_initialized = false;
Instance &instance_;
ReflectionProbeDataBuf data_buf_;
Map<uint64_t, ReflectionProbe> probes_;