For context I should try and post a little bit here about what “HK_mode” does.
The paper it’s based on can be found here:
https://onlinelibrary.wiley.com/doi/abs/10.1002/col.22793
Abstract
Increasing the purity of a visual stimulus increases its brightness, even if the stimulus luminance is held constant. This perceptual phenomenon is known as the Helmholtz–Kohlrausch (H–K) Effect. This paper reviews published experimental data and models of the effect. Using past experimental data, we derive a modification of the CIECAM02 and CAM16 color appearance models to account for the H–K effect and compare the proposed model to other models. Finally, we discuss the need for further experimental data on the H–K effect to refine the proposed model.
Based on my rough undertsanding of the code (As per usual, I’ve mostly cargo culted it from @Thomas_Mansencal’s implementation) it’s Increasing the value of J as M increases, with h as a varying factor. The graph below (from the paper) shows how some h angles, like cyan at 220, get a much larger boost than yellow at 90.
// # *Helmholtz–Kohlrausch* Effect Extension.
float J_HK = J + hue_angle_dependency_Hellwig2022(hr) * spow(C, 0.587f);
float hue_angle_dependency_Hellwig2022(float h)
{
return float( \
-0.160 * cos(h) \
+ 0.132 * cos(2 * h) \
- 0.405 * sin(h) \
+ 0.080 * sin(2 * h) \
+ 0.792 \
);
I think where we were getting into trouble earlier is that the path looked something like this:
• XYZ → JMh
• J get’s varied by HK effect
• Tonemap is applied to J
• Compress to gamut boundry (boundry also found with HK varying J)
• J get’s inverse HK effect applied
• JMh to XYZ
From what I can tell, goosing J up and down with the tonecurve application, and the gamut hull finding, was causing issues, as was pulling J up and down again right before we go back to the final target gamut.
Whilst I’m pretty convinced that disabling it for the gamut hull finding, and the final trip back to XYZ are a win, I’m a little torn about having it enabled on the way in.
Visually it’s actually making the whole tonescale feel significanly lower contrast (even though it hasn’t changed for pure greyscale values).
One area where I have been able to talk myself into thinking it’s an improvement (I’m not fully convinced, but it’s interesting) is when comparing the percived brightness of a macbeth, compared to a straight averaged greyscale version passed through the same transform.
First example shows HK_mode_in enabled:
(These are animated gifs, but depending on the browser you might need to click them to toggle the comparison)
Whilst the second on shows HK_mode off at all stages:
With it off, I feel like the full blue patch is sucking lighting out of the scene, whilst I feel like with it on the percerived brightness of the colour version and greyscale version are much closer.
Now is this even a valid comparison? Is this a good idea that just needs to be dialed back by 50%? I’m not sure.