PIXELBANKv9.1.0
Menu

Global Reinhard Tone Mapping

Apply global Reinhard tone mapping to compress HDR values to displayable range.

HDR images can have luminance values spanning many orders of magnitude (e.g., 0.001 to 10000+), but displays can only show values in [0, 1]. Tone mapping compresses this range while preserving visual quality.

The Reinhard operator is a classic global tone mapper:

Ldisplay=L1+LL_{display} = \frac{L}{1 + L}

Properties of this formula:

  • When L is small: Ld≈LL_d \approx L (preserves dark details)
  • When L is large: Ld≈1L_d \approx 1 (compresses highlights)
  • At L = 1: Ld=0.5L_d = 0.5 (mid-point mapping)
  • Always maps to [0, 1) range

This creates an S-curve that mimics how human vision perceives brightness - we're more sensitive to dark regions and compress bright regions.

Example:

Input:
reinhard(1.0)
Output:
0.5
Reasoning:

For L = 1.0:

  1. Apply formula: L_d = 1.0 / (1 + 1.0)
  2. Calculate: L_d = 1.0 / 2.0 = 0.5
  3. This is the mid-point - L=1 maps to exactly 0.5.

Constraints:

  • L is HDR luminance value (non-negative float)
  • Return tone-mapped value rounded to 4 decimal places
  • Output should be in range [0, 1)
solution.py

Test Results

0/0
Run code to see test results.
Global Reinhard Tone Mapping - Easy | PixelBank