diff --git a/src/gl/system/gl_framebuffer.cpp b/src/gl/system/gl_framebuffer.cpp index 07d8abaef..1ca2f7edd 100644 --- a/src/gl/system/gl_framebuffer.cpp +++ b/src/gl/system/gl_framebuffer.cpp @@ -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(val*256, 0, 0xffff); } diff --git a/wadsrc/static/shaders/glsl/present.fp b/wadsrc/static/shaders/glsl/present.fp index 53fc007b6..4f5c7cffa 100644 --- a/wadsrc/static/shaders/glsl/present.fp +++ b/wadsrc/static/shaders/glsl/present.fp @@ -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); }