71 lines
2.6 KiB
GLSL
71 lines
2.6 KiB
GLSL
#version 330
|
|
// FBC: NIGHT SHIFT — corruption-keyed post FX + S12 bloom and colour grade.
|
|
// VHS scanlines/noise, chromatic aberration, red Hiss tint, teal-shadow /
|
|
// warm-highlight grade, damage flash and vignette, all keyed to corruption.
|
|
|
|
in vec2 fragTexCoord;
|
|
in vec4 fragColor;
|
|
|
|
out vec4 finalColor;
|
|
|
|
uniform sampler2D texture0; // scene
|
|
uniform sampler2D texture1; // half-res blurred bloom
|
|
uniform vec4 colDiffuse;
|
|
|
|
uniform float uTime = 0.0;
|
|
uniform float uCorruption = 0.05;
|
|
uniform float uDamage = 0.0;
|
|
|
|
float hash(vec2 p) {
|
|
return fract(sin(dot(p, vec2(127.1, 311.7))) * 43758.5453);
|
|
}
|
|
|
|
void main() {
|
|
vec2 uv = fragTexCoord;
|
|
|
|
// Chromatic aberration: subtle, grows with corruption + on damage.
|
|
float aberr = 0.0003 + 0.0010 * uCorruption + 0.004 * uDamage;
|
|
vec2 dir = uv - vec2(0.5);
|
|
float dist = length(dir);
|
|
vec2 off = dir * dist * aberr * 3.0;
|
|
vec3 col = vec3(
|
|
texture(texture0, uv + off).r,
|
|
texture(texture0, uv).g,
|
|
texture(texture0, uv - off).b);
|
|
|
|
// VHS scanlines + rolling noise (intensity keys to corruption).
|
|
float scan = sin(uv.y * 720.0) * 0.5 + 0.5;
|
|
col *= 1.0 - 0.055 * scan * (0.5 + 0.5 * clamp(uCorruption, 0.0, 1.5));
|
|
float n = hash(uv * vec2(1024.0, 1024.0) + fract(uTime) * 61.7);
|
|
col += (n - 0.5) * (0.012 + 0.025 * clamp(uCorruption, 0.0, 1.5));
|
|
|
|
// Red Hiss tint breathing with corruption.
|
|
float hiss = clamp(uCorruption * 0.12, 0.0, 0.45);
|
|
col = mix(col, col * vec3(1.08, 0.93, 0.93) + vec3(0.05, 0.0, 0.0), hiss);
|
|
|
|
// Grade: cool the shadows, warm the highlights — Control's graphite with
|
|
// RoR2's clean value separation rather than a flat grey image.
|
|
float lum = dot(col, vec3(0.299, 0.587, 0.114));
|
|
vec3 cool = vec3(0.82, 0.94, 1.09);
|
|
vec3 warm = vec3(1.12, 0.99, 0.90);
|
|
col *= mix(cool, warm, smoothstep(0.18, 0.82, lum));
|
|
col.r += 0.018 * smoothstep(0.55, 0.95, lum);
|
|
// Gentle S-curve: separate graphite shadows from paper highlights a little
|
|
// more without crushing the dark diorama or clipping under bloom.
|
|
col = mix(col, col * col * (3.0 - 2.0 * col), 0.35);
|
|
col *= 1.05;
|
|
|
|
// Bloom from fluorescent strips, crystals and Hiss resin.
|
|
vec3 bloom = texture(texture1, uv).rgb;
|
|
col += bloom * (1.30 + 0.20 * uCorruption);
|
|
|
|
// Damage flash: red bloom.
|
|
col = mix(col, vec3(0.8, 0.05, 0.07), uDamage * 0.35);
|
|
|
|
// Vignette (tightens as the House decays).
|
|
float vig = 1.0 - smoothstep(0.45, 1.05, dist) * (0.42 + 0.12 * uCorruption);
|
|
col *= vig;
|
|
|
|
col *= 1.10;
|
|
finalColor = vec4(col, 1.0) * colDiffuse * fragColor;
|
|
}
|