From 6ca53a53292ed252ea8b3701aa541457b74a2e31 Mon Sep 17 00:00:00 2001 From: Cat Flynn Date: Sun, 26 Feb 2023 03:28:26 +0000 Subject: [PATCH] apply gamma correction --- shader/root/rt.glsl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shader/root/rt.glsl b/shader/root/rt.glsl index c081533..34de0c3 100644 --- a/shader/root/rt.glsl +++ b/shader/root/rt.glsl @@ -99,6 +99,13 @@ void main() depth += sampleDepth / float(samples); } + + // include the first sample we took + samples++; + // gamma correction + float scale = 1.0 / samples; + pixel.xyz = sqrt(scale * pixel.xyz); + pixel.xyz = mix(pixel.xyz, vec3(1.0), depth); // output to a specific pixel in the image