feat: 透明窗口 + 实例预算扩容(修复斜光阴影静默截断)
透明窗口:SceneSettings 加 ClearColor/DrawSkybox,随 FrameSceneData 每帧下发到 SkyboxPass(替换硬编码清屏色);GLFW 透明帧缓冲已开, tonemap 预乘 alpha 直通已有,链路全通。TAA alpha 时域混合为已知边界。 实例预算:kMaxInstances 16384 → 65536(四视图共享预算,100 实体 斜光时需求 16.4k 超限,cascade 2 实例被静默丢弃 = 用户看到的 "拖灯光方向部分背包阴影消失")。截断状态每帧落遥测 + ImGui 红字 (原 warn-once 对动态穿越阈值的场景等于没有告警)。
This commit is contained in:
+28
-16
@@ -22,13 +22,13 @@
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
#include <atomic>
|
||||
#include <thread>
|
||||
|
||||
|
||||
using namespace Engine;
|
||||
using namespace Engine::ECS;
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace
|
||||
const auto model = GetAssets().LoadModel("assets/models/backpack/backpack.obj");
|
||||
// const auto model = GetAssets().LoadModel("assets/models/pocket_watch_4k.gltf/pocket_watch_4k.gltf");
|
||||
|
||||
int countSize = 2;
|
||||
int countSize = 10;
|
||||
for (int i = 0; i < countSize; i ++)
|
||||
{
|
||||
for (int j = 0; j < countSize; j ++)
|
||||
@@ -316,23 +316,31 @@ namespace
|
||||
{
|
||||
// 动态环境切换(Assets 层加载 → Renderer 换绑;缓存去重)
|
||||
ImGui::Text("Environment (IBL)");
|
||||
int envIdx = m_EnvIndex;
|
||||
if (ImGui::Combo("env", &envIdx, kEnvNames, kEnvCount))
|
||||
bool& DrawSkybox = GetScene().GetSettings().DrawSkybox;
|
||||
ImGui::Checkbox("DrawSkybox", &DrawSkybox);
|
||||
if (DrawSkybox)
|
||||
{
|
||||
// 异步:解码后台线程,完成后 OnUpdate 里换绑
|
||||
m_EnvIndex = envIdx;
|
||||
RequestEnvironment(envIdx);
|
||||
}
|
||||
ImGui::Text(m_EnvLoadBusy ? "(decoding...)" :
|
||||
"(switch = compute pre-integrate, ms-level)");
|
||||
int envIdx = m_EnvIndex;
|
||||
if (ImGui::Combo("env", &envIdx, kEnvNames, kEnvCount))
|
||||
{
|
||||
// 异步:解码后台线程,完成后 OnUpdate 里换绑
|
||||
m_EnvIndex = envIdx;
|
||||
RequestEnvironment(envIdx);
|
||||
}
|
||||
ImGui::Text(m_EnvLoadBusy ? "(decoding...)" :
|
||||
"(switch = compute pre-integrate, ms-level)");
|
||||
|
||||
// 调试视图:单看某个 pass 的中间输出(类 UE pass debug)
|
||||
const auto& viewNames = renderer.GetDebugViewNames();
|
||||
int view = renderer.GetDebugView();
|
||||
if (ImGui::Combo("Debug View", &view, viewNames.data(),
|
||||
static_cast<int>(viewNames.size())))
|
||||
// 调试视图:单看某个 pass 的中间输出(类 UE pass debug)
|
||||
const auto& viewNames = renderer.GetDebugViewNames();
|
||||
int view = renderer.GetDebugView();
|
||||
if (ImGui::Combo("Debug View", &view, viewNames.data(),
|
||||
static_cast<int>(viewNames.size())))
|
||||
{
|
||||
renderer.SetDebugView(view);
|
||||
}
|
||||
}else
|
||||
{
|
||||
renderer.SetDebugView(view);
|
||||
ImGui::ColorEdit4("ClearColor", glm::value_ptr(GetScene().GetSettings().ClearColor));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,6 +351,10 @@ namespace
|
||||
ImGui::Text("instances: %u main / %u shadow",
|
||||
renderer.GetMainInstanceCount(),
|
||||
renderer.GetShadowInstanceCount());
|
||||
if (renderer.GetInstancesTruncated()) {
|
||||
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f),
|
||||
"TRUNCATED: instance buffer full!");
|
||||
}
|
||||
const auto& names = renderer.GetPassNames();
|
||||
const auto& times = renderer.GetPassGpuMs();
|
||||
for (size_t i = 0; i < names.size() && i < times.size(); ++i)
|
||||
|
||||
Reference in New Issue
Block a user