Files
HelloVulkan/shaders/bloom_blur.frag
T
atdunbg 908e688178 feat: ACES tonemap + Bloom 后处理链(Extract/BlurH/BlurV 半分辨率)
- ACES(Narkowicz) 经 push 开关启用,exposure 接 ImGui 滑条
- RG: TextureDesc 支持 sizeScale 相对尺寸;per-pass 渲染尺寸解析
  (半分辨率 pass 的 viewport 由此决定)
- RG Toposort 重写:RAW+WAR+WAW 按声明序逐资源建边,支持多写者
  ping-pong 资源(旧逻辑对 reader 连接所有 writer,ping-pong 成环)
- GetPhysicalView 缺物理镜像时 throw(ENGINE_FATAL 只记日志不中止)
- 全屏 pass 通用 16B push + 公共录制 lambda,Extract/Blur/Tonemap 复用
2026-09-22 19:18:51 +08:00

30 lines
1000 B
GLSL
Raw 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
// Bloom 高斯模糊:可分离 9-tap,方向由 push 给出(H/V 各跑一次)。
// 源图为半分辨率,线性采样 + 权重对应的偏移天然抗锯齿。
layout(location = 0) in vec2 fragUV;
layout(location = 0) out vec4 outColor;
layout(set = 0, binding = 0) uniform sampler2D srcImage;
layout(push_constant) uniform PushConstants {
float exposure; // 未用(程序级统一布局)
float stepX; // param0: UV 步长 x(水平 pass = 1/width,垂直 = 0)
float stepY; // param1: UV 步长 y
float _pad0;
} pc;
const float weights[5] = float[](0.227027, 0.1945946, 0.1216216, 0.054054, 0.016216);
void main() {
vec2 off = vec2(pc.stepX, pc.stepY);
vec3 c = texture(srcImage, fragUV).rgb * weights[0];
for (int i = 1; i < 5; ++i) {
c += texture(srcImage, fragUV + off * float(i)).rgb * weights[i];
c += texture(srcImage, fragUV - off * float(i)).rgb * weights[i];
}
outColor = vec4(c, 1.0);
}