From 372ef75e5cadb519214816eb3021cbcc9d063354 Mon Sep 17 00:00:00 2001 From: MajorPainTheCactus Date: Sat, 9 Apr 2022 21:48:02 +0100 Subject: [PATCH] Fixed phosphor gamut being applied when sRGB colour space is used Reorganised shader parameters to be more intuitive Moved base crt-sony-megatron.slngp into the shader directory to edge users away from using it directly Passed in texcoord to functions Added vertical center, vertical size, horizontal center, horizontal size, pin phase, pin amp Added gamm_correct.h for easier integration --- ...ny-megatron-bang-olufsen-mx8000-hdr.slangp | 2 +- ...megatron-jvc-d-series-AV-36D501-hdr.slangp | 2 +- ...ron-jvc-professional-TM-H1950CG-hdr.slangp | 2 +- ...-sony-megatron-sammy-atomiswave-hdr.slangp | 2 +- ...ny-megatron-sega-virtua-fighter-hdr.slangp | 2 +- ...crt-sony-megatron-sony-pvm-1910-hdr.slangp | 2 +- ...crt-sony-megatron-sony-pvm-20L4-hdr.slangp | 2 +- ...crt-sony-megatron-sony-pvm-2730-hdr.slangp | 2 +- ...ny-megatron-toshiba-microfilter-hdr.slangp | 2 +- ...t-sony-megatron-viewsonic-A90f+-hdr.slangp | 2 +- .../crt-sony-megatron-source-pass.slang | 4 ++ hdr/shaders/crt-sony-megatron.slang | 64 ++++++++----------- hdr/{ => shaders}/crt-sony-megatron.slangp | 6 +- hdr/shaders/include/colour_grade.h | 2 +- hdr/shaders/include/gamma_correct.h | 37 +++++++++++ hdr/shaders/include/parameters.h | 57 +++++++++-------- hdr/shaders/include/scanline_generation.h | 8 ++- 17 files changed, 117 insertions(+), 81 deletions(-) rename hdr/{ => shaders}/crt-sony-megatron.slangp (92%) create mode 100644 hdr/shaders/include/gamma_correct.h diff --git a/hdr/crt-sony-megatron-bang-olufsen-mx8000-hdr.slangp b/hdr/crt-sony-megatron-bang-olufsen-mx8000-hdr.slangp index 548559a..c8daff0 100644 --- a/hdr/crt-sony-megatron-bang-olufsen-mx8000-hdr.slangp +++ b/hdr/crt-sony-megatron-bang-olufsen-mx8000-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "2.000000" diff --git a/hdr/crt-sony-megatron-jvc-d-series-AV-36D501-hdr.slangp b/hdr/crt-sony-megatron-jvc-d-series-AV-36D501-hdr.slangp index 2956d6f..7c2637a 100644 --- a/hdr/crt-sony-megatron-jvc-d-series-AV-36D501-hdr.slangp +++ b/hdr/crt-sony-megatron-jvc-d-series-AV-36D501-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "2.000000" diff --git a/hdr/crt-sony-megatron-jvc-professional-TM-H1950CG-hdr.slangp b/hdr/crt-sony-megatron-jvc-professional-TM-H1950CG-hdr.slangp index 3f87974..6779685 100644 --- a/hdr/crt-sony-megatron-jvc-professional-TM-H1950CG-hdr.slangp +++ b/hdr/crt-sony-megatron-jvc-professional-TM-H1950CG-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_paper_white_nits = "700.000000" diff --git a/hdr/crt-sony-megatron-sammy-atomiswave-hdr.slangp b/hdr/crt-sony-megatron-sammy-atomiswave-hdr.slangp index 2ec5076..4f1277e 100644 --- a/hdr/crt-sony-megatron-sammy-atomiswave-hdr.slangp +++ b/hdr/crt-sony-megatron-sammy-atomiswave-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "2.000000" diff --git a/hdr/crt-sony-megatron-sega-virtua-fighter-hdr.slangp b/hdr/crt-sony-megatron-sega-virtua-fighter-hdr.slangp index 167df3f..35cc53e 100644 --- a/hdr/crt-sony-megatron-sega-virtua-fighter-hdr.slangp +++ b/hdr/crt-sony-megatron-sega-virtua-fighter-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "2.000000" diff --git a/hdr/crt-sony-megatron-sony-pvm-1910-hdr.slangp b/hdr/crt-sony-megatron-sony-pvm-1910-hdr.slangp index feaee48..76d76a6 100644 --- a/hdr/crt-sony-megatron-sony-pvm-1910-hdr.slangp +++ b/hdr/crt-sony-megatron-sony-pvm-1910-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_resolution = "0.000000" diff --git a/hdr/crt-sony-megatron-sony-pvm-20L4-hdr.slangp b/hdr/crt-sony-megatron-sony-pvm-20L4-hdr.slangp index c7ab29a..02022bf 100644 --- a/hdr/crt-sony-megatron-sony-pvm-20L4-hdr.slangp +++ b/hdr/crt-sony-megatron-sony-pvm-20L4-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_brightness = "0.150000" diff --git a/hdr/crt-sony-megatron-sony-pvm-2730-hdr.slangp b/hdr/crt-sony-megatron-sony-pvm-2730-hdr.slangp index efe9d04..baffcaa 100644 --- a/hdr/crt-sony-megatron-sony-pvm-2730-hdr.slangp +++ b/hdr/crt-sony-megatron-sony-pvm-2730-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_brightness = "0.150000" diff --git a/hdr/crt-sony-megatron-toshiba-microfilter-hdr.slangp b/hdr/crt-sony-megatron-toshiba-microfilter-hdr.slangp index 424602a..95d528b 100644 --- a/hdr/crt-sony-megatron-toshiba-microfilter-hdr.slangp +++ b/hdr/crt-sony-megatron-toshiba-microfilter-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "1.000000" diff --git a/hdr/crt-sony-megatron-viewsonic-A90f+-hdr.slangp b/hdr/crt-sony-megatron-viewsonic-A90f+-hdr.slangp index 42ba85f..2e0f1ad 100644 --- a/hdr/crt-sony-megatron-viewsonic-A90f+-hdr.slangp +++ b/hdr/crt-sony-megatron-viewsonic-A90f+-hdr.slangp @@ -1,4 +1,4 @@ -#reference "crt-sony-megatron.slangp" +#reference "shaders/crt-sony-megatron.slangp" hcrt_hdr = "1.000000" hcrt_crt_screen_type = "1.000000" diff --git a/hdr/shaders/crt-sony-megatron-source-pass.slang b/hdr/shaders/crt-sony-megatron-source-pass.slang index 403b507..e8ce673 100644 --- a/hdr/shaders/crt-sony-megatron-source-pass.slang +++ b/hdr/shaders/crt-sony-megatron-source-pass.slang @@ -25,6 +25,8 @@ THIS SHADER DOES NOT SUPPORT WRGB OLED (Due to the sub pixel layout of WRGB - RG layout(push_constant) uniform Push { + float hcrt_hdr; + float hcrt_colour_space; float hcrt_max_nits; float hcrt_paper_white_nits; float hcrt_lcd_resolution; @@ -49,6 +51,8 @@ layout(std140, set = 0, binding = 0) uniform UBO #include "include/parameters.h" +#define HCRT_HDR params.hcrt_hdr +#define HCRT_OUTPUT_COLOUR_SPACE params.hcrt_colour_space #define HCRT_CRT_COLOUR_SYSTEM params.hcrt_colour_system #define HCRT_WHITE_TEMPERATURE params.hcrt_white_temperature #define HCRT_BRIGHTNESS params.hcrt_brightness diff --git a/hdr/shaders/crt-sony-megatron.slang b/hdr/shaders/crt-sony-megatron.slang index a85a405..a24b260 100644 --- a/hdr/shaders/crt-sony-megatron.slang +++ b/hdr/shaders/crt-sony-megatron.slang @@ -77,6 +77,13 @@ layout(std140, set = 0, binding = 0) uniform UBO vec4 OriginalSize; vec4 OutputSize; uint FrameCount; + + float hcrt_h_size; + float hcrt_v_size; + float hcrt_h_cent; + float hcrt_v_cent; + float hcrt_pin_phase; + float hcrt_pin_amp; } global; #include "include/parameters.h" @@ -117,6 +124,13 @@ layout(std140, set = 0, binding = 0) uniform UBO #define HCRT_BLUE_BEAM_SHARPNESS params.hcrt_blue_beam_sharpness #define HCRT_BLUE_BEAM_ATTACK params.hcrt_blue_beam_attack +#define HCRT_H_SIZE global.hcrt_h_size +#define HCRT_V_SIZE global.hcrt_v_size +#define HCRT_H_CENT global.hcrt_h_cent +#define HCRT_V_CENT global.hcrt_v_cent +#define HCRT_PIN_PHASE global.hcrt_pin_phase +#define HCRT_PIN_AMP global.hcrt_pin_amp + #define COMPAT_TEXTURE(c, d) texture(c, d) #pragma stage vertex @@ -393,44 +407,7 @@ const uint kBlackWhiteMasks[kResolutionAxis][kTVLAxis][kBGRAxis][kMaxBlackWhiteS #include "include/scanline_generation.h" #include "include/hdr10.h" - -// SDR Colour output spaces -float sRGBToLinear_1(const float channel) -{ - return (channel > 0.04045f) ? pow((channel + 0.055f) * (1.0f / 1.055f), 2.4f + HCRT_GAMMA) : channel * (1.0f / 12.92f); -} - -vec3 sRGBToLinear(const vec3 colour) -{ - return vec3(sRGBToLinear_1(colour.r), sRGBToLinear_1(colour.g), sRGBToLinear_1(colour.b)); -} - -float LinearTosRGB_1(const float channel) -{ - return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / 2.4f)) - 0.055f : channel * 12.92f; -} - -vec3 LinearTosRGB(const vec3 colour) -{ - return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b)); -} - -vec3 LinearToDCIP3(const vec3 colour) -{ - return pow(colour, vec3(1.0f / 2.6f)); -} - -vec3 GammaCorrect(const vec3 scanline_colour) -{ - if(HCRT_HDR < 1.0f) - { - return HCRT_OUTPUT_COLOUR_SPACE == 0.0f ? LinearTosRGB(scanline_colour) : LinearToDCIP3(scanline_colour); - } - else - { - return Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT); - } -} +#include "include/gamma_correct.h" void main() { @@ -439,6 +416,12 @@ void main() const uint lcd_resolution = uint(HCRT_LCD_RESOLUTION); const uint lcd_subpixel_layout = uint(HCRT_LCD_SUBPIXEL); + vec2 tex_coord = vTexCoord - vec2(0.5f); + tex_coord = tex_coord * vec2(1.0f + (HCRT_PIN_PHASE * tex_coord.y), 1.0f); + tex_coord = tex_coord * vec2(HCRT_H_SIZE, HCRT_V_SIZE); + tex_coord = tex_coord + vec2(0.5f); + tex_coord = tex_coord + (vec2(HCRT_H_CENT, HCRT_V_CENT) / global.OutputSize.xy); + const vec2 current_position = vTexCoord * global.OutputSize.xy; uint colour_mask; @@ -506,7 +489,8 @@ void main() { const uint channel_0 = (colour_mask >> kFirstChannelShift) & 3; - const float scanline_channel_0 = GenerateScanline(channel_0, + const float scanline_channel_0 = GenerateScanline( channel_0, + tex_coord, global.SourceSize.xy, scanline_size, horizontal_convergence[channel_0], @@ -525,6 +509,7 @@ void main() const uint channel_1 = (colour_mask >> kSecondChannelShift) & 3; const float scanline_channel_1 = GenerateScanline(channel_1, + tex_coord, global.SourceSize.xy, scanline_size, horizontal_convergence[channel_1], @@ -543,6 +528,7 @@ void main() const uint channel_2 = (colour_mask >> kThirdChannelShift) & 3; const float scanline_channel_2 = GenerateScanline(channel_2, + tex_coord, global.SourceSize.xy, scanline_size, horizontal_convergence[channel_2], diff --git a/hdr/crt-sony-megatron.slangp b/hdr/shaders/crt-sony-megatron.slangp similarity index 92% rename from hdr/crt-sony-megatron.slangp rename to hdr/shaders/crt-sony-megatron.slangp index 0224c94..3da5814 100644 --- a/hdr/crt-sony-megatron.slangp +++ b/hdr/shaders/crt-sony-megatron.slangp @@ -29,7 +29,7 @@ DONT USE THIS PRESET DIRECTLY - Use any of the others in this directory shaders = "3" feedback_pass = "0" -shader0 = "shaders/crt-sony-megatron-source-pass.slang" +shader0 = "crt-sony-megatron-source-pass.slang" filter_linear0 = "false" scale_type0 = "source" scale0 = "1.0" @@ -37,7 +37,7 @@ wrap_mode0 = "clamp_to_border" mipmap_input0 = "false" alias0 = "SourceSDR" -shader1 = "shaders/crt-sony-megatron-hdr-pass.slang" +shader1 = "crt-sony-megatron-hdr-pass.slang" filter_linear1 = "false" scale_type1 = "source" scale1 = "1.0" @@ -45,7 +45,7 @@ wrap_mode1 = "clamp_to_border" mipmap_input1 = "false" alias1 = "SourceHDR" -shader2 = "shaders/crt-sony-megatron.slang" +shader2 = "crt-sony-megatron.slang" filter_linear2 = "false" wrap_mode2 = "clamp_to_border" mipmap_input2 = "false" diff --git a/hdr/shaders/include/colour_grade.h b/hdr/shaders/include/colour_grade.h index acdc9fa..e953011 100644 --- a/hdr/shaders/include/colour_grade.h +++ b/hdr/shaders/include/colour_grade.h @@ -217,7 +217,7 @@ vec3 ColourGrade(const vec3 colour) const vec3 graded = BrightnessContrastSaturation(linear); - const vec3 gamut = kPhosphorGamut[colour_system] * graded; + const vec3 gamut = (HCRT_HDR == 0.0f) && (HCRT_OUTPUT_COLOUR_SPACE == 0.0f) ? graded : kPhosphorGamut[colour_system] * graded; const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, gamut); diff --git a/hdr/shaders/include/gamma_correct.h b/hdr/shaders/include/gamma_correct.h new file mode 100644 index 0000000..d2c86c8 --- /dev/null +++ b/hdr/shaders/include/gamma_correct.h @@ -0,0 +1,37 @@ +// SDR Colour output spaces +float sRGBToLinear_1(const float channel) +{ + return (channel > 0.04045f) ? pow((channel + 0.055f) * (1.0f / 1.055f), 2.4f + HCRT_GAMMA) : channel * (1.0f / 12.92f); +} + +vec3 sRGBToLinear(const vec3 colour) +{ + return vec3(sRGBToLinear_1(colour.r), sRGBToLinear_1(colour.g), sRGBToLinear_1(colour.b)); +} + +float LinearTosRGB_1(const float channel) +{ + return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / 2.4f)) - 0.055f : channel * 12.92f; +} + +vec3 LinearTosRGB(const vec3 colour) +{ + return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b)); +} + +vec3 LinearToDCIP3(const vec3 colour) +{ + return pow(colour, vec3(1.0f / 2.6f)); +} + +vec3 GammaCorrect(const vec3 scanline_colour) +{ + if(HCRT_HDR < 1.0f) + { + return HCRT_OUTPUT_COLOUR_SPACE == 0.0f ? LinearTosRGB(scanline_colour) : LinearToDCIP3(scanline_colour); + } + else + { + return Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT); + } +} \ No newline at end of file diff --git a/hdr/shaders/include/parameters.h b/hdr/shaders/include/parameters.h index cd31985..813bbca 100644 --- a/hdr/shaders/include/parameters.h +++ b/hdr/shaders/include/parameters.h @@ -1,38 +1,38 @@ -#pragma parameter hcrt_title "SONY MEGATRON COLOUR VIDEO MONITOR" 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_space0 " " 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_support0 "SDR mode: Turn up your TV's brightness as high as possible" 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_support1 "HDR mode: Set the peak luminance to that of your TV." 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_support2 "Then adjust paper white luminance until it looks right" 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_space1 " " 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_user_settings "USER SETTINGS:" 0.0 0.0 0.0001 0.0 +#pragma parameter hcrt_title "SONY MEGATRON COLOUR VIDEO MONITOR" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_space0 " " 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_support0 "SDR mode: Turn up your TV's brightness as high as possible" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_support1 "HDR mode: Set the peak luminance to that of your TV." 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_support2 "Then adjust paper white luminance until it looks right" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_space1 " " 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_user_settings "YOUR DISPLAY SETTINGS:" 0.0 0.0 0.0001 0.0001 #pragma parameter hcrt_hdr " SDR | HDR" 1.0 0.0 1.0 1.0 +#pragma parameter hcrt_colour_space " SDR: Display's Colour Space: sRGB | DCI-P3" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_max_nits " HDR: Display's Peak Luminance" 700.0 0.0 10000.0 10.0 #pragma parameter hcrt_paper_white_nits " HDR: Display's Paper White Luminance" 700.0 0.0 10000.0 10.0 -#pragma parameter hcrt_colour_space " SDR: Display's Colour Space: sRGB | DCI-P3" 0.0 0.0 1.0 1.0 +#pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_lcd_resolution " Display's Resolution: 4K | 8K" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_lcd_subpixel " Display's Subpixel Layout: RGB | BGR" 0.0 0.0 1.0 1.0 -#pragma parameter hcrt_red_vertical_convergence " Red Vertical Convergence" 0.00 -10.0 10.0 0.01 -#pragma parameter hcrt_green_vertical_convergence " Green Vertical Convergence" 0.00 -10.0 10.0 0.01 -#pragma parameter hcrt_blue_vertical_convergence " Blue Vertical Convergence" 0.00 -10.0 10.0 0.01 -#pragma parameter hcrt_red_horizontal_convergence " Red Horizontal Convergence" 0.00 -10.0 10.0 0.01 -#pragma parameter hcrt_green_horizontal_convergence " Green Horizontal Convergence" 0.00 -10.0 10.0 0.01 -#pragma parameter hcrt_blue_horizontal_convergence " Blue Horizontal Convergence" 0.00 -10.0 10.0 0.01 - -#pragma parameter hcrt_space3 " " 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_developer_settings "DEVELOPER SETTINGS:" 0.0 0.0 0.0001 0.0 -#pragma parameter hcrt_crt_screen_type " CRT Type: APERTURE GRILLE | SHADOW MASK | SLOT MASK" 0.0 0.0 3.0 1.0 -#pragma parameter hcrt_crt_resolution " CRT Resolution: 300TVL | 600TVL | 800TVL | 1000TVL" 1.0 0.0 3.0 1.0 -#pragma parameter hcrt_colour_system " CRT Colour System: PAL | NTSC-U | NTSC-J" 1.0 0.0 2.0 1.0 -#pragma parameter hcrt_white_temperature " White Point: (PAL:D65, NTSC-U:D65, NTSC-J:D93)" 0.0 -5000.0 12000.0 100.0 -#pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0 +#pragma parameter hcrt_space2 " " 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_developer_settings "CRT SETTINGS:" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_crt_screen_type " Screen Type: APERTURE GRILLE | SHADOW MASK | SLOT MASK" 0.0 0.0 3.0 1.0 +#pragma parameter hcrt_crt_resolution " Resolution: 300TVL | 600TVL | 800TVL | 1000TVL" 1.0 0.0 3.0 1.0 +#pragma parameter hcrt_colour_system " Colour System: PAL 6500K | NTSC-U 6500K | NTSC-J 9300K" 1.0 0.0 2.0 1.0 +#pragma parameter hcrt_white_temperature " White Temperature Offset (Kelvin)" 0.0 -5000.0 12000.0 100.0 #pragma parameter hcrt_brightness " Brightness" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_contrast " Contrast" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_saturation " Saturation" 0.0 -1.0 1.0 0.01 #pragma parameter hcrt_gamma " Gamma" 0.0 -1.0 1.0 0.01 - -#pragma parameter hcrt_developer_settings0 " VERTICAL SETTINGS:" 0.0 0.0 0.0001 0.0 +#pragma parameter hcrt_pin_phase " Pin Phase" 0.00 -0.2 0.2 0.01 +#pragma parameter hcrt_pin_amp " Pin Amp" 0.00 -0.2 0.2 0.01 +#pragma parameter hcrt_space3 " " 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_developer_settings0 " VERTICAL SETTINGS:" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_v_size " Vertical Size" 1.00 0.8 1.2 0.01 +#pragma parameter hcrt_v_cent " Vertical Center" 0.00 -200.0 200.0 1.0 +#pragma parameter hcrt_red_vertical_convergence " Red Vertical Deconvergence" 0.00 -10.0 10.0 0.01 +#pragma parameter hcrt_green_vertical_convergence " Green Vertical Deconvergence" 0.00 -10.0 10.0 0.01 +#pragma parameter hcrt_blue_vertical_convergence " Blue Vertical Deconvergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_red_scanline_min " Red Scanline Min" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_red_scanline_max " Red Scanline Max" 1.00 0.0 2.0 0.01 #pragma parameter hcrt_red_scanline_attack " Red Scanline Attack" 0.20 0.0 1.0 0.01 @@ -42,7 +42,13 @@ #pragma parameter hcrt_blue_scanline_min " Blue Scanline Min" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_blue_scanline_max " Blue Scanline Max" 1.00 0.0 2.0 0.01 #pragma parameter hcrt_blue_scanline_attack " Blue Scanline Attack" 0.20 0.0 1.0 0.01 -#pragma parameter hcrt_developer_settings1 " HORIZONTAL SETTINGS:" 0.0 0.0 0.0001 0.0 +#pragma parameter hcrt_space4 " " 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_developer_settings1 " HORIZONTAL SETTINGS:" 0.0 0.0 0.0001 0.0001 +#pragma parameter hcrt_h_size " Horizontal Size" 1.00 0.8 1.2 0.01 +#pragma parameter hcrt_h_cent " Horizontal Center" 0.00 -200.0 200.0 1.0 +#pragma parameter hcrt_red_horizontal_convergence " Red Horizontal Deconvergence" 0.00 -10.0 10.0 0.01 +#pragma parameter hcrt_green_horizontal_convergence " Green Horizontal Deconvergence" 0.00 -10.0 10.0 0.01 +#pragma parameter hcrt_blue_horizontal_convergence " Blue Horizontal Deconvergence" 0.00 -10.0 10.0 0.01 #pragma parameter hcrt_red_beam_sharpness " Red Beam Sharpness" 1.75 0.0 5.0 0.05 #pragma parameter hcrt_red_beam_attack " Red Beam Attack" 0.50 0.0 2.0 0.01 #pragma parameter hcrt_green_beam_sharpness " Green Beam Sharpness" 1.75 0.0 5.0 0.05 @@ -50,4 +56,3 @@ #pragma parameter hcrt_blue_beam_sharpness " Blue Beam Sharpness" 1.75 0.0 5.0 0.05 #pragma parameter hcrt_blue_beam_attack " Blue Beam Attack" 0.50 0.0 2.0 0.01 - diff --git a/hdr/shaders/include/scanline_generation.h b/hdr/shaders/include/scanline_generation.h index 4e1b1cc..e42f718 100644 --- a/hdr/shaders/include/scanline_generation.h +++ b/hdr/shaders/include/scanline_generation.h @@ -29,6 +29,7 @@ vec4 BeamControlPoints(const float beam_attack, const bool falloff) } float ScanlineColour(const uint channel, + const vec2 tex_coord, const vec2 source_size, const float scanline_size, const float source_tex_coord_x, @@ -40,7 +41,7 @@ float ScanlineColour(const uint channel, const float scanline_attack, inout float next_prev) { - const float current_source_position_y = ((vTexCoord.y * source_size.y) - vertical_convergence) + next_prev; + const float current_source_position_y = ((tex_coord.y * source_size.y) - vertical_convergence) + next_prev; const float current_source_center_y = floor(current_source_position_y) + 0.5f; const float source_tex_coord_y = current_source_center_y / source_size.y; @@ -79,6 +80,7 @@ float ScanlineColour(const uint channel, } float GenerateScanline( const uint channel, + const vec2 tex_coord, const vec2 source_size, const float scanline_size, const float horizontal_convergence, @@ -89,7 +91,7 @@ float GenerateScanline( const uint channel, const float scanline_max, const float scanline_attack) { - const float current_source_position_x = (vTexCoord.x * source_size.x) - horizontal_convergence; + const float current_source_position_x = (tex_coord.x * source_size.x) - horizontal_convergence; const float current_source_center_x = floor(current_source_position_x) + 0.5f; const float source_tex_coord_x = current_source_center_x / source_size.x; @@ -101,6 +103,7 @@ float GenerateScanline( const uint channel, float next_prev = 0.0f; const float scanline_colour0 = ScanlineColour( channel, + tex_coord, source_size, scanline_size, source_tex_coord_x, @@ -117,6 +120,7 @@ float GenerateScanline( const uint channel, if(scanline_max > 1.0f) { scanline_colour1 = ScanlineColour( channel, + tex_coord, source_size, scanline_size, source_tex_coord_x,