mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-11-24 13:01:47 +00:00
Changes to the contrast/brightness/gamma formula for both hardware and shader gamma correction. Mainly makes a correction with the shader version where contrast/brightness being negative values would clip them inappropriately.
This commit is contained in:
parent
af699dcebc
commit
72491049e0
2 changed files with 3 additions and 3 deletions
|
@ -250,8 +250,8 @@ void OpenGLFrameBuffer::DoSetGamma()
|
|||
for (int i = 0; i < 256; i++)
|
||||
{
|
||||
double val = i * contrast - (contrast - 1) * 127;
|
||||
if(gamma != 1) val = pow(val, invgamma) / norm;
|
||||
val += bright * 128;
|
||||
if(gamma != 1) val = pow(val, invgamma) / norm;
|
||||
|
||||
gammaTable[i] = gammaTable[i + 256] = gammaTable[i + 512] = (WORD)clamp<double>(val*256, 0, 0xffff);
|
||||
}
|
||||
|
|
|
@ -9,9 +9,9 @@ uniform float Brightness;
|
|||
|
||||
vec4 ApplyGamma(vec4 c)
|
||||
{
|
||||
vec3 val = max(c.rgb * Contrast - (Contrast - 1.0) * 0.5, vec3(0.0));
|
||||
val = pow(val, vec3(InvGamma));
|
||||
vec3 val = c.rgb * Contrast - (Contrast - 1.0) * 0.5;
|
||||
val += Brightness * 0.5;
|
||||
val = pow(val, vec3(InvGamma));
|
||||
return vec4(val, c.a);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue