Updates for ease of integration into Mega Bezel - changes to default gamma values and reorganisation of sdr and hdr presets

This commit is contained in:
MajorPainTheCactus 2022-05-10 22:16:30 +01:00
parent 1bd12dc7cd
commit 23f22288d0
26 changed files with 245 additions and 84 deletions

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000"
hcrt_red_scanline_min = "0.650000"
hcrt_red_scanline_max = "0.900000"

View file

@ -1,5 +1,18 @@
#reference "crt-sony-megatron-bang-olufsen-mx8000-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "2.000000"
hcrt_red_scanline_min = "0.650000"
hcrt_red_scanline_max = "0.900000"
hcrt_red_scanline_attack = "0.500000"
hcrt_green_scanline_min = "0.650000"
hcrt_green_scanline_max = "0.900000"
hcrt_green_scanline_attack = "0.500000"
hcrt_blue_scanline_min = "0.650000"
hcrt_blue_scanline_max = "0.900000"
hcrt_blue_scanline_attack = "0.500000"
hcrt_red_beam_sharpness = "1.600000"
hcrt_red_beam_attack = "1.7500000"
hcrt_green_beam_sharpness = "1.600000"
hcrt_green_beam_attack = "1.750000"
hcrt_blue_beam_sharpness = "1.600000"
hcrt_blue_beam_attack = "1.750000"

View file

@ -1,12 +1,11 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "700.000000"
hcrt_brightness = "0.200000"
hcrt_contrast = "0.000000"
hcrt_saturation = "0.000000"
hcrt_gamma_in = "-0.3000000"
hcrt_gamma_in = "1.920000"
hcrt_expand_gamut = "1.000000"
hcrt_red_scanline_min = "0.2000000"
hcrt_red_scanline_max = "1.050000"

View file

@ -1,5 +1,24 @@
#reference "crt-sony-megatron-jvc-d-series-AV-36D501-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "700.000000"
hcrt_brightness = "0.200000"
hcrt_contrast = "0.000000"
hcrt_saturation = "0.000000"
hcrt_gamma_in = "1.720000"
hcrt_expand_gamut = "1.000000"
hcrt_red_scanline_min = "0.2000000"
hcrt_red_scanline_max = "1.050000"
hcrt_red_scanline_attack = "0.300000"
hcrt_green_scanline_min = "0.200000"
hcrt_green_scanline_max = "1.050000"
hcrt_green_scanline_attack = "0.300000"
hcrt_blue_scanline_min = "0.200000"
hcrt_blue_scanline_max = "1.050000"
hcrt_blue_scanline_attack = "0.300000"
hcrt_red_beam_sharpness = "1.600000"
hcrt_red_beam_attack = "1.000000"
hcrt_green_beam_sharpness = "1.600000"
hcrt_green_beam_attack = "1.000000"
hcrt_blue_beam_sharpness = "1.600000"
hcrt_blue_beam_attack = "1.000000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_paper_white_nits = "700.000000"
hcrt_crt_screen_type = "1.000000"
hcrt_crt_resolution = "2.000000"

View file

@ -1,5 +1,24 @@
#reference "crt-sony-megatron-jvc-professional-TM-H1950CG-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_paper_white_nits = "700.000000"
hcrt_crt_screen_type = "1.000000"
hcrt_crt_resolution = "2.000000"
hcrt_expand_gamut = "1.000000"
hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "0.040000"
hcrt_blue_vertical_convergence = "0.000000"
hcrt_red_scanline_min = "0.200000"
hcrt_red_scanline_max = "0.750000"
hcrt_red_scanline_attack = "1.000000"
hcrt_green_scanline_min = "0.200000"
hcrt_green_scanline_max = "0.750000"
hcrt_green_scanline_attack = "1.000000"
hcrt_blue_scanline_min = "0.200000"
hcrt_blue_scanline_max = "0.750000"
hcrt_blue_scanline_attack = "1.000000"
hcrt_red_beam_sharpness = "1.000000"
hcrt_red_beam_attack = "1.0000000"
hcrt_green_beam_sharpness = "1.000000"
hcrt_green_beam_attack = "1.000000"
hcrt_blue_beam_sharpness = "1.000000"
hcrt_blue_beam_attack = "1.000000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "600.000000"
hcrt_contrast = "0.000000"

View file

