Merge pull request #248 from MajorPainTheCactus/megatron_3_2

V3.2 Sony Megatron Shader
This commit is contained in:
hizzlekizzle 2022-04-16 17:42:47 -05:00 committed by GitHub
commit 1bd12dc7cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 106 additions and 146 deletions

View file

@ -43,8 +43,6 @@ hcrt_crt_screen_type = "2.000000"
hcrt_crt_resolution = "0.000000" hcrt_crt_resolution = "0.000000"
hcrt_paper_white_nits = "700.000000" hcrt_paper_white_nits = "700.000000"
hcrt_expand_gamut = "0.000000" hcrt_expand_gamut = "0.000000"
hcrt_white_temperature = "0.000000"
hcrt_gamma = "0.000000"
hcrt_red_vertical_convergence = "0.000000" hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "0.000000" hcrt_green_vertical_convergence = "0.000000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -6,7 +6,7 @@ hcrt_paper_white_nits = "700.000000"
hcrt_brightness = "0.200000" hcrt_brightness = "0.200000"
hcrt_contrast = "0.000000" hcrt_contrast = "0.000000"
hcrt_saturation = "0.000000" hcrt_saturation = "0.000000"
hcrt_gamma = "-0.3000000" hcrt_gamma_in = "-0.3000000"
hcrt_expand_gamut = "1.000000" hcrt_expand_gamut = "1.000000"
hcrt_red_scanline_min = "0.2000000" hcrt_red_scanline_min = "0.2000000"
hcrt_red_scanline_max = "1.050000" hcrt_red_scanline_max = "1.050000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,13 +2,11 @@
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_crt_resolution = "0.000000" hcrt_crt_resolution = "0.000000"
hcrt_colour_system = "0.000000" hcrt_colour_system = "3.000000"
hcrt_white_temperature = "2800.000000"
hcrt_expand_gamut = "1.000000" hcrt_expand_gamut = "1.000000"
hcrt_brightness = "0.150000" hcrt_brightness = "0.150000"
hcrt_contrast = "0.000000"
hcrt_saturation = "0.100000" hcrt_saturation = "0.100000"
hcrt_gamma = "0.250000" hcrt_gamma_in = "0.250000"
hcrt_red_vertical_convergence = "0.000000" hcrt_red_vertical_convergence = "0.000000"
hcrt_green_vertical_convergence = "-0.150000" hcrt_green_vertical_convergence = "-0.150000"
hcrt_blue_vertical_convergence = "0.000000" hcrt_blue_vertical_convergence = "0.000000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,11 +2,8 @@
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000" hcrt_brightness = "0.150000"
hcrt_colour_system = "0.000000" hcrt_colour_system = "3.000000"
hcrt_white_temperature = "2800.000000"
hcrt_expand_gamut = "1.000000" hcrt_expand_gamut = "1.000000"
hcrt_contrast = "0.000000"
hcrt_gamma = "0.000000"
hcrt_crt_resolution = "1.000000" hcrt_crt_resolution = "1.000000"
hcrt_red_vertical_convergence = "0.100000" hcrt_red_vertical_convergence = "0.100000"
hcrt_green_vertical_convergence = "0.000000" hcrt_green_vertical_convergence = "0.000000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,11 +2,8 @@
hcrt_hdr = "1.000000" hcrt_hdr = "1.000000"
hcrt_brightness = "0.150000" hcrt_brightness = "0.150000"
hcrt_colour_system = "0.000000" hcrt_colour_system = "3.000000"
hcrt_white_temperature = "2800.000000"
hcrt_expand_gamut = "1.000000" hcrt_expand_gamut = "1.000000"
hcrt_contrast = "0.000000"
hcrt_gamma = "0.000000"
hcrt_red_vertical_convergence = "-0.140000" hcrt_red_vertical_convergence = "-0.140000"
hcrt_green_vertical_convergence = "0.000000" hcrt_green_vertical_convergence = "0.000000"
hcrt_blue_vertical_convergence = "0.000000" hcrt_blue_vertical_convergence = "0.000000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.00000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -2,6 +2,4 @@
hcrt_hdr = "0.000000" hcrt_hdr = "0.000000"
hcrt_brightness = "0.000000" hcrt_gamma_in = "-0.200000"
hcrt_contrast = "0.000000"
hcrt_gamma = "-0.600000"

