feat: IBL 阶段②——漫反射辐照度卷积,PBR ambient 接入环境光
- Cubemap 构造期同步 CPU 半球 Lambert 积分(64×32 网格 ≈2048 采样/像素) 生成 32² irradiance cube(漫反射是超低频信号,分辨率无需高) - shader:kD 用粗糙度感知 FresnelSchlickRoughness + (1-metallic), N 采样 irradianceMap(Set2 binding 3)替换常数 ambient; ambientColor 保留为强度/色调乘子 - CreateNeutral 兜底:无 HDR 资产时 1×1 常数 cube,描述符恒有效 - FaceDir 改为返回单位方向(equirect 查表要求,修掉未归一化的畸变)
This commit is contained in:
@@ -74,12 +74,15 @@ namespace Engine
|
||||
m_FullscreenGpu = CreateScope<Passes::FullscreenGpu>(
|
||||
*m_Device, *m_DescriptorManager, *m_ShaderManager);
|
||||
|
||||
// 3.5 环境贴图(IBL 阶段①):HDR 等距柱状 → cube。
|
||||
// 文件缺失则跳过(SkyboxPass 自动退化为纯清屏,Forward 不受影响)
|
||||
// 3.5 环境贴图(IBL):HDR 等距柱状 → cube + irradiance 卷积。
|
||||
// 文件缺失则创建中性常数兜底(描述符恒有效,渲染退化为常数环境)
|
||||
const std::string envPath = "assets/textures/venice_dawn_1_4k.hdr";
|
||||
if (std::filesystem::exists(envPath)) {
|
||||
m_Environment = Cubemap::CreateFromHdrEquirect(
|
||||
*m_Device, *m_Allocator, envPath, 1024);
|
||||
} else {
|
||||
m_Environment = Cubemap::CreateNeutral(
|
||||
*m_Device, *m_Allocator, glm::vec3(0.1f));
|
||||
}
|
||||
|
||||
// 4. Swapchain(只管呈现;渲染目标统一归 RenderGraph)
|
||||
@@ -107,6 +110,8 @@ namespace Engine
|
||||
for (auto& pass : m_Passes) {
|
||||
pass->OnTargetsRebuilt(*m_RenderGraph);
|
||||
}
|
||||
// 环境辐照度绑定(view 全程稳定,绑一次)
|
||||
m_SceneGpu->BindEnvironment(*m_Environment);
|
||||
|
||||
// 9. GPU timestamp:每 pass 两枚(前后),按帧槽位分区
|
||||
m_QueriesPerFrame = static_cast<u32>(m_RenderGraph->GetPassCount()) * 2;
|
||||
|
||||
Reference in New Issue
Block a user