From ef702029d83af7d8cb22be9c9b9b10679ccbc436 Mon Sep 17 00:00:00 2001 From: Hyllian Date: Sat, 17 Aug 2024 14:10:34 -0300 Subject: [PATCH] Fix color clipping in crt-hyllian (#624) - Fiz color clipping. --- crt/shaders/hyllian/crt-hyllian-base.slang | 6 +----- crt/shaders/hyllian/support/glow/blur-glow-mask-geom.slang | 6 ++++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/crt/shaders/hyllian/crt-hyllian-base.slang b/crt/shaders/hyllian/crt-hyllian-base.slang index ebd0ab8e..adb4f7b5 100644 --- a/crt/shaders/hyllian/crt-hyllian-base.slang +++ b/crt/shaders/hyllian/crt-hyllian-base.slang @@ -35,7 +35,6 @@ layout(push_constant) uniform Push float BEAM_MAX_WIDTH; float SCANLINES_STRENGTH; float SCANLINES_SHAPE; - float BRIGHTBOOST; float SHARPNESS_HACK; float SCANLINES_CUTOFF; float SCANLINES_HIRES; @@ -60,7 +59,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #pragma parameter SCANLINES_SHAPE " SCANLINES SHAPE [ Sharp | Soft ]" 1.0 0.0 1.0 1.0 #pragma parameter PHOSPHOR_LAYOUT " MASK [1..6 Aperture, 7..10 Shadow, 11..14 Slot]" 1.0 0.0 15.0 1.0 #pragma parameter MASK_STRENGTH " MASK STRENGTH" 0.0 0.0 1.0 0.02 -#pragma parameter BRIGHTBOOST "BRIGHTBOOST" 1.0 1.0 2.0 0.01 +#pragma parameter BRIGHTBOOST "BRIGHTBOOST" 1.0 0.5 2.0 0.01 #pragma parameter MONITOR_SUBPIXELS "MONITOR SUBPIXELS LAYOUT [ RGB | BGR ]" 0.0 0.0 1.0 1.0 #pragma parameter SCANLINES_CUTOFF "SCANLINES CUTOFF" 400.0 0.0 1000.0 2.0 #pragma parameter SCANLINES_HIRES "HIGH RESOLUTION SCANLINES" 0.0 0.0 1.0 1.0 @@ -70,7 +69,6 @@ layout(std140, set = 0, binding = 0) uniform UBO #pragma parameter CRT_ANTI_RINGING "ANTI RINGING" 1.0 0.0 1.0 1.0 #define CRT_ANTI_RINGING params.CRT_ANTI_RINGING -#define BRIGHTBOOST params.BRIGHTBOOST #define SHARPNESS_HACK params.SHARPNESS_HACK #define SCANLINES_SHAPE params.SCANLINES_SHAPE #define SCANLINES_STRENGTH (-0.16*SCANLINES_SHAPE+params.SCANLINES_STRENGTH) @@ -239,8 +237,6 @@ void main() vec3 d1 = scanlines_strength*pos1/(lum1*lum1+0.0000001); vec3 color = (draw_scanlines > 0.5) ? get_scanlines(d0, d1, color0, color1, scanlines_shape) : texture(Source, vTexCoord).xyz; - - color *= BRIGHTBOOST; FragColor = vec4(color, 1.0); } diff --git a/crt/shaders/hyllian/support/glow/blur-glow-mask-geom.slang b/crt/shaders/hyllian/support/glow/blur-glow-mask-geom.slang index 6bc73da8..ed7b3b72 100644 --- a/crt/shaders/hyllian/support/glow/blur-glow-mask-geom.slang +++ b/crt/shaders/hyllian/support/glow/blur-glow-mask-geom.slang @@ -9,6 +9,7 @@ layout(push_constant) uniform Push float DISPLAY_RES; float PHOSPHOR_LAYOUT; float MASK_STRENGTH; + float BRIGHTBOOST; float MONITOR_SUBPIXELS; float VSCANLINES; float H_OUTPUT_GAMMA; @@ -45,6 +46,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #pragma parameter PRESET_OPTION "PRESET [0=Custom, Aperture1, Aperture2, Slot1, Slot2, Shadow]" 0.0 0.0 5.0 1.0 #pragma parameter PHOSPHOR_LAYOUT " MASK [1..6 Aperture, 7..10 Shadow, 11..14 Slot]" 1.0 0.0 15.0 1.0 #pragma parameter MASK_STRENGTH " MASK STRENGTH" 0.0 0.0 1.0 0.02 +#pragma parameter BRIGHTBOOST "BRIGHTBOOST" 1.0 0.5 2.0 0.01 #pragma parameter MONITOR_SUBPIXELS "MONITOR SUBPIXELS LAYOUT [ RGB | BGR ]" 0.0 0.0 1.0 1.0 #pragma parameter VSCANLINES "VERTICAL SCANLINES [ Off | On ]" 0.0 0.0 1.0 1.0 @@ -61,7 +63,7 @@ layout(std140, set = 0, binding = 0) uniform UBO #pragma parameter geom_overscan_x "Geom Horiz. Overscan %" 100.0 -125.0 125.0 0.5 #pragma parameter geom_overscan_y "Geom Vert. Overscan %" 100.0 -125.0 125.0 0.5 - +#define BRIGHTBOOST params.BRIGHTBOOST #define DISPLAY_RES params.DISPLAY_RES #define GLOW_ENABLE params.GLOW_ENABLE #define GLOW_RADIUS params.GLOW_RADIUS @@ -552,7 +554,7 @@ void main() mask_wgts = (MONITOR_SUBPIXELS > 0.5) ? mask_wgts.bgr : mask_wgts; // CRT + Bloom + Mask + Curvature - vec3 crt = texture(CRTPass, uv).rgb; + vec3 crt = BRIGHTBOOST * texture(CRTPass, uv).rgb; crt += GLOW_STRENGTH * bloom;