Average green samples for debayering

Gives a slightly cleaner image
This commit is contained in:
Benjamin Schaaf 2021-04-26 19:07:33 +10:00
parent 44fc390b99
commit 1bd975698c
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ void main() {
// Assume BGGR for now. Currently this just takes 3 of the four samples
// for each pixel, there's room here to do some better debayering.
vec3 color = samples.wyx;
vec3 color = vec3(samples.w, (samples.y + samples.w) / 2.0, samples.x);
// Fast SRGB estimate. See https://mimosa-pudica.net/fast-gamma/
vec3 srgb_color = (vec3(1.138) * inversesqrt(color) - vec3(0.138)) * color;
@ -30,5 +30,5 @@ void main() {
// Slow SRGB estimate
// vec3 srgb_color = pow(color, vec3(1.0 / 2.2));
gl_FragColor = vec4(color_matrix * srgb_color, 0);
gl_FragColor = vec4(color_matrix * srgb_color, 1);
}