Skip to content

Commit

Permalink
Adjustments to HDR color saturation.
Browse files Browse the repository at this point in the history
Color saturation is internally multiplied by an adjustment factor so that it does not result in colors that appear way too saturated compared to SDR. Additionally, gamut expansion is now fixed to 0.2, which is a good compromise between allowing high saturation colors to transit to higher color spaces and keeping the look of the game as close as possible to the original SDR.
  • Loading branch information
AnotherCommander authored Sep 17, 2024
1 parent 7598022 commit 15279da
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Resources/Shaders/oolite-final-hdr.fragment
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ uniform float uSaturation;
#define SMPTE_ST2084MAXNITS 10000.0
#define MAXCLLNITS 1000.0
#define HDR_HEATMAP 0
#define SATURATION_ADJUSTMENT 0.825 //adjustment factor to better approach SDR saturation
#define GAMUT_EXPANSION_AMOUNT 0.2 //0.0f .. 1.0f - best results if this is kept low



Expand Down Expand Up @@ -729,7 +731,7 @@ void main()
t = t * t / (12.0 + t);

// apply saturation
hdrColor = max(saturationMatrix(uSaturation) * hdrColor, vec3(0.0));
hdrColor = max(saturationMatrix(uSaturation * SATURATION_ADJUSTMENT) * hdrColor, vec3(0.0));

// mastering to 1000 nits max luminance
hdrColor = min(hdrColor, vec3(MAXCLLNITS * 0.0125));
Expand All @@ -744,7 +746,7 @@ void main()
vec3 result = ACESFilmRec2020OrReinhardHDR(mix(hdrColor, luma, clamp(t * 80 / uMaxBrightness, 0.0, 1.0)) * uPaperWhiteBrightness * 0.0125);

// gamut expansion here
result = expandGamut(result, uSaturation * 0.05f);
result = expandGamut(result, GAMUT_EXPANSION_AMOUNT);

#if HDR_HEATMAP
{
Expand Down

0 comments on commit 15279da

Please sign in to comment.