afegit flicker a postfx

This commit is contained in:
2026-03-22 22:38:18 +01:00
parent 49ae2ae41f
commit f84007902e
7 changed files with 46 additions and 14 deletions

View File

@@ -23,9 +23,9 @@ layout(set = 3, binding = 0) uniform PostFXUniforms {
float curvature;
float bleeding;
float pixel_scale; // physical pixels per logical pixel (vh / tex_height_)
float time; // seconds since SDL init (for future animated effects)
float time; // seconds since SDL init
float oversample; // supersampling factor (1.0 = off, 3.0 = 3×SS)
float pad1; // padding — 48 bytes total (3 × 16)
float flicker; // 0 = off, 1 = phosphor flicker ~50 Hz — 48 bytes total (3 × 16)
} u;
// YCbCr helpers for NTSC bleeding
@@ -85,8 +85,8 @@ void main() {
colour = base;
}
// Aberración cromática
float ca = u.chroma_strength * 0.005;
// Aberración cromática (drift animado con time para efecto NTSC real)
float ca = u.chroma_strength * 0.005 * (1.0 + 0.15 * sin(u.time * 7.3));
colour.r = texture(scene, uv + vec2(ca, 0.0)).r;
colour.b = texture(scene, uv - vec2(ca, 0.0)).b;
@@ -134,5 +134,11 @@ void main() {
colour = mix(colour, colour * mask, u.mask_strength);
}
// Parpadeo de fósforo CRT (~50 Hz)
if (u.flicker > 0.0) {
float flicker_wave = sin(u.time * 100.0) * 0.5 + 0.5;
colour *= 1.0 - u.flicker * 0.04 * flicker_wave;
}
out_color = vec4(colour, 1.0);
}