Skip to content

HDR Tonemap for HDRMod#312

Open
XgarhontX wants to merge 3 commits into
ComplementaryDevelopment:mainfrom
XgarhontX:hdr-clean
Open

HDR Tonemap for HDRMod#312
XgarhontX wants to merge 3 commits into
ComplementaryDevelopment:mainfrom
XgarhontX:hdr-clean

Conversation

@XgarhontX
Copy link
Copy Markdown

@XgarhontX XgarhontX commented Jun 3, 2026

HDR

Changes to support HDRMod via compilation branching by HDR_ENABLED define macro.

I ended up not adding any new sliders/toggles.
When HDRMod is installed and enabled, Complementary will be HDR out of the box.

1000nits peak @ 203nits paper white
2026-06-02-22-05-40-hdr-050541.png

Changes

pipelineSettings.glsl

  • New colorTex0Format & colortex3Format override to 16F for HDR values.

uniforms.glsl

  • 3 New floats for HDR display information.
    • Peak
    • Scene Paper White
    • UI Paper White

commonFunctions.glsl

  • Moved/New LinearToRGB() & RGBToLinear(), both vec3 and float.
    • I need it also at final.glsl.
    • TODO: Yea? Or nay, and final.glsl should copy and paste?

composite5.glsl

  • Moved LinearToRGB() to commonFunctions.glsl.
  • New HDR tonemapping.
    • Responds to all original SDR tonemap sliders like contrast, black desat, and white path.
      • Of course, stuff like white pass won't be same / is tuned differently.
    • Extends and steals toe from Lottes (only for those coeffs), then uses RenoDX's Reinhard Extended Piecewise for shoulder.
    • (This is as minimal as I could make before sacrificing the look. I was tempted to go crazy and import UCS like ICtCp, but refrained of it, lol.)
    • TODO: Should Lottes be made a common function?
  • DoBSLColorSaturation() HDR
    • Some scaling to let algorithm take in and work with HDR values.

mainLighting.glsl

  • Changed emission final result that'll be added to lighting when using IPBR.
    • Only for HDR, to reduce this perceptually awkward inverse-tonemap-like feeling and overly forced white clip for emissives revealed by the increase in stops.
    • Removed final pow2(emission) & just used a multiplier to make up loss.
      • (Also tested by patching on top of Euphoria + Supplemental, and they are fine.)
    • TODO: Is that the best place? I only want to target IPBR result, since labPBR aren't strong.

final.glsl

  • Clamp vignette luminance dodge from HDR values.
  • Disabled dithering in HDR.
  • New UI brightness scaling
    • This is where I need the LinearToRGB() & RGBToLinear() to decode back to linear, apply brightness scaling, and reencode gamma.

composite.glsl & composite1.glsl

  • Clamped against outputting negative values causing NaNs later, especially by bloom.

lensFlare.glsl

  • For HDR, composite by simple addition to let it pop more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant