corregides les scanlines per a paletes amb fondo blanc

This commit is contained in:
2026-03-25 18:31:36 +01:00
parent 6497e26202
commit 8ff1073e4a
6 changed files with 3088 additions and 2104 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1445,5 +1445,6 @@ static const uint8_t kpostfx_vert_spv[] = {
0x38,
0x00,
0x01,
0x00};
0x00,
};
static const size_t kpostfx_vert_spv_size = 1444;

View File

@@ -135,12 +135,14 @@ fragment float4 postfx_fs(PostVOut in [[stage_in]],
// calcular la posición dentro de la fila en coordenadas físicas.
// 3x: 1 dark + 2 bright. 4x: 1 dark + 3 bright.
// bright=3.5×, dark floor=0.42 (mantiene aspecto CRT original).
// ** MOD ** bright=1.0×, dark floor=0.42 (mantiene aspecto CRT original).
if (u.scanline_strength > 0.0f) {
float ps = max(1.0f, round(u.pixel_scale));
float frac_in_row = fract(uv.y * u.screen_height);
float row_pos = floor(frac_in_row * ps);
float is_dark = step(ps - 1.0f, row_pos);
float scan = mix(3.5f, 0.42f, is_dark);
//float scan = mix(3.5f, 0.42f, is_dark);
float scan = mix(1.0f, 0.42f, is_dark);
colour *= mix(1.0f, scan, u.scanline_strength);
}
@@ -388,10 +390,10 @@ namespace Rendering {
std::memcpy(mapped, pixels, static_cast<size_t>(width * height * 4));
} else {
// Path con supersampling: expande cada pixel a OS×OS, oscurece última fila.
// Replica la fórmula del shader: mix(3.5, 0.42, scanline_strength).
// Replica la fórmula del shader: mix(1.0, 0.42, scanline_strength).
auto* out = static_cast<Uint32*>(mapped);
const int OS = oversample_;
const float BRIGHT_MUL = 1.0F + (baked_scanline_strength_ * 2.5F); // rows 0..OS-2
const float BRIGHT_MUL = 1.0F; // rows 0..OS-2 (bright = 1.0×, sin amplificación)
const float DARK_MUL = 1.0F - (baked_scanline_strength_ * 0.58F); // row OS-1
for (int y = 0; y < height; ++y) {