mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
FSR2 temporal upscaling fixes: unjittered reprojection, sharpen Y-flip, MSAA guard, descriptor double-buffering
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
Some checks are pending
Build / Build (arm64) (push) Waiting to run
Build / Build (x86-64) (push) Waiting to run
Build / Build (macOS arm64) (push) Waiting to run
Build / Build (windows-arm64) (push) Waiting to run
Build / Build (windows-x86-64) (push) Waiting to run
Security / CodeQL (C/C++) (push) Waiting to run
Security / Semgrep (push) Waiting to run
Security / Sanitizer Build (ASan/UBSan) (push) Waiting to run
- Motion vectors: single unjittered reprojection matrix (80 bytes) instead of two jittered matrices (160 bytes), eliminating numerical instability from jitter amplification through large world coordinates - Sharpen pass: fix Y-flip for correct UV sampling, double-buffer descriptor sets to avoid race with in-flight command buffers - MSAA: auto-disable when FSR2 enabled, grey out AA setting in UI - Accumulation: variance-based neighborhood clamping in YCoCg space, correct history layout transitions - Frame index: wrap at 256 for stable Halton sequence
This commit is contained in:
parent
52317d1edd
commit
e94eb7f2d1
9 changed files with 95 additions and 106 deletions
|
|
@ -6,10 +6,8 @@ layout(set = 0, binding = 0) uniform sampler2D depthBuffer;
|
|||
layout(set = 0, binding = 1, rg16f) uniform writeonly image2D motionVectors;
|
||||
|
||||
layout(push_constant) uniform PushConstants {
|
||||
mat4 invViewProj; // Inverse of current jittered VP
|
||||
mat4 prevViewProj; // Previous frame unjittered VP
|
||||
mat4 reprojMatrix; // prevUnjitteredVP * inverse(currentUnjitteredVP)
|
||||
vec4 resolution; // xy = internal size, zw = 1/internal size
|
||||
vec4 jitterOffset; // xy = current jitter (NDC), zw = previous jitter
|
||||
} pc;
|
||||
|
||||
void main() {
|
||||
|
|
@ -20,25 +18,18 @@ void main() {
|
|||
// Sample depth (Vulkan: 0 = near, 1 = far)
|
||||
float depth = texelFetch(depthBuffer, pixelCoord, 0).r;
|
||||
|
||||
// Pixel center in NDC [-1, 1]
|
||||
// Pixel center in UV [0,1] and NDC [-1,1]
|
||||
vec2 uv = (vec2(pixelCoord) + 0.5) * pc.resolution.zw;
|
||||
vec2 ndc = uv * 2.0 - 1.0;
|
||||
|
||||
// Reconstruct world position from depth
|
||||
// Clip-to-clip reprojection: current unjittered clip → previous unjittered clip
|
||||
vec4 clipPos = vec4(ndc, depth, 1.0);
|
||||
vec4 worldPos = pc.invViewProj * clipPos;
|
||||
worldPos /= worldPos.w;
|
||||
|
||||
// Project into previous frame's clip space (unjittered)
|
||||
vec4 prevClip = pc.prevViewProj * worldPos;
|
||||
vec4 prevClip = pc.reprojMatrix * clipPos;
|
||||
vec2 prevNdc = prevClip.xy / prevClip.w;
|
||||
vec2 prevUV = prevNdc * 0.5 + 0.5;
|
||||
|
||||
// Remove jitter from current UV to get unjittered position
|
||||
vec2 unjitteredUV = uv - pc.jitterOffset.xy * 0.5;
|
||||
|
||||
// Motion = previous position - current unjittered position (in UV space)
|
||||
vec2 motion = prevUV - unjitteredUV;
|
||||
// Motion = previous position - current position (both unjittered, in UV space)
|
||||
vec2 motion = prevUV - uv;
|
||||
|
||||
imageStore(motionVectors, pixelCoord, vec4(motion, 0.0, 0.0));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue