core/colorpipeline: fix tone mapping luminances being switched around

The code from before could never reduce the reference luminance

(cherry picked from commit 1fa3d50e8d)
wilder/Plasma/6.2
Xaver Hugl 1 year ago
parent 594b248386
commit af80b1117d
  1. 2
      src/core/colorpipeline.cpp
  2. 2
      src/opengl/colormanagement.glsl

@ -346,7 +346,7 @@ ColorTonemapper::ColorTonemapper(double referenceLuminance, double maxInputLumin
// 50% HDR headroom should be enough for the tone mapper to do a good enough job, without dimming the image too much
const double minDecentRange = std::min(m_inputRange, 1.5);
// if the output doesn't provide enough HDR headroom for the tone mapper to do a good job, dim the image to create some
m_referenceDimming = 1.0 / std::clamp(outputRange / minDecentRange, 1.0, minDecentRange);
m_referenceDimming = 1.0 / std::clamp(minDecentRange / outputRange, 1.0, minDecentRange);
m_outputReferenceLuminance = referenceLuminance * m_referenceDimming;
}

@ -123,7 +123,7 @@ vec3 doTonemapping(vec3 color) {
// how much dynamic range we need to decently present the content
float minDecentRange = min(inputRange, 1.5);
// if the output doesn't provide enough HDR headroom for the tone mapper to do a good job, dim the image to create some
float referenceDimming = 1.0 / clamp(outputRange / minDecentRange, 1.0, minDecentRange);
float referenceDimming = 1.0 / clamp(minDecentRange / outputRange, 1.0, minDecentRange);
float outputReferenceLuminance = destinationReferenceLuminance * referenceDimming;
// keep it linear up to the reference luminance

Loading…
Cancel
Save