View file

@ -37,7 +37,7 @@ layout(push_constant) uniform Push
float hcrt_brightness; float hcrt_brightness;
float hcrt_contrast; float hcrt_contrast;
float hcrt_saturation; float hcrt_saturation;
float hcrt_gamma; float hcrt_gamma_in;
} params; } params;
layout(std140, set = 0, binding = 0) uniform UBO layout(std140, set = 0, binding = 0) uniform UBO
@ -58,7 +58,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
#define HCRT_BRIGHTNESS params.hcrt_brightness #define HCRT_BRIGHTNESS params.hcrt_brightness
#define HCRT_CONTRAST params.hcrt_contrast #define HCRT_CONTRAST params.hcrt_contrast
#define HCRT_SATURATION params.hcrt_saturation #define HCRT_SATURATION params.hcrt_saturation
#define HCRT_GAMMA params.hcrt_gamma #define HCRT_GAMMA_IN params.hcrt_gamma_in
#define COMPAT_TEXTURE(c, d) texture(c, d) #define COMPAT_TEXTURE(c, d) texture(c, d)

View file

@ -33,7 +33,7 @@ layout(push_constant) uniform Push
float hcrt_max_nits; float hcrt_max_nits;
float hcrt_paper_white_nits; float hcrt_paper_white_nits;
float hcrt_expand_gamut; float hcrt_expand_gamut;
float hcrt_gamma; float hcrt_gamma_out;
float hcrt_lcd_resolution; float hcrt_lcd_resolution;
float hcrt_lcd_subpixel; float hcrt_lcd_subpixel;
@ -93,7 +93,7 @@ layout(std140, set = 0, binding = 0) uniform UBO
#define HCRT_MAX_NITS params.hcrt_max_nits #define HCRT_MAX_NITS params.hcrt_max_nits
#define HCRT_PAPER_WHITE_NITS params.hcrt_paper_white_nits #define HCRT_PAPER_WHITE_NITS params.hcrt_paper_white_nits
#define HCRT_EXPAND_GAMUT params.hcrt_expand_gamut #define HCRT_EXPAND_GAMUT params.hcrt_expand_gamut
#define HCRT_GAMMA params.hcrt_gamma #define HCRT_GAMMA_OUT params.hcrt_gamma_out
#define HCRT_LCD_RESOLUTION params.hcrt_lcd_resolution #define HCRT_LCD_RESOLUTION params.hcrt_lcd_resolution
#define HCRT_LCD_SUBPIXEL params.hcrt_lcd_subpixel #define HCRT_LCD_SUBPIXEL params.hcrt_lcd_subpixel

View file

