feat: add ghost mode grayscale screen effect

- FXAA path: repurpose _pad field as 'desaturate' push constant; when
  ghostMode_ is true, convert final pixel to grayscale with slight cool
  blue tint using luma(0.299,0.587,0.114) mix
- Non-FXAA path: apply a high-opacity gray overlay (rgba 0.5,0.5,0.55,0.82)
  over the scene for a washed-out look
- Both parallel (SEC_POST) and single-threaded render paths covered
- ghostMode_ flag set each frame from gameHandler->isPlayerGhost()
This commit is contained in:
Kelsi 2026-03-13 00:59:36 -07:00
parent d3159791de
commit acf99354b3
4 changed files with 26 additions and 5 deletions

View file

@ -2,7 +2,7 @@
// FXAA 3.11 — Fast Approximate Anti-Aliasing post-process pass.
// Reads the resolved scene color and outputs a smoothed result.
// Push constant: rcpFrame = vec2(1/width, 1/height), sharpness (0=off, 2=max), unused.
// Push constant: rcpFrame = vec2(1/width, 1/height), sharpness (0=off, 2=max), desaturate (1=ghost grayscale).
layout(set = 0, binding = 0) uniform sampler2D uScene;
@ -11,8 +11,8 @@ layout(location = 0) out vec4 outColor;
layout(push_constant) uniform PC {
vec2 rcpFrame;
float sharpness; // 0 = no sharpen, 2 = max (matches FSR2 RCAS range)
float _pad;
float sharpness; // 0 = no sharpen, 2 = max (matches FSR2 RCAS range)
float desaturate; // 1 = full grayscale (ghost mode), 0 = normal color
} pc;
// Quality tuning
@ -145,5 +145,11 @@ void main() {
fxaaResult = clamp(fxaaResult + s * (fxaaResult - blur), 0.0, 1.0);
}
// Ghost mode: desaturate to grayscale (with a slight cool blue tint).
if (pc.desaturate > 0.5) {
float gray = dot(fxaaResult, vec3(0.299, 0.587, 0.114));
fxaaResult = mix(fxaaResult, vec3(gray, gray, gray * 1.05), pc.desaturate);
}
outColor = vec4(fxaaResult, 1.0);
}