Problemcore
Tone mapping
Also called tone reproduction, tone reproduction problem.
Map the high dynamic range luminances of a rendered or captured image to the small range of a display, with a global curve or a local operator, while keeping contrast and detail visible.
Tone mapping is the problem of turning an image with a high dynamic range, such as a rendered frame in linear radiance or a merged set of photographs, into values that a display with a small range can show. Light in a scene can span many orders of magnitude between deep shadow and a bright sky, while a display shows a fixed and much smaller range. A plain scale and clip either crushes the shadows to black or burns the highlights to white. A tone operator is a function from the input luminances to display luminances that keeps as much of the visible structure as it can. Tone mapping is a separate step from the display encoding that gamma correction does: tone mapping decides which linear value each pixel should get, and the encoding then stores that linear value for the display.
In plain words
A real scene can have a lamp that is a million times brighter than the darkest corner. A screen can show only a small part of that range. If you set the brightness so that the corner is visible, the lamp and everything near it become pure white. If you set it for the lamp, the corner becomes pure black.
Tone mapping is the step that squeezes the large range into the small one in a good way. The simplest methods use one fixed curve for every pixel: dark values stay nearly as they are and bright values are pressed together more and more. Better but slower methods look at the neighborhood of each pixel, so that a detail in a bright area and a detail in a dark area can both stay visible. There is no single correct answer. The goal depends on what the image is for.
Definition
Input. An image of pixels with world luminances in linear units, often with linear RGB colors. The dynamic range of the image is the ratio of its largest to its smallest nonzero luminance, often given in stops, of the ratio.
Output. Display values , linear and relative to the white of the display, one per pixel. An encoding step turns them into code values afterwards.
Operator classes.
- A global operator is for one curve , which can depend on statistics of the whole image (for example its log average or its histogram) but not on the position of the pixel.
- A local operator lets depend on the neighborhood of pixel , for example through a blurred luminance or a pyramid.
The goal. The problem has no single objective function. Each method states its own aim, and the aim decides the method. Common aims are to keep the order of brightness, to keep details visible in both the dark and the bright parts, to match the brightness or the contrast that a viewer of the real scene would see (Tumblin and Rushmeier), or to look like a photographic print or a film. Matching what a viewer sees is a goal stated with a model of human vision; whether a method reaches it is a measurement in a user study, not a proof.
Cost model. The real RAM, per pixel. A global operator reads each pixel a fixed number of times. A local operator reads a neighborhood of pixels, or a set of blurred images, per pixel.
Variants
- Global and local. Global operators are fast and keep the order of brightness, but they lower contrast in the range they compress. Local operators can keep local contrast, but they can give halos or dark rings around bright edges.
- Fixed curve and image adaptive. A fixed curve with a manual exposure is common in games. An adaptive operator computes the exposure, or the whole curve, from the image.
- Still images and video. For video and real time, the exposure must change slowly over frames, or the image flickers. The speed of this adaptation is tuning.
- Display target. The target can be a standard display or a high dynamic range display with a larger range; the second needs less compression but still needs a curve.
- Inverse tone mapping. The opposite problem expands a standard range image for a high dynamic range display.
Examples
Five pixels have , four orders of magnitude, or stops. Each row maps them to and then encodes them with the sRGB curve to 8 bit code values.
| operator | 0.01 | 0.1 | 1 | 10 | 100 |
|---|---|---|---|---|---|
| divide by the largest value | 0 | 3 | 25 | 89 | 255 |
| exposure 1, then clip at 1 | 25 | 89 | 255 | 255 | 255 |
| key 0.18, then | 6 | 36 | 109 | 210 | 249 |
The first row keeps the highlight but crushes the two darkest pixels into the code values 0 and 3. The second keeps the shadows but makes three pixels the same white. The third is the global Reinhard operator: here the log average is 1, so the exposure maps to , and the curve gives the linear values . All five pixels stay distinct and in order. If the linear values of the third row go to 8 bits without the sRGB encoding, the codes are , and the two dark pixels are again nearly black: the encoding is a separate step, and it must not be left out.
A local example: a dark detail inside a bright window and a bright detail inside a dark room both need contrast. A single increasing curve gives each luminance one output, so where the two areas overlap in luminance, it cannot raise the contrast in both. A local operator can, because it compresses each pixel relative to its neighborhood.
Known algorithms
- Linear scale and clip. One exposure factor, then a clip at 1. . The base line; see also contrast stretching.
- Reinhard tone mapping. Exposure from the log average and a key, then or a form with a white point. An optional local step selects a blur size per pixel. Global .
- Tumblin and Rushmeier. A global operator that maps the brightness that a viewer would see in the scene to the same brightness on the display, from a model of brightness perception.
- Histogram based operators. Build a curve from the histogram of the log luminance, related to histogram equalization with a limit on the slope, as in CLAHE for local contrast. for bins.
- Durand and Dorsey. Split the log luminance into a base layer, by a bilateral filter, and a detail layer; compress only the base and add the detail back. This avoids most halos of plain blurs.
- Pyramid and gradient methods. Compress the bands of a Laplacian pyramid, or the gradients of the log luminance and then solve for the image.
- Filmic curves. Fitted curves with a toe and a shoulder, such as the curve of Hable (2010) and fits of the ACES reference curve. They are the common choice in games. Their shapes and constants are tuning, chosen for the look of film, not derived from a model of vision.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Reinhard tone mapping operator | Θ(p) global | Θ(p r) extra | deterministicnot in placeofflineiterative | 1 language |
Bounds
Every operator must read each input pixel and write each output pixel, so time is needed, and a global operator with a curve from a constant number of image statistics reaches . A histogram curve costs for bins. A local operator with a direct filter of taps per pixel costs . With a separable or recursive filter, or a pyramid, it costs per scale, so for scales.
A proved limit of global operators: a global operator that keeps the order of brightness is an increasing function . Where the image has a range of luminances that compresses, the slope of is below 1 on average over that range, so the contrast between nearby luminances in the range must drop. Only a local operator can keep contrast in two areas whose luminance ranges overlap, as the second example shows.
Reductions
- To display encoding. The output of tone mapping is linear. The display encoding, for example the sRGB curve of gamma correction, is applied after it. The two steps do different jobs and do not replace each other.
- From histogram equalization. Histogram equalization of the log luminance is a global tone operator: its curve is the cumulative histogram. Methods that cap the slope of this curve limit the contrast gain.
- From filtering. A local operator that uses a blurred luminance reduces to a filter of the image, such as a Gaussian filter or a bilateral filter, plus a global curve.
Applications
Tone mapping is the last step of a renderer that shades in linear radiance, which is what physically based shading produces. Games apply it in every frame, often with an automatic exposure. Film and offline renderers apply it, together with color grading, before the output. Photography uses it to show a high dynamic range image merged from several exposures. A high dynamic range display still needs a curve, with less compression, because scenes can exceed its range too.
References
- Jack Tumblin and Holly Rushmeier, Tone reproduction for realistic images, IEEE Computer Graphics and Applications 13(6), 1993, 42 to 48, the statement of tone reproduction as a map from scene values to display values that matches the brightness a viewer sees (general locator)
- Erik Reinhard, Michael Stark, Peter Shirley and James Ferwerda, Photographic tone reproduction for digital images, ACM Transactions on Graphics 21(3) (SIGGRAPH 2002), 267 to 276, the global operator with the key value and the local dodging and burning operator
- Frédo Durand and Julie Dorsey, Fast bilateral filtering for the display of high-dynamic-range images, SIGGRAPH 2002, 257 to 266, the local operator that splits the log luminance into a base layer, from a bilateral filter, and a detail layer, and compresses only the base
- Tomas Akenine-Möller, Eric Haines, Naty Hoffman, Angelo Pesce, Michał Iwanicki and Sébastien Hillaire, Real-Time Rendering, fourth edition, CRC Press, 2018, Chapter 8, Light and Color (the part on scene to screen and tone mapping)
- Erik Reinhard, Greg Ward, Sumanta Pattanaik and Paul Debevec, High Dynamic Range Imaging, Acquisition, Display, and Image-Based Lighting, Morgan Kaufmann, 2005, the chapters on tone reproduction, global and local operators (general locator)
- John Hable, Uncharted 2, HDR Lighting, talk at the Game Developers Conference, 2010, a filmic tone curve with a toe and a shoulder, fitted for a game (general locator)
Where this leads
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag RB0E9H Edit this page History Report an error Markdown