From 66ea2e2c9ed4e9257521e6706fbd21feb7e3cc5b Mon Sep 17 00:00:00 2001 From: UjinT34 <41110182+UjinT34@users.noreply.github.com> Date: Thu, 16 Apr 2026 21:19:25 +0300 Subject: renderer: Various CM fixes, part 8 of refactors (#13860) Part 8 of Ujin's refactors. --- src/render/shaders/glsl/tonemap.glsl | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/render/shaders/glsl/tonemap.glsl') diff --git a/src/render/shaders/glsl/tonemap.glsl b/src/render/shaders/glsl/tonemap.glsl index a0ba24ef..dcce45a6 100644 --- a/src/render/shaders/glsl/tonemap.glsl +++ b/src/render/shaders/glsl/tonemap.glsl @@ -60,5 +60,11 @@ vec4 tonemap(vec4 color, mat3 dstXYZ, float maxLuminance, float dstMaxLuminance, // scale src to dst reference float refScale = dstRefLuminance / srcRefLuminance; + // kind of works but doesn't use newLum at all return vec4(fromLMS * toLinear(vec4(ICtCpPQInv * ICtCp, 1.0), CM_TRANSFER_FUNCTION_ST2084_PQ).rgb * HDR_MAX_LUMINANCE * refScale, color[3]); + // breaks with overriden monitor luminances. might be caused by incorrect imput values + // @gulafaran + // vec3 outRGB = fromLMS * toLinear(vec4(ICtCpPQInv * ICtCp, 1.0), CM_TRANSFER_FUNCTION_ST2084_PQ).rgb; + // outRGB *= (newLum / max(luminance, 0.0001)); // actually apply the tone mapping + // return vec4(clamp(outRGB * HDR_MAX_LUMINANCE * refScale, 0.0, dstMaxLuminance), color[3]); } -- cgit v1.2.3