fix: IBL 全黑根因——RadicalInverseVdC 误用 bit_cast,Hammersley 序列错乱
- bit_cast<f32>(bits) 把反转后的整数当 IEEE754 位型解读(LearnOpenGL 原文 float(bits) 是整数值转换)→ xi.y 越出 [0,1] → sqrt(负数) → BRDF LUT NaN + pre-filter 数据全垃圾 → ambient NaN 整屏黑 - 分离出的积分程序实测:texel(0,2) 样本 10 xi.y=2 → NaN;修后无 NaN - 加 CPU 侧 fp16 NaN 自检(上传前最后一道防线),数据异常拒绝加载 走中性兜底(不再解引用空指针) - 中性兜底 1×1 图只建 1 mip(修 mipLevels=5 validation 警告) - prefilter mip 拷贝偏移改累积制(此前用当前 dim×序号错位) - prefilter/irradiance 绑定换带 mip 的环境采样器(shadowSampler maxLod=0 把 textureLod clamp 到最锐 mip)
This commit is contained in:
@@ -74,13 +74,14 @@ namespace Engine
|
||||
m_FullscreenGpu = CreateScope<Passes::FullscreenGpu>(
|
||||
*m_Device, *m_DescriptorManager, *m_ShaderManager);
|
||||
|
||||
// 3.5 环境贴图(IBL):HDR 等距柱状 → cube + irradiance 卷积。
|
||||
// 文件缺失则创建中性常数兜底(描述符恒有效,渲染退化为常数环境)
|
||||
// 3.5 环境贴图(IBL):HDR 等距柱状 → cube + 预积分。
|
||||
// 加载失败/文件缺失一律中性常数兜底(描述符恒有效)
|
||||
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 {
|
||||
}
|
||||
if (!m_Environment) {
|
||||
m_Environment = Cubemap::CreateNeutral(
|
||||
*m_Device, *m_Allocator, glm::vec3(0.1f));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user