summaryrefslogtreecommitdiff
path: root/src/render/shaders/glsl/tonemap.glsl
diff options
context:
space:
mode:
authorUjinT34 <41110182+UjinT34@users.noreply.github.com>2026-04-16 21:19:25 +0300
committerGitHub <noreply@github.com>2026-04-16 19:19:25 +0100
commit66ea2e2c9ed4e9257521e6706fbd21feb7e3cc5b (patch)
tree6c0c9842245917e9828874263cd11d6f556a0a48 /src/render/shaders/glsl/tonemap.glsl
parent4cce7f60a9c8772d18ffb43cb74aa227ab4b3bc4 (diff)
renderer: Various CM fixes, part 8 of refactors (#13860)
Part 8 of Ujin's refactors.
Diffstat (limited to 'src/render/shaders/glsl/tonemap.glsl')
-rw-r--r--src/render/shaders/glsl/tonemap.glsl6
1 files changed, 6 insertions, 0 deletions
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]);
}