Fix: Eevee-next Looses Reflective World Light When Switching Shading Modes
When switching shading between material preview and solid modes, the world reflective light could become uninitialized. The reason was that the world was only updated when they actually changed. When switching it might not be the case that the world changed and the world probe wasn't uploaded to the texture. This fix will reduce the locations where this information was stored (removing the `do_world_update` attribute in `ReflectionProbeModule`). It also doesn't reset the `do_render` flag during syncing, but post- pone it to the actual drawing. Pull Request: https://projects.blender.org/blender/blender/pulls/109901
This commit is contained in:
@@ -83,7 +83,7 @@ int ReflectionProbeModule::needed_layers_get() const
|
||||
return max_layer + 1;
|
||||
}
|
||||
|
||||
void ReflectionProbeModule::sync(const ReflectionProbe &probe)
|
||||
void ReflectionProbeModule::sync(ReflectionProbe &probe)
|
||||
{
|
||||
switch (probe.type) {
|
||||
case ReflectionProbe::Type::World: {
|
||||
@@ -92,6 +92,7 @@ void ReflectionProbeModule::sync(const ReflectionProbe &probe)
|
||||
case ReflectionProbe::Type::Probe: {
|
||||
if (probe.do_render) {
|
||||
upload_dummy_texture(probe);
|
||||
probe.do_render = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -337,7 +338,6 @@ void ReflectionProbeModule::end_sync()
|
||||
break;
|
||||
}
|
||||
probe.do_update_data = false;
|
||||
probe.do_render = false;
|
||||
}
|
||||
|
||||
if (regenerate_mipmaps) {
|
||||
@@ -404,6 +404,17 @@ void ReflectionProbeModule::recalc_lod_factors()
|
||||
probe_data.lod_factor = lod_factor;
|
||||
}
|
||||
}
|
||||
bool ReflectionProbeModule::do_world_update_get() const
|
||||
{
|
||||
const ReflectionProbe &world_probe = probes_.lookup(world_object_key_);
|
||||
return world_probe.do_render;
|
||||
}
|
||||
|
||||
void ReflectionProbeModule::do_world_update_set(bool value)
|
||||
{
|
||||
ReflectionProbe &world_probe = probes_.lookup(world_object_key_);
|
||||
world_probe.do_render = value;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Debugging
|
||||
|
||||
@@ -92,8 +92,6 @@ class ReflectionProbeModule {
|
||||
|
||||
PassSimple remap_ps_ = {"Probe.CubemapToOctahedral"};
|
||||
|
||||
bool do_world_update_ = false;
|
||||
|
||||
int3 dispatch_probe_pack_ = int3(0);
|
||||
|
||||
public:
|
||||
@@ -111,15 +109,13 @@ class ReflectionProbeModule {
|
||||
pass->bind_ssbo(REFLECTION_PROBE_BUF_SLOT, data_buf_);
|
||||
}
|
||||
|
||||
void do_world_update_set(bool value)
|
||||
{
|
||||
do_world_update_ = value;
|
||||
}
|
||||
bool do_world_update_get() const;
|
||||
void do_world_update_set(bool value);
|
||||
|
||||
void debug_print() const;
|
||||
|
||||
private:
|
||||
void sync(const ReflectionProbe &cubemap);
|
||||
void sync(ReflectionProbe &cubemap);
|
||||
ReflectionProbe &find_or_insert(ObjectHandle &ob_handle, int subdivision_level);
|
||||
|
||||
/** Get the number of layers that is needed to store probes. */
|
||||
@@ -146,11 +142,6 @@ class ReflectionProbeModule {
|
||||
|
||||
void upload_dummy_texture(const ReflectionProbe &probe);
|
||||
|
||||
bool do_world_update_get() const
|
||||
{
|
||||
return do_world_update_;
|
||||
}
|
||||
|
||||
void remap_to_octahedral_projection();
|
||||
|
||||
/* Capture View requires access to the cube-maps texture for frame-buffer configuration. */
|
||||
|
||||
Reference in New Issue
Block a user