1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

LightmapGI: Pack L1 SH coefficients before denoising

This commit is contained in:
BlueCube3310
2025-08-26 00:28:43 +02:00
parent b79fe2e020
commit de9b22625e
3 changed files with 26 additions and 31 deletions

View File

@@ -980,6 +980,7 @@ LightmapperRD::BakeError LightmapperRD::_denoise(RenderingDevice *p_rd, Ref<RDSh
denoise_params.normal_bandwidth = 0.1f;
denoise_params.filter_strength = 10.0f;
denoise_params.half_search_window = p_denoiser_range;
denoise_params.slice_count = p_bake_sh ? 4 : 1;
p_rd->buffer_update(denoise_params_buffer, 0, sizeof(DenoiseParams), &denoise_params);
Vector<RD::Uniform> uniforms = dilate_or_denoise_common_uniforms(p_source_light_tex, p_dest_light_tex);
@@ -2065,6 +2066,14 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
/* DENOISE */
if (p_bake_sh) {
SWAP(light_accum_tex, light_accum_tex2);
BakeError error = _pack_l1(rd, compute_shader, compute_base_uniform_set, push_constant, light_accum_tex2, light_accum_tex, atlas_size, atlas_slices);
if (unlikely(error != BAKE_OK)) {
return error;
}
}
if (p_use_denoiser) {
if (p_step_function) {
if (p_step_function(0.8, RTR("Denoising"), p_bake_userdata, true)) {
@@ -2290,14 +2299,6 @@ LightmapperRD::BakeError LightmapperRD::bake(BakeQuality p_quality, bool p_use_d
}
}
if (p_bake_sh) {
SWAP(light_accum_tex, light_accum_tex2);
BakeError error = _pack_l1(rd, compute_shader, compute_base_uniform_set, push_constant, light_accum_tex2, light_accum_tex, atlas_size, atlas_slices);
if (unlikely(error != BAKE_OK)) {
return error;
}
}
#ifdef DEBUG_TEXTURES
for (int i = 0; i < atlas_slices * (p_bake_sh ? 4 : 1); i++) {