diff options
author | William Weaver <paperwork.resident@gmail.com> | 2025-04-11 02:23:52 +0300 |
---|---|---|
committer | William Weaver <paperwork.resident@gmail.com> | 2025-04-11 02:23:52 +0300 |
commit | c07817c3d26095de569e9193ade2b9040b7be8c0 (patch) | |
tree | 22a497058761a7e4e70d2178c3186b6c7185d443 /indra/llui | |
parent | be2e7e9d185d82e1e4aa60f6a73bd7ba4abbfeb5 (diff) |
Fix(Tonemap): Correct blend logic to preserve HDR detail
The blending operation for the `tonemap_mix` uniform in `postDeferredTonemap.glsl` incorrectly used a prematurely clamped color value as the source for the linear mix target. Specifically, the exposed HDR input color was clamped to the [0, 1] LDR range before being used in the `mix()` function when `tonemap_mix < 1.0`.
This premature clamping resulted in the loss of High Dynamic Range (HDR) detail in highlights during the blend operation. As `tonemap_mix` was reduced, instead of smoothly blending towards the linear scene representation, clipped highlights were incorrectly reintroduced.
This commit modifies the `toneMap` and `toneMapNoExposure` functions to correct this logic:
1. The original linear input color is preserved before exposure/processing.
2. The appropriate exposure factor is calculated and applied separately.
3. The chosen tone mapping operator is applied to the exposed color, storing the result.
4. The `mix()` function now correctly blends between the appropriately scaled, *unclamped* linear input color and the fully tone-mapped result.
5. The final clamp to the [0, 1] LDR range is applied *after* the blend operation.
This change ensures that HDR information is preserved throughout the blending process, resulting in a smoother, more perceptually correct visual transition as `tonemap_mix` is adjusted. While the effect is nuanced, it is noticeable in bright highlights; with the legacy code, these highlights appeared visibly clipped and less intense during the blend, whereas the corrected code allows them to retain their peak brightness and detail more accurately. This makes the `tonemap_mix` control more intuitive, behaving as a true intensity blend for the tone mapping effect without introducing clipping artifacts. The computational cost is negligible.
Diffstat (limited to 'indra/llui')
0 files changed, 0 insertions, 0 deletions