@ -1,5 +1,21 @@
#reference "crt-sony-megatron-sammy-atomiswave-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "600.000000"
hcrt_contrast = "0.000000"
hcrt_expand_gamut = "1.000000"
hcrt_red_scanline_min = "0.8900000"
hcrt_red_scanline_max = "1.000000"
hcrt_red_scanline_attack = "0.300000"
hcrt_green_scanline_min = "0.600000"
hcrt_green_scanline_max = "0.800000"
hcrt_green_scanline_attack = "0.300000"
hcrt_blue_scanline_min = "0.600000"
hcrt_blue_scanline_max = "0.800000"
hcrt_blue_scanline_attack = "0.300000"
hcrt_red_beam_sharpness = "1.300000"
hcrt_red_beam_attack = "1.000000"
hcrt_green_beam_sharpness = "1.300000"
hcrt_green_beam_attack = "1.000000"
hcrt_blue_beam_sharpness = "1.300000"
hcrt_blue_beam_attack = "1.000000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "200.000000"
hcrt_expand_gamut = "1.000000"

View file

@ -1,5 +1,26 @@
#reference "crt-sony-megatron-sega-virtua-fighter-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "2.000000"
hcrt_paper_white_nits = "200.000000"
hcrt_expand_gamut = "1.000000"
hcrt_red_vertical_convergence = "0.200000"
hcrt_green_vertical_convergence = "0.200000"
hcrt_blue_vertical_convergence = "-0.230000"
hcrt_red_horizontal_convergence = "0.400000"
hcrt_green_horizontal_convergence = "-0.250000"
hcrt_blue_horizontal_convergence = "-0.100000"
hcrt_red_scanline_min = "1.0000000"
hcrt_red_scanline_max = "2.000000"
hcrt_red_scanline_attack = "1.000000"
hcrt_green_scanline_min = "1.000000"
hcrt_green_scanline_max = "2.000000"
hcrt_green_scanline_attack = "1.000000"
hcrt_blue_scanline_min = "1.000000"
hcrt_blue_scanline_max = "2.000000"
hcrt_blue_scanline_attack = "1.000000"
hcrt_red_beam_sharpness = "1.000000"
hcrt_red_beam_attack = "0.0000000"
hcrt_green_beam_sharpness = "1.000000"
hcrt_green_beam_attack = "0.000000"
hcrt_blue_beam_sharpness = "1.000000"
hcrt_blue_beam_attack = "0.000000"

View file

@ -1,12 +1,11 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_resolution = "0.000000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"
hcrt_brightness = "0.150000"
hcrt_saturation = "0.100000"
hcrt_gamma_in = "0.250000"
hcrt_gamma_in = "2.470000"
hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "-0.150000"
hcrt_blue_vertical_convergence = "0.000000"

View file

@ -1,5 +1,26 @@
#reference "crt-sony-megatron-sony-pvm-1910-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_resolution = "0.000000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"
hcrt_brightness = "0.150000"
hcrt_saturation = "0.100000"
hcrt_gamma_in = "2.270000"
hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "-0.150000"
hcrt_blue_vertical_convergence = "0.000000"
hcrt_red_scanline_min = "0.400000"
hcrt_red_scanline_max = "0.750000"
hcrt_red_scanline_attack = "0.350000"
hcrt_green_scanline_min = "0.400000"
hcrt_green_scanline_max = "1.000000"
hcrt_green_scanline_attack = "0.350000"
hcrt_blue_scanline_min = "0.400000"
hcrt_blue_scanline_max = "0.750000"
hcrt_blue_scanline_attack = "0.350000"
hcrt_red_beam_sharpness = "1.400000"
hcrt_red_beam_attack = "0.7200000"
hcrt_green_beam_sharpness = "1.400000"
hcrt_green_beam_attack = "0.800000"
hcrt_blue_beam_sharpness = "1.400000"
hcrt_blue_beam_attack = "0.450000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"

View file

@ -1,5 +1,24 @@
#reference "crt-sony-megatron-sony-pvm-20L4-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_brightness = "0.150000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"
hcrt_crt_resolution = "1.000000"
hcrt_red_vertical_convergence = "0.100000"
hcrt_green_vertical_convergence = "0.000000"
hcrt_blue_vertical_convergence = "0.000000"
hcrt_red_scanline_min = "0.250000"
hcrt_red_scanline_max = "0.400000"
hcrt_red_scanline_attack = "0.150000"
hcrt_green_scanline_min = "0.250000"
hcrt_green_scanline_max = "0.400000"
hcrt_green_scanline_attack = "0.150000"
hcrt_blue_scanline_min = "0.250000"
hcrt_blue_scanline_max = "0.400000"
hcrt_blue_scanline_attack = "0.150000"
hcrt_red_beam_sharpness = "2.000000"
hcrt_red_beam_attack = "1.0000000"
hcrt_green_beam_sharpness = "2.000000"
hcrt_green_beam_attack = "1.000000"
hcrt_blue_beam_sharpness = "2.000000"
hcrt_blue_beam_attack = "1.000000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"

