Skip to content

Commit

Permalink
Lightmap Dynamic Bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
huwpascoe committed Oct 7, 2024
1 parent db66bd3 commit 1a53f43
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions scene/3d/lightmap_gi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1400,6 +1400,11 @@ void LightmapGI::_assign_lightmaps() {
RS::get_singleton()->instance_geometry_set_lightmap(vi->get_instance(), get_instance(), light_data->get_user_lightmap_uv_scale(i), light_data->get_user_lightmap_slice_index(i));
}
}

if (is_visible()) { // notify dynamic objects
set_visible(false);
set_visible(true);
}
}

void LightmapGI::_clear_lightmaps() {
Expand Down
10 changes: 10 additions & 0 deletions servers/rendering/renderer_scene_cull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,16 @@ void RendererSceneCull::instance_set_visible(RID p_instance, bool p_visible) {
_unpair_instance(instance);
}

if (instance->base_type == RS::INSTANCE_LIGHTMAP) {
if (instance->scenario && p_visible) {
for (SelfList<Instance> *i = instance->scenario->instances.first(); i != nullptr; i = i->next()) {
if ((1 << i->self()->base_type) & RS::INSTANCE_GEOMETRY_MASK) {
_instance_pair(instance, i->self());
}
}
}
}

if (instance->base_type == RS::INSTANCE_LIGHT) {
InstanceLightData *light = static_cast<InstanceLightData *>(instance->base_data);
if (instance->scenario && RSG::light_storage->light_get_type(instance->base) != RS::LIGHT_DIRECTIONAL && light->bake_mode == RS::LIGHT_BAKE_DYNAMIC) {
Expand Down

0 comments on commit 1a53f43

Please sign in to comment.