Add color correction to the gles shader
This commit is contained in:
@@ -5,6 +5,7 @@ precision highp float;
|
||||
uniform sampler2D texture;
|
||||
uniform mat3 color_matrix;
|
||||
uniform float inv_gamma;
|
||||
uniform float blacklevel;
|
||||
#ifdef BITS_10
|
||||
uniform float row_length;
|
||||
uniform float padding_ratio;
|
||||
@@ -59,16 +60,9 @@ main()
|
||||
vec3 color = vec3(samples.x, (samples.y + samples.z) / 2.0, samples.w);
|
||||
#endif
|
||||
|
||||
// Some crude blacklevel correction to make the preview a bit nicer, this
|
||||
// should be an uniform
|
||||
vec3 corrected = color - 0.02;
|
||||
|
||||
/*
|
||||
// Fast SRGB estimate. See https://mimosa-pudica.net/fast-gamma/
|
||||
vec3 gamma_color =
|
||||
(vec3(1.138) * inversesqrt(corrected) - vec3(0.138)) * corrected;
|
||||
*/
|
||||
color = color * color_matrix;
|
||||
color -= blacklevel;
|
||||
color *= 1.0-(1.0/blacklevel);
|
||||
color *= color_matrix;
|
||||
|
||||
vec3 gamma_color = pow(color, vec3(inv_gamma));
|
||||
gl_FragColor = vec4(gamma_color, 1);
|
||||
|
Reference in New Issue
Block a user