Files
HelloVulkan/shaders/post/temporal_diff.frag
T
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

29 lines
1.1 KiB
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
// TemporalDiff:帧历史链路调试视图。
// 输出 |上一帧 HDR − 当前帧 HDR| × 增益:
// - 静止画面应接近纯黑(两帧内容一致)
// - 运动的实体边缘发光(时域差异可见)
// - 全屏噪声 / 错位残影 = 帧历史 barrier 或槽位镜像绑定错误
// 这是 RenderGraph 帧历史资源(ReadHistory)的验证消费端。
layout(location = 0) in vec2 fragUV;
layout(location = 0) out vec4 outColor;
layout(set = 0, binding = 0) uniform sampler2D prevImage; // 帧历史(上一帧槽位镜像)
layout(set = 0, binding = 1) uniform sampler2D currImage; // 当前帧
// 全屏 pass 通用 push(16B,程序级统一声明,VUID-08878)
layout(push_constant) uniform PushConstants {
float exposure; // 与其它全屏 pass 布局一致(本 pass 不用)
float gain; // 差异增益
float param1;
float param2;
} pc;
void main() {
vec3 prev = texture(prevImage, fragUV).rgb;
vec3 curr = texture(currImage, fragUV).rgb;
outColor = vec4(abs(prev - curr) * pc.gain, 1.0);
}