View file

@ -1,5 +1,23 @@
#reference "crt-sony-megatron-sony-pvm-2730-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_brightness = "0.150000"
hcrt_colour_system = "3.000000"
hcrt_expand_gamut = "1.000000"
hcrt_red_vertical_convergence = "-0.140000"
hcrt_green_vertical_convergence = "0.000000"
hcrt_blue_vertical_convergence = "0.000000"
hcrt_red_scanline_min = "0.550000"
hcrt_red_scanline_max = "0.820000"
hcrt_red_scanline_attack = "0.650000"
hcrt_green_scanline_min = "0.550000"
hcrt_green_scanline_max = "0.900000"
hcrt_green_scanline_attack = "0.130000"
hcrt_blue_scanline_min = "0.720000"
hcrt_blue_scanline_max = "1.000000"
hcrt_blue_scanline_attack = "0.650000"
hcrt_red_beam_sharpness = "1.750000"
hcrt_red_beam_attack = "0.7200000"
hcrt_green_beam_sharpness = "1.600000"
hcrt_green_beam_attack = "0.800000"
hcrt_blue_beam_sharpness = "1.900000"
hcrt_blue_beam_attack = "0.450000"

View file

@ -1,4 +1,3 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "1.000000"

View file

@ -1,5 +1,3 @@
#reference "crt-sony-megatron-toshiba-microfilter-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "1.000000"

View file

@ -1,6 +1,5 @@
#reference "shaders/crt-sony-megatron.slangp"
#reference "shaders/crt-sony-megatron-hdr.slangp"
hcrt_hdr = "1.000000"
hcrt_crt_screen_type = "1.000000"
hcrt_crt_resolution = "2.000000"
hcrt_paper_white_nits = "400.000000"

View file

@ -1,5 +1,20 @@
#reference "crt-sony-megatron-viewsonic-A90f+-hdr.slangp"
#reference "shaders/crt-sony-megatron-sdr.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "-0.200000"
hcrt_crt_screen_type = "1.000000"
hcrt_crt_resolution = "2.000000"
hcrt_paper_white_nits = "400.000000"
hcrt_red_scanline_min = "0.5000000"
hcrt_red_scanline_max = "1.000000"
hcrt_red_scanline_attack = "0.350000"
hcrt_green_scanline_min = "0.550000"
hcrt_green_scanline_max = "1.000000"
hcrt_green_scanline_attack = "0.350000"
hcrt_blue_scanline_min = "0.550000"
hcrt_blue_scanline_max = "1.000000"
hcrt_blue_scanline_attack = "0.350000"
hcrt_red_beam_sharpness = "1.200000"
hcrt_red_beam_attack = "0.5000000"
hcrt_green_beam_sharpness = "1.200000"
hcrt_green_beam_attack = "0.500000"
hcrt_blue_beam_sharpness = "1.200000"
hcrt_blue_beam_attack = "0.500000"

View file

@ -0,0 +1,3 @@
#reference "crt-sony-megatron.slangp"
hcrt_hdr = "1.000000"

View file

@ -0,0 +1,5 @@
#reference "crt-sony-megatron.slangp"
hcrt_hdr = "0.000000"
hcrt_gamma_in = "2.020000"

View file

