Fixed gamma in to use the proper rec. 601 transfer function

This commit is contained in:
MajorPainTheCactus 2022-10-25 22:41:35 +01:00
parent 1e20bbf243
commit e37ed7cff0
3 changed files with 6 additions and 5 deletions

View file

@ -2,4 +2,3 @@
hcrt_hdr = "0.000000"
hcrt_gamma_in = "2.000000"

View file

@ -73,7 +73,8 @@ vec3 WhiteBalance(float temperature, vec3 colour)
float r601ToLinear_1(const float channel)
{
return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f)) : 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);
return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), HCRT_GAMMA_IN) : channel * (1.0f / 4.5f);
}
vec3 r601ToLinear(const vec3 colour)
@ -84,7 +85,8 @@ vec3 r601ToLinear(const vec3 colour)
float r709ToLinear_1(const float channel)
{
return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), (1.0f / 0.45f)) : 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);
return (channel >= 0.081f) ? pow((channel + 0.099f) * (1.0f / 1.099f), HCRT_GAMMA_IN) : channel * (1.0f / 4.5f);
}
vec3 r709ToLinear(const vec3 colour)
@ -173,7 +175,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(HCRT_GAMMA_IN));
const vec3 linear = r601ToLinear(white_point); //pow(white_point, vec3(HCRT_GAMMA_IN));
const vec3 xyz = linear * kColourGamut[colour_system];

View file

@ -31,7 +31,7 @@
#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" 2.4 1.0 5.0 0.01
#pragma parameter hcrt_gamma_in " Gamma" 2.22 1.0 5.0 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_space3 " " 0.0 0.0 0.0001 0.0001