From a941207ae369b365f884021b050f27530c2deddb Mon Sep 17 00:00:00 2001 From: atdunbg Date: Mon, 5 Oct 2026 12:28:14 +0800 Subject: [PATCH] Raise bloom threshold to HDR 3.0; fix blit dst-mip layout warnings The smooth brass case back of the pocket watch reflects large bright sky regions of the Venice dawn environment at HDR values well above 1. With the old threshold of 1.0 the entire metal surface passed the bloom extract, and the blurred additive result washed it out to flat white. Only genuinely hot highlights (HDR >= 3, near-white after ACES) should bloom. - Default bloomThreshold 1.0 -> 3.0; Stats slider range extended to 8 with a logarithmic scale - Texture mip generation: transition the whole mip chain to TRANSFER_DST up front; blitting into never-transitioned destination mips triggered one validation warning per level --- App/editor/StatsPanel.cpp | 3 ++- Engine/include/Engine/Renderer/Passes/FullscreenGpu.h | 5 ++++- Engine/src/Vulkan/Texture.cpp | 6 +++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/App/editor/StatsPanel.cpp b/App/editor/StatsPanel.cpp index d7ed23d..4d3a5cd 100644 --- a/App/editor/StatsPanel.cpp +++ b/App/editor/StatsPanel.cpp @@ -95,7 +95,8 @@ void StatsPanel::Draw(const EditorContext& ctx) if (bloom) { f32 threshold = renderer.GetBloomThreshold(); - if (ImGui::SliderFloat("Threshold", &threshold, 0.0f, 2.0f)) + if (ImGui::SliderFloat("Threshold", &threshold, 0.0f, 8.0f, + "%.1f", ImGuiSliderFlags_Logarithmic)) { renderer.SetBloomThreshold(threshold); } diff --git a/Engine/include/Engine/Renderer/Passes/FullscreenGpu.h b/Engine/include/Engine/Renderer/Passes/FullscreenGpu.h index 203d224..603911e 100644 --- a/Engine/include/Engine/Renderer/Passes/FullscreenGpu.h +++ b/Engine/include/Engine/Renderer/Passes/FullscreenGpu.h @@ -36,7 +36,10 @@ namespace Engine { struct PostProcessParams { f32 exposure = 0.6f; bool useACES = true; - f32 bloomThreshold = 1.0f; // HDR 域亮度阈值 + // HDR 域亮度阈值。注意不能设 1.0:光滑金属反射亮天空的 HDR 值 + // 普遍 2~50,阈值为 1 会让整片金属表面进 bloom → 白色泛光糊满 + //(怀表铜壳"纯白"元凶)。3.0 ≈ ACES 后接近白的真高光才泛光 + f32 bloomThreshold = 3.0f; f32 bloomStrength = 0.8f; // 叠加强度 }; diff --git a/Engine/src/Vulkan/Texture.cpp b/Engine/src/Vulkan/Texture.cpp index 48e5720..8fe8223 100644 --- a/Engine/src/Vulkan/Texture.cpp +++ b/Engine/src/Vulkan/Texture.cpp @@ -173,7 +173,11 @@ namespace Engine .setOldLayout(vk::ImageLayout::eUndefined) .setNewLayout(vk::ImageLayout::eTransferDstOptimal) .setImage(m_Image) - .setSubresourceRange({vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1}); + // 整条 mip 链一次性 UNDEFINED → TRANSFER_DST:后续 blit + // 的目标 mip 必须已在目标布局(仅转 mip0 会触发 validation + // 对每个 blit 目标的 UNDEFINED 布局告警) + .setSubresourceRange({vk::ImageAspectFlagBits::eColor, + 0, m_MipLevels, 0, 1}); vk::DependencyInfo dep1; dep1.setImageMemoryBarriers(toTransfer);