@ -415,14 +415,16 @@ void main()
const uint crt_resolution = uint(HCRT_CRT_RESOLUTION);
const uint lcd_resolution = uint(HCRT_LCD_RESOLUTION);
const uint lcd_subpixel_layout = uint(HCRT_LCD_SUBPIXEL);
const vec2 source_size = global.SourceSize.xy;
const vec2 output_size = global.OutputSize.xy;
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);
tex_coord = tex_coord + (vec2(HCRT_H_CENT, HCRT_V_CENT) / output_size);
const vec2 current_position = vTexCoord * global.OutputSize.xy;
const vec2 current_position = vTexCoord * output_size;
uint colour_mask;
@ -471,7 +473,7 @@ void main()
}
}
const float scanline_size = global.OutputSize.y / global.SourceSize.y;
const float scanline_size = output_size.y / source_size.y;
const vec3 horizontal_convergence = vec3(HCRT_RED_HORIZONTAL_CONVERGENCE, HCRT_GREEN_HORIZONTAL_CONVERGENCE, HCRT_BLUE_HORIZONTAL_CONVERGENCE);
const vec3 vertical_convergence = vec3(HCRT_RED_VERTICAL_CONVERGENCE, HCRT_GREEN_VERTICAL_CONVERGENCE, HCRT_BLUE_VERTICAL_CONVERGENCE);
@ -491,7 +493,7 @@ void main()
const float scanline_channel_0 = GenerateScanline( channel_0,
tex_coord,
global.SourceSize.xy,
source_size.xy,
scanline_size,
horizontal_convergence[channel_0],
vertical_convergence[channel_0],
@ -510,7 +512,7 @@ void main()
const float scanline_channel_1 = GenerateScanline(channel_1,
tex_coord,
global.SourceSize.xy,
source_size.xy,
scanline_size,
horizontal_convergence[channel_1],
vertical_convergence[channel_1],
@ -529,7 +531,7 @@ void main()
const float scanline_channel_2 = GenerateScanline(channel_2,
tex_coord,
global.SourceSize.xy,
source_size.xy,
scanline_size,
horizontal_convergence[channel_2],
vertical_convergence[channel_2],
@ -542,7 +544,9 @@ void main()
scanline_colour += scanline_channel_2 * kColourMask[channel_2];
}
const vec3 hdr10 = GammaCorrect(scanline_colour);
vec3 hdr10;
GammaCorrect(scanline_colour, hdr10);
FragColor = vec4(hdr10, 1.0f);
}

View file

@ -168,7 +168,7 @@ vec3 ColourGrade(const vec3 colour)
const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, colour);
const vec3 linear = pow(white_point, vec3((1.0f / 0.45f) + HCRT_GAMMA_IN));
const vec3 linear = pow(white_point, vec3(HCRT_GAMMA_IN));
const vec3 xyz = linear * kColourGamut[colour_system];

View file

@ -12,7 +12,7 @@ const mat3 kXYZ_to_DCIP3 = mat3 (
float LinearTosRGB_1(const float channel)
{
return (channel > 0.0031308f) ? (1.055f * pow(channel, (1.0f / 2.4f) + HCRT_GAMMA_OUT)) - 0.055f : channel * 12.92f;
return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / HCRT_GAMMA_OUT)) - 0.055f : channel * 12.92f;
}
vec3 LinearTosRGB(const vec3 colour)
@ -22,7 +22,7 @@ vec3 LinearTosRGB(const vec3 colour)
float LinearTo709_1(const float channel)
{
return (channel >= 0.018f) ? pow(channel * 1.099f, 0.45f + HCRT_GAMMA_OUT) - 0.099f : channel * 4.5f;
return (channel >= 0.018f) ? pow(channel * 1.099f, 1.0f / (HCRT_GAMMA_OUT - 0.18f)) - 0.099f : channel * 4.5f; // Gamma: 2.4 - 0.18 = 2.22
}
vec3 LinearTo709(const vec3 colour)
@ -32,29 +32,29 @@ vec3 LinearTo709(const vec3 colour)
vec3 LinearToDCIP3(const vec3 colour)
{
return clamp(pow(colour, vec3((1.0f / 2.6f) + HCRT_GAMMA_OUT)), 0.0f, 1.0f);
return clamp(pow(colour, vec3(1.0f / (HCRT_GAMMA_OUT + 0.2f))), 0.0f, 1.0f); // Gamma: 2.4 + 0.2 = 2.6
}
vec3 GammaCorrect(const vec3 scanline_colour)
void GammaCorrect(const vec3 scanline_colour, inout vec3 gamma_out)
{
if(HCRT_HDR < 1.0f)
{
if(HCRT_OUTPUT_COLOUR_SPACE == 0.0f)
{
return LinearTo709(scanline_colour);
gamma_out = LinearTo709(scanline_colour);
}
else if(HCRT_OUTPUT_COLOUR_SPACE == 1.0f)
{
return LinearTosRGB(scanline_colour);
gamma_out = LinearTosRGB(scanline_colour);
}
else
{
const vec3 dcip3_colour = (scanline_colour * k709_to_XYZ) * kXYZ_to_DCIP3;
return LinearToDCIP3(dcip3_colour);
gamma_out = LinearToDCIP3(dcip3_colour);
}
}
else
{
return Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT);
gamma_out = Hdr10(scanline_colour, HCRT_PAPER_WHITE_NITS, HCRT_EXPAND_GAMUT);
}
}

View file

@ -28,8 +28,8 @@
#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_in " Gamma In" 0.0 -1.0 1.0 0.01
#pragma parameter hcrt_gamma_out " Gamma Out" 0.0 -0.4 0.4 0.005
#pragma parameter hcrt_gamma_in " Gamma In" 2.22 1.22 3.22 0.01
#pragma parameter hcrt_gamma_out " Gamma Out" 2.4 2.0 2.8 0.005
#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