16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-17 23:39:18 +02:00

tonemapping: Fix up AgX application

We're supposed to output linear values there, as sRGB transfer function
gets applied either by GL framebuffer or FBOUT later on.

min_ev and max_ev also need to be adjusted, as they're tweaked for
a pipeline with exposure compensation. The current values lead to a very
washed-out image, which was "hidden" by subsequently applying gamma twice.
It may make sense to revisit these values in the future to better match
the rendering pipeline.
This commit is contained in:
Sebastian Krzyszkowiak
2026-06-30 00:20:38 +02:00
parent 116eed6100
commit 321edfcf10

View File

@@ -69,12 +69,12 @@ vec3 Agx(vec3 val)
0.0423756549057051, 0.0784336, 0.879142973793104
);
// DEFAULT_LOG2_MIN = -10.0
// DEFAULT_LOG2_MAX = +6.5
// DEFAULT_LOG2_MIN = -6.0
// DEFAULT_LOG2_MAX = +4.5
// MIDDLE_GRAY = 0.18
// log2(pow(2, VALUE) * MIDDLE_GRAY)
const float min_ev = -12.47393;
const float max_ev = 0.526069;
const float min_ev = -8.47393;
const float max_ev = 2.026069;
const float agx_eps = 1e-6;
// Input transform (inset)
@@ -99,10 +99,7 @@ vec3 AgxEotf(vec3 val)
// Inverse input transform (outset)
val = agx_mat_inv * val;
// sRGB IEC 61966-2-1 2.2 Exponent Reference EOTF Display.
// If your render target already applies sRGB conversion, replace this with:
// return max(val, vec3(0.0));
return pow(max(val, vec3(0.0)), vec3(2.2));
return max(val, vec3(0.0));
}
vec3 AgxLook(vec3 val)