gl_common: use Rec. 709 for luminance calculation
This is however monitor dependent. But Rec. 709 is probably close to what most people uses. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
7dd843fe4f
commit
6efd88b82f
|
@ -1163,7 +1163,10 @@ const char *win_shader_glsl = GLSL(330,
|
|||
c = vec4(c.rgb * (1.0 - dim), c.a) * opacity;
|
||||
|
||||
vec3 rgb_brightness = texelFetch(brightness, ivec2(0, 0), 0).rgb;
|
||||
float brightness = (rgb_brightness[0] + rgb_brightness[1] + rgb_brightness[2]) / 3;
|
||||
// Ref: https://en.wikipedia.org/wiki/Relative_luminance
|
||||
float brightness = rgb_brightness.r * 0.21 +
|
||||
rgb_brightness.g * 0.72 +
|
||||
rgb_brightness.b * 0.07;
|
||||
if (brightness > max_brightness)
|
||||
c.rgb = c.rgb * (max_brightness / brightness);
|
||||
|
||||
|
|
Loading…
Reference in New Issue