@ -1,5 +1,5 @@
#define kColourSystems 3 #define kColourSystems 4
#define kD50 5003.0f #define kD50 5003.0f
#define kD55 5503.0f #define kD55 5503.0f
@ -7,49 +7,29 @@
#define kD75 7504.0f #define kD75 7504.0f
#define kD93 9305.0f #define kD93 9305.0f
const mat3 XYZ_to_sRGB = mat3( const mat3 k709_to_XYZ = mat3(
3.24081254005432130, -0.969243049621582000, 0.055638398975133896, 0.412391f, 0.357584f, 0.180481f,
-1.53730857372283940, 1.875966310501098600, -0.204007431864738460, 0.212639f, 0.715169f, 0.072192f,
-0.49858659505844116, 0.041555050760507584, 1.057129383087158200); 0.019331f, 0.119195f, 0.950532f);
const mat3 sRGB_to_XYZ = mat3( const mat3 kPAL_to_XYZ = mat3(
0.41241079568862915, 0.21264933049678802, 0.019331756979227066, 0.430554f, 0.341550f, 0.178352f,
0.35758456587791443, 0.71516913175582890, 0.119194857776165010, 0.222004f, 0.706655f, 0.071341f,
0.18045382201671600, 0.07218152284622192, 0.950390160083770800); 0.020182f, 0.129553f, 0.939322f);
// Phosphor transforms found in Dogway's Grade.slang shader const mat3 kNTSC_to_XYZ = mat3(
0.393521f, 0.365258f, 0.191677f,
0.212376f, 0.701060f, 0.086564f,
0.018739f, 0.111934f, 0.958385f);
// SMPTE-C - Measured Average Phosphor (1979-1994) const mat3 kXYZ_to_709 = mat3(
const mat3 P22_transform = mat3( 3.240970f, -1.537383f, -0.498611f,
0.4665636420249939, 0.25661000609397890, 0.005832045804709196, -0.969244f, 1.875968f, 0.041555f,
0.3039233088493347, 0.66820019483566280, 0.105618737637996670, 0.055630f, -0.203977f, 1.056972f);
0.1799621731042862, 0.07518967241048813, 0.977465748786926300);
// SMPTE RP 145-1994 (SMPTE-C), 170M-1999 const mat3 kColourGamut[kColourSystems] = { k709_to_XYZ, kPAL_to_XYZ, kNTSC_to_XYZ, kNTSC_to_XYZ };
// SMPTE-C - Standard Phosphor (Rec.601 NTSC)
const mat3 SMPTE_transform = mat3(
0.39354196190834045, 0.21238772571086884, 0.01874009333550930,
0.36525884270668030, 0.70106136798858640, 0.11193416267633438,
0.19164848327636720, 0.08655092865228653, 0.95824241638183590);
// SMPTE RP 145-1994 (SMPTE-C), 170M-1999 const float kTemperatures[kColourSystems] = { kD65, kD65, kD65, kD93 };
// NTSC-J - Standard Phosphor (https://web.archive.org/web/20130413104152/http://arib.or.jp/english/html/overview/doc/4-TR-B09v1_0.pdf)
const mat3 NTSC_J_transform = mat3(
0.39603787660598755, 0.22429330646991730, 0.02050681784749031,
0.31201449036598206, 0.67417418956756590, 0.12814880907535553,
0.24496731162071228, 0.10153251141309738, 1.26512730121612550);
// ITU-R BT.470/601 (B/G)
// EBU Tech.3213-E PAL - Standard Phosphor for Studio Monitors
const mat3 EBU_transform = mat3(
0.43194326758384705, 0.22272075712680817, 0.020247340202331543,
0.34123489260673523, 0.70600330829620360, 0.129433929920196530,
0.17818950116634370, 0.07127580046653748, 0.938464701175689700);
// CRT Phosphor Gamut
const mat3 kPhosphorGamut[kColourSystems] = { EBU_transform , P22_transform, NTSC_J_transform };
const float kTemperatures[kColourSystems] = { kD65, kD65, kD93 }; // 8942.0f
// Values from: http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness&p=2268693&viewfull=1#post2268693 // Values from: http://blenderartists.org/forum/showthread.php?270332-OSL-Goodness&p=2268693&viewfull=1#post2268693
const mat3 kWarmTemperature = mat3( const mat3 kWarmTemperature = mat3(
@ -86,53 +66,25 @@ vec3 WhiteBalance(float temperature, vec3 colour)
return result; return result;
} }
float r601r709ToLinear_1(const float channel) float r601ToLinear_1(const float channel)
{ {
return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f) + HCRT_GAMMA) : channel * (1.0f / 4.5f); return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f)) : channel * (1.0f / 4.5f);
} }
vec3 r601r709ToLinear(const vec3 colour) vec3 r601ToLinear(const vec3 colour)
{ {
//return vec3(r601r709ToLinear_1(colour.r), r601r709ToLinear_1(colour.g), r601r709ToLinear_1(colour.b)); return vec3(r601ToLinear_1(colour.r), r601ToLinear_1(colour.g), r601ToLinear_1(colour.b));
return pow(colour, vec3((1.0f / 0.45f) + HCRT_GAMMA));
} }
//float LinearTor601r709_1(const float channel)
//{
// return (channel >= 0.018f) ? pow(channel * 1.099f, 0.45f) - 0.099f : channel * 4.5f;
//}
//vec3 LinearTor601r709(const vec3 colour) float r709ToLinear_1(const float channel)
//{
// return vec3(LinearTor601r709_1(colour.r), LinearTor601r709_1(colour.g), LinearTor601r709_1(colour.b));
//}
// SDR Colour output spaces
float sRGBToLinear_1(const float channel)
{ {
return (channel > 0.04045f) ? pow((channel + 0.055f) * (1.0f / 1.055f), 2.4f) : channel * (1.0f / 12.92f); return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f)) : channel * (1.0f / 4.5f);
} }
vec3 sRGBToLinear(const vec3 colour) vec3 r709ToLinear(const vec3 colour)
{ {
//return vec3(sRGBToLinear_1(colour.r), sRGBToLinear_1(colour.g), sRGBToLinear_1(colour.b)); return vec3(r709ToLinear_1(colour.r), r709ToLinear_1(colour.g), r709ToLinear_1(colour.b));
return pow(colour, vec3(2.4f));
}
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));
return pow(colour, vec3(1.0f / 2.4f));
}
vec3 LinearToDCIP3(const vec3 colour)
{
return pow(colour, vec3(1.0f / 2.6f));
} }
// XYZ Yxy transforms found in Dogway's Grade.slang shader // XYZ Yxy transforms found in Dogway's Grade.slang shader
@ -193,19 +145,17 @@ vec3 Saturation(const vec3 colour)
return clamp(mix(vec3(luma), colour, vec3(saturation) * 2.0f), 0.0f, 1.0f); return clamp(mix(vec3(luma), colour, vec3(saturation) * 2.0f), 0.0f, 1.0f);
} }
vec3 BrightnessContrastSaturation(const vec3 linear) vec3 BrightnessContrastSaturation(const vec3 xyz)
{ {
const vec3 xyz = sRGB_to_XYZ * linear;
const vec3 Yxy = XYZtoYxy(xyz); const vec3 Yxy = XYZtoYxy(xyz);
const float Y_gamma = clamp(LinearTosRGB_1(Yxy.x), 0.0f, 1.0f); const float Y_gamma = clamp(pow(Yxy.x, 1.0f / 2.4f), 0.0f, 1.0f);
const float Y_brightness = Brightness(Y_gamma); const float Y_brightness = Brightness(Y_gamma);
const float Y_contrast = Contrast(Y_brightness); const float Y_contrast = Contrast(Y_brightness);
const vec3 contrast_linear = vec3(sRGBToLinear_1(Y_contrast), Yxy.y, Yxy.z); const vec3 contrast_linear = vec3(pow(Y_contrast, 2.4f), Yxy.y, Yxy.z);
const vec3 contrast_xyz = YxytoXYZ(contrast_linear); const vec3 contrast = clamp(YxytoXYZ(contrast_linear) * kXYZ_to_709, 0.0f, 1.0f);
const vec3 contrast = clamp(XYZ_to_sRGB * contrast_xyz, 0.0f, 1.0f);
const vec3 saturation = Saturation(contrast); const vec3 saturation = Saturation(contrast);
@ -216,13 +166,13 @@ vec3 ColourGrade(const vec3 colour)
{ {
const uint colour_system = uint(HCRT_CRT_COLOUR_SYSTEM); const uint colour_system = uint(HCRT_CRT_COLOUR_SYSTEM);
const vec3 linear = r601r709ToLinear(colour); const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, colour);
const vec3 gamut = linear; // (HCRT_HDR == 0.0f) && (HCRT_OUTPUT_COLOUR_SPACE == 0.0f) ? linear : kPhosphorGamut[colour_system] * linear; const vec3 linear = pow(white_point, vec3((1.0f / 0.45f) + HCRT_GAMMA_IN));
const vec3 white_point = WhiteBalance(kTemperatures[colour_system] + HCRT_WHITE_TEMPERATURE, gamut); const vec3 xyz = linear * kColourGamut[colour_system];
const vec3 graded = BrightnessContrastSaturation(white_point); const vec3 graded = BrightnessContrastSaturation(xyz);
return graded; return graded;
} }

View file

@ -1,8 +1,18 @@
// SDR Colour output spaces // SDR Colour output spaces
const mat3 k709_to_XYZ = mat3(
0.412391f, 0.357584f, 0.180481f,
0.212639f, 0.715169f, 0.072192f,
0.019331f, 0.119195f, 0.950532f);
const mat3 kXYZ_to_DCIP3 = mat3 (
2.4934969119f, -0.9313836179f, -0.4027107845f,
-0.8294889696f, 1.7626640603f, 0.0236246858f,
0.0358458302f, -0.0761723893f, 0.9568845240f);
float LinearTosRGB_1(const float channel) float LinearTosRGB_1(const float channel)
{ {
return (channel > 0.0031308f) ? (1.055f * pow(channel, 1.0f / 2.4f)) - 0.055f : channel * 12.92f; return (channel > 0.0031308f) ? (1.055f * pow(channel, (1.0f / 2.4f) + HCRT_GAMMA_OUT)) - 0.055f : channel * 12.92f;
} }
vec3 LinearTosRGB(const vec3 colour) vec3 LinearTosRGB(const vec3 colour)
@ -10,16 +20,38 @@ vec3 LinearTosRGB(const vec3 colour)
return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b)); return vec3(LinearTosRGB_1(colour.r), LinearTosRGB_1(colour.g), LinearTosRGB_1(colour.b));
} }
float LinearTo709_1(const float channel)
{
return (channel >= 0.018f) ? pow(channel * 1.099f, 0.45f + HCRT_GAMMA_OUT) - 0.099f : channel * 4.5f;
}
vec3 LinearTo709(const vec3 colour)
{
return vec3(LinearTo709_1(colour.r), LinearTo709_1(colour.g), LinearTo709_1(colour.b));
}
vec3 LinearToDCIP3(const vec3 colour) vec3 LinearToDCIP3(const vec3 colour)
{ {
return pow(colour, vec3(1.0f / 2.6f)); return clamp(pow(colour, vec3((1.0f / 2.6f) + HCRT_GAMMA_OUT)), 0.0f, 1.0f);
} }
vec3 GammaCorrect(const vec3 scanline_colour) vec3 GammaCorrect(const vec3 scanline_colour)
{ {
if(HCRT_HDR < 1.0f) if(HCRT_HDR < 1.0f)
{ {
return HCRT_OUTPUT_COLOUR_SPACE == 0.0f ? LinearTosRGB(scanline_colour) : LinearToDCIP3(scanline_colour); if(HCRT_OUTPUT_COLOUR_SPACE == 0.0f)
{
return LinearTo709(scanline_colour);
}
else if(HCRT_OUTPUT_COLOUR_SPACE == 1.0f)
{
return LinearTosRGB(scanline_colour);
}
else
{
const vec3 dcip3_colour = (scanline_colour * k709_to_XYZ) * kXYZ_to_DCIP3;
return LinearToDCIP3(dcip3_colour);
}
} }
else else
{ {

View file

@ -1,16 +1,18 @@
#define kMaxNitsFor2084 10000.0f #define kMaxNitsFor2084 10000.0f
const mat3 k709to2020 = mat3 ( const mat3 k709_to_2020 = mat3 (
0.6274040f, 0.3292820f, 0.0433136f, 0.6274040f, 0.3292820f, 0.0433136f,
0.0690970f, 0.9195400f, 0.0113612f, 0.0690970f, 0.9195400f, 0.0113612f,
0.0163916f, 0.0880132f, 0.8955950f); 0.0163916f, 0.0880132f, 0.8955950f);
/* START Converted from (Copyright (c) Microsoft Corporation - Licensed under the MIT License.) https://github.com/microsoft/Xbox-ATG-Samples/tree/master/Kits/ATGTK/HDR */ /* START Converted from (Copyright (c) Microsoft Corporation - Licensed under the MIT License.) https://github.com/microsoft/Xbox-ATG-Samples/tree/master/Kits/ATGTK/HDR */
const mat3 kExpanded709to2020 = mat3 ( const mat3 kExpanded709_to_2020 = mat3 (
0.6274040f, 0.3292820f, 0.0433136f, 0.6274040f, 0.3292820f, 0.0433136f,
0.0457456, 0.941777, 0.0124772, 0.0457456f, 0.941777f, 0.0124772f,
-0.00121055, 0.0176041, 0.983607); -0.00121055f, 0.0176041f, 0.983607f);
const mat3 k2020Gamuts[2] = { k709_to_2020, kExpanded709_to_2020 };
vec3 LinearToST2084(vec3 normalizedLinearValue) vec3 LinearToST2084(vec3 normalizedLinearValue)
{ {
@ -22,7 +24,7 @@ vec3 LinearToST2084(vec3 normalizedLinearValue)
/* Convert into HDR10 */ /* Convert into HDR10 */
vec3 Hdr10(vec3 hdr_linear, float paper_white_nits, float expand_gamut) vec3 Hdr10(vec3 hdr_linear, float paper_white_nits, float expand_gamut)
{ {
vec3 rec2020 = expand_gamut > 0.0f ? hdr_linear * kExpanded709to2020 : hdr_linear * k709to2020; vec3 rec2020 = hdr_linear * k2020Gamuts[uint(expand_gamut)];
vec3 linearColour = rec2020 * (paper_white_nits / kMaxNitsFor2084); vec3 linearColour = rec2020 * (paper_white_nits / kMaxNitsFor2084);
vec3 hdr10 = LinearToST2084(linearColour); vec3 hdr10 = LinearToST2084(linearColour);

View file

@ -1,14 +1,19 @@
#pragma parameter hcrt_title "SONY MEGATRON COLOUR VIDEO MONITOR" 0.0 0.0 0.0001 0.0001 #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_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_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_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_support2 "Then adjust paper white luminance until it looks right" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support3 " " 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support4 "Default white points for the different colour systems:" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_support5 "709: 6500K, PAL: 6500K, NTSC-U: 6500K, NTSC-J: 9300K" 0.0 0.0 0.0001 0.0001
#pragma parameter hcrt_space1 " " 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'S SETTINGS:" 0.0 0.0 0.0001 0.0001 #pragma parameter hcrt_user_settings "YOUR DISPLAY'S 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_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_colour_space " SDR: Display's Colour Space: r709 | sRGB | DCI-P3" 1.0 0.0 2.0 1.0
#pragma parameter hcrt_max_nits " HDR: Display's Peak Luminance" 700.0 0.0 10000.0 10.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_paper_white_nits " HDR: Display's Paper White Luminance" 700.0 0.0 10000.0 10.0
#pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0 #pragma parameter hcrt_expand_gamut " HDR: Original/Vivid" 0.0 0.0 1.0 1.0
@ -18,12 +23,13 @@
#pragma parameter hcrt_developer_settings "CRT SETTINGS:" 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_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_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_colour_system " Colour System: r709 | PAL | NTSC-U | NTSC-J" 2.0 0.0 3.0 1.0
#pragma parameter hcrt_white_temperature " White Temperature Offset (Kelvin)" 0.0 -5000.0 12000.0 100.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_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_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_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_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_pin_phase " Pin Phase" 0.00 -0.2 0.2 0.01 #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_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_space3 " " 0.0 0.0 0.0001 0.0001