fix: 阴影不可见——灯序依赖遍历顺序 + 光比失衡,新增帧截图调试能力

- 灯序修复(根因):entt Each 遍历序不保证创建序,lights[0] 曾落到
  点光(params.x=1)→ shader 阴影分支整个跳过。收集后 stable_sort
  方向光排前,确立"lights[0] = CSM 阴影光源"契约
- 光比失衡:IBL 环境与点光淹没主光阴影。KeyLight 5.0 + exposure
  默认 0.6 + ambientColor 0.07;阴影区环境光同步衰减(简化遮蔽)
- ShadowPass depth bias 0.006(acne 均值形态 vs 推过头丢阴影的折中)
- Renderer 帧截图能力:第 60 帧自动截 HDRColor/ShadowMap 落 BMP
  (ACES+gamma 还原屏幕观感),视觉调试自闭环不再依赖肉眼
- KeyLight 增加 intensity slider(0-20 运行时可调)
This commit is contained in:
2026-09-24 01:49:11 +08:00
parent 8c0a11d2e8
commit 4d3963e291
8 changed files with 218 additions and 25 deletions
+1 -1
View File
@@ -41,7 +41,7 @@ namespace Engine::ECS {
// ---- 场景级设置 ----
struct Settings {
glm::vec4 ambientColor{0.15f, 0.15f, 0.2f, 0.0f};
glm::vec4 ambientColor{0.07f, 0.07f, 0.09f, 0.0f};
};
Settings& GetSettings() { return m_Settings; }
@@ -210,6 +210,13 @@ namespace Engine::RG {
// 注意:物理镜像按槽位各一份,槽位变化/重编译后必须重新获取。
vk::ImageView GetPhysicalView(TextureHandle h, u32 frameSlot) const;
// 调试/截图:取物理 image + 静息布局(帧尾 barrier 恢复用)。
// imported 资源返回 false(无物理实例)
bool GetCaptureTarget(TextureHandle h, u32 frameSlot,
vk::Image& outImage, vk::Extent2D& outExtent,
vk::Format& outFormat,
vk::ImageLayout& outResting) const;
// 帧历史槽位 = 上一帧使用的槽位:(slot - 1 + F) mod F
u32 HistorySlot(u32 frameSlot) const {
return (frameSlot + m_FramesInFlight - 1) % m_FramesInFlight;