Fix Volumetric Fog VoxelGI updates

This commit is contained in:
bitsawer 2023-12-11 10:34:29 +02:00 committed by Rémi Verschelde
parent 7d2ca2d8ac
commit 89d772a799
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 9 additions and 2 deletions

View file

@ -931,9 +931,10 @@ void Fog::volumetric_fog_update(const VolumetricFogSettings &p_settings, const P
uniforms.push_back(u);
}
if (fog->copy_uniform_set.is_null()) {
fog->copy_uniform_set = RD::get_singleton()->uniform_set_create(copy_uniforms, volumetric_fog.process_shader.version_get_shader(volumetric_fog.process_shader_version, VolumetricFogShader::VOLUMETRIC_FOG_PROCESS_SHADER_COPY), 0);
if (fog->copy_uniform_set.is_valid() && RD::get_singleton()->uniform_set_is_valid(fog->copy_uniform_set)) {
RD::get_singleton()->free(fog->copy_uniform_set);
}
fog->copy_uniform_set = RD::get_singleton()->uniform_set_create(copy_uniforms, volumetric_fog.process_shader.version_get_shader(volumetric_fog.process_shader_version, VolumetricFogShader::VOLUMETRIC_FOG_PROCESS_SHADER_COPY), 0);
if (!gi_dependent_sets_valid) {
fog->gi_dependent_sets.process_uniform_set = RD::get_singleton()->uniform_set_create(uniforms, volumetric_fog.process_shader.version_get_shader(volumetric_fog.process_shader_version, VolumetricFogShader::VOLUMETRIC_FOG_PROCESS_SHADER_FOG), 0);

View file

@ -3725,6 +3725,12 @@ void GI::setup_voxel_gi_instances(RenderDataRD *p_render_data, Ref<RenderSceneBu
}
rbgi->uniform_set[v] = RID();
}
if (p_render_buffers->has_custom_data(RB_SCOPE_FOG)) {
// VoxelGI instances have changed, so we need to update volumetric fog.
Ref<RendererRD::Fog::VolumetricFog> fog = p_render_buffers->get_custom_data(RB_SCOPE_FOG);
fog->sync_gi_dependent_sets_validity(true);
}
}
if (p_voxel_gi_instances.size() > 0) {