Files
HelloVulkan/shaders/env/ibl_equirect_to_cube.comp
atdunbg f73e52926f Reorganize directory layout: editor panels/, grouped shaders, drop stale header
- App/editor: move 7 panels into panels/ (Editor core stays at root)
- shaders/: group into pbr/ post/ debug/ env/ (runtime load paths updated)
- Delete outdated duplicate Engine/src/Renderer/VulkanAssetUploader.h
2026-10-07 09:52:17 +08:00

28 lines
960 B
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#version 450
// IBL ①:等距柱状 HDR → 环境 cube(6 面重采样)。
// 替代原 CPU 逐像素 SampleEquirect 双线性查表——GPU 上直接用硬件
// 线性过滤采样(经度接缝由 S=eRepeat 处理),观感与 CPU 版一致。
// 输出为 image2DArray(layer = face),图像本体带 CUBE_COMPATIBLE,
// 采样端另建 eCube view。
#include "ibl_common.glsl"
layout(local_size_x = 8, local_size_y = 8) in;
layout(set = 0, binding = 0) uniform sampler2D equirect;
layout(set = 0, binding = 1, rgba16f) uniform restrict writeonly image2DArray outCube;
void main()
{
ivec3 gid = ivec3(gl_GlobalInvocationID);
ivec2 size = imageSize(outCube).xy;
if (gid.x >= size.x || gid.y >= size.y) return;
vec2 uv = (vec2(gid.xy) + 0.5) / vec2(size);
vec3 dir = iblFaceDir(uint(gid.z), uv.x, uv.y);
vec3 rgb = texture(equirect, iblDirToEquirectUv(dir)).rgb;
imageStore(outCube, gid, vec4(rgb, 1.0));
}