What the Heck is HDR Tone Mapping?
High Dynamic Range (HDR) photography is all the rage these days. It can produce stunning yet realistic photos with dynamic ranges that defy the recording ability of cameras as well as stylized renditions with exaggerated detail and tonal relationships that have spawned an entirely new art form. While seeming to be diametrically opposed, these differ mainly in the degree to which the same basic techniques are applied. Known collectively as "tone mapping," such techniques are at their heart optical illusions.
The human eye and brain together can see an extraordinarily wide dynamic range. The pupils dilate and contract, and the brain stitches together components of a scene to form a unified perceptual whole. Taken as an integrated system, our awareness of the world around us compensates for bright light and darkness more or less automatically. But the devices humankind has constructed to record and reproduce what we see are much more limited. Measured in DMax, contrast ratio and other metrics depending on the medium, every real world method of displaying an image has a limited range of brightness it can produce, just as every camera and scanner has a limited range of brightness it is capable of capturing.
It's just a basic fact that we can see far more than we can record or reproduce. Photographers have long sought ways to get around this basic problem. Although not perfect, graduated neutral density filters were my standard solution for many years. I still use them sometimes. By blocking the brightness from one side of an image to better match that of the other, use of a graduated neutral density filter is an attempt to compress the brightness range of a scene at the point it is captured photographically. It works equally with digital or film. But digital also opens up a range of possibilities not possible in the days of film where two or more images captured at different exposures can be blended to create a single composite image.
But as I explained last week, normal digital processes retain a fundamental problem having to do with the file formats used to represent images. None of them deal very well with extreme ranges of brightness. And thus the search for a solution continued. By making the leap to the use of 32-bit floating point numbers, HDR made it possible to create a single image file that accurately captured the full dynamic range of the real world and more. This only solved part of the problem though since there still isn't any way to display HDR images in their native format. And images that no one can see aren't of much use.
One of the easiest ways to address this remaining problem is to compress the brightness equally throughout a scene to get it to fit, but this tends to produce a relatively unsatisfactory result that loses detail in highlight and shadow areas at the same time as it leaves you with washed out mid-tones. A progressive contrast reduction S-curve can help, but still yields results no better than non-HDR blending methods. Another way to get around the problem is to selectively choose a slice in the middle of the contrast range that best represents a scene and sacrifice the extremes that lie outside that, accepting the resulting highlight and shadow clipping. But if this were the best we could do the same thing could be accomplished with a single appropriately exposed source image without the need for HDR or digital techniques.
A better solution utilizes more sophisticated methods that rely on an understanding of how the brain and eye process images to fool a viewer into seeing more contrast than is actually there. By selectively altering brightness within a scene, "tone mapping" attempts to preserve local contrast where the eye expects to see it, while shifting brightness in ways less apt to be noticed across an image to still compress global contrast. As such, HDR tone mapping is best understood as a form of optical illusion.
To understand what I'm talking about, let's first look at how digital sharpening works. Although it might not seem that way, the basic concept is the same as with tone mapping.
The human eye perceives the "sharpness" of an edge in an image primarily based on the degree of contrast along that edge. Soft images lack edge contrast while edge contrast in sharp ones is more pronounced. If an image wasn't captured with sufficient sharpness or if it lost detail through editing, the perception of sharpness can be restored by exaggerating what edge contrast does exist. Unsharp mask and other sharpening tools work by identifying contrast edges and brightening one side of the detected edge at the same time they darken the opposite side. As such, it doesn't really add any detail at all to an image; it merely accentuates the detail that does exist. Sharpening is thus a contrast based optical illusion.
Rather than limiting ourselves to selectively altering brightness along edges, what if we did it elsewhere in an image? When we visually scan a real life scene, our eyes automatically adapt to changing brightness and our brains "see" the result without us really being aware that any of this contrast adjustment is taking place. We look in a dark corner and our pupils dilate, we look in a brighter area and they contract. It's nice that things do work this way or else our vision would be limited more or less the same way that cameras are. Tone mapping works by utilizing what we know of this process to create a lower contrast version of an HDR image that still looks like it has the contrast of the original. It attempts to create a version that might represent what we could have seen rather than what a camera would.
But whereas sharpening algorithms alter contrast along what they perceive to be edges, HDR tone mapping algorithms alter contrast across what they perceive to be the surfaces between those edges. They allow contrast to remain as it is at edges, but subtly work to shade it across the defined surfaces such that the next edge has sufficient contrast available for it to also look sharp.
Imagine a gradient across an image from extreme brightness to extreme darkness. If the contrast were evenly reduced across that surface it would probably look just fine. But suppose detail edges exist on that surface. As an example, perhaps this surface were a wooden boardwalk receding into the distance with planks running horizontally across the frame and the foreground in darkness but the background brightly lit. Reducing the contrast evenly across the frame from top to bottom will make the result appear dull and washed out due to the overall contrast reduction across the gradient. The board edges simply wouldn't retain enough contrast if everything within the frame were altered evenly. If instead, contrast were compressed across each plank individually with each one starting subtly darker than the one in front of it ended up being, the eye likely would not notice the subterfuge yet the edges between the boards would appear more pronounced. This is the theory of tone mapping. As I say, it's an optical illusion. But if it is, the way our brains process what our eyes see is an optical illusion as well. We really don't see the extremes of brightness we are presented with. Our brain and eyes compensate.
When done in moderation, tone mapping an HDR image can produce results that appear fairly realistic. When taken to extremes, it can create exaggerated results that accentuate contrast beyond the point of reality. The only constraints are your intent, your skills, and the capabilities of the software you are using.