Dynamic range and contrast control


Posting rules: It shouldn't need saying, but... play nice. Please keep your discussions civil. You can disagree, just don't be disagreeable. And, of course, all of the usual stuff like no spamming. Tex adds: I'll be rigorously enforcing this as we go along. We're probably going to be a small community in a little lifeboat, so we can't have members at each others' throats. This is for the sake of the project as a whole. So when you post, pretend you're speaking in person with your very wealthy auntie who has always treated you wonderfully and currently lists you prominently in her will. I won't be tossing anyone out of the forums because we are all in this together (except spammers: immediate membership cancelation), but I'll delete suspect posts right away.


1 post / 0 new
Doug
Dynamic range and contrast control

Relight in LightZone 3.9 is a fourth generation tool. The earlier versions still exist, accessible through Styles, and provide somewhat different capabilities. I think it's ironic that Light Crafts never shed much light on how its Relight tool works. The following is assuredly not gospel. I guarantee that there are mistakes of various kinds. But we have to start somewhere. Please add your own observations.

Contrast Mask

In the beginning, there was the Contrast Mask tool. This is the classic contrast masking operation originally used in wet darkrooms on large-format film. Here are a couple of early articles on the digital darkroom version from Luminous Landscape [1] [2], and other articles about digital contrast masking can easily be found on the Web [3] [4] [5] [6]. Contrast masking essentially reapportions the contrast based on conditions within the general area around each pixel. A quick overview of the concept: there are various kinds of "contrast" in an image. There's the overall contrast: does the histogram reach all the way from black to white? There's pixel-level contrast, which we call sharpness. There's relative contrast within an area of the image, which we call detail, and relative contrast between areas of an image which is sometimes called depth. Contrast masking operates at the "area" level, increasing detail within areas but with some loss of depth between areas.

The Radius slider basically controls the size of what we're going to consider to be an area; for each pixel, it determines how much effect other pixels have depending on how far away they are. A smaller radius generally gives more detail contrast at the cost of some depth, while a larger radius gives more depth at the cost of some detail contrast. In practice, it isn't a strong trade-off and the radius is usually chosen based on the desired depth.

The LightZone version of Contrast Mask includes a Gamma slider in correspondence with the wet-darkroom process. Some of the above-linked references use curves and such to attain similar effects. The primary effect of the Gamma slider is to control how much bright areas (such as sky) are affected. To some extent, LightZone's Gamma slider is "making a virtue out of a necessity." Most other photo editors, notably including Photoshop, do their editing in a gamma-adjusted color space. Consequently, the mask that is generated by straightforward operations in those editors is gamma-adjusted. LightZone edits in a linear color space, so it needs to do a gamma adjustment on the mask in order to give similar results. There was little cost in making the gamma setting a user-adjustable control. The default gamma setting of 2.2 closely corresponds to the gamma of popular Photoshop editing spaces such as sRGB and Adobe RGB (ProPhoto RGB gamma is 1.8) and with Lightroom's editing gamma which is based on sRGB.

If you need a stronger effect than the default settings give you, you can try increasing the Opacity (default is 50%) and/or changing the Blending Mode. The classic digital contrast mask technique uses the Overlay blending mode, but LightZone's Contrast Mask tool defaults to the more gentle Soft Light. You can use Overlay for a stronger effect. If you want a very strong effect, you can use Soft Dodge or even Color Dodge, but you may need to increase the Gamma setting — with these extreme blending modes, the Gamma slider tends to control the darker areas more than it does the brighter ones. The Color Burn blending mode introduces both extreme contrast and some color-shifting that can be used to make subtle color differences less subtle.

If you're curious, try setting Opacity to 100% and Blending Mode to Normal. That will show you the mask that the tool generates. It's a very blurry B&W negative of the original. Dark areas are intended to be burned, while light areas are intended to be dodged.

Tone Mapper

Starting somewhere around LightZone 1.6, the Contrast Mask tool was replaced with the Tone Mapper. This tool is an upgraded Contrast Mask, with more aggressive default settings, a wider Gamma range (but a restricted Radius range), and a new Detail slider. When the Detail slider is set at the minimum (0.00), the Tone Mapper acts almost identically to the earlier Contrast Mask — there are small differences in the way the mask is constructed, but they don't result in visible differences.

The Detail slider reduces the masking effect on midtone areas. The contrast masking operation aims to equalize the detail across the image, and while that usually means more detail in bright and dark areas, it can mean reduced detail in midtone areas. The Detail slider combats that side-effect.

Tone Mapper is, overall, considerably more capable than Contrast Mask, and the only reason I know of to use Contrast Mask is if you want the flat-lighting effect from a radius setting of less than 100 pixels.

Polarizer

As far as I can tell, the Polarizer was never released as a first-class LightZone tool — it appears to have been introduced as a Style in the LightZone 3.0 release. Light Crafts chose to give it the same appearance as the Relight tool (below), and that has caused considerable confusion about how Relight behaves, because some people were looking at Polarizer, some were looking at Relight, and some (including me) were looking at Polarizer sometimes and at Relight other times.

Polarizer is a radical departure from the Contrast Mask and Tone Mapper. It is as close to an HDR (High Dynamic Range) tool as LightZone offers, even moreso than the Relight tool. This impression is reinforced by the fact that Light Crafts used the Polarizer for all of the High Dynamic Range styles. It's also used in all of the High Contrast styles that use relighting (Wow! doesn't), and in the Crisp Look and Hard Look styles.

The Shadows and Highlights sliders are like automated ZoneMapper controllers. They push the brightness of each pixel up or down depending on its own original brightness. Unlike Tone Mapper and Contrast Mask, there is no reference to neighboring pixels.

The Shadows slider lightens the entire brightness range except for pure black and pure white. It does affect the shadows more than the midtones, and the midtones more than the highlights, but the drop-off in effect is gradual. Even with the Shadows slider at 0, there will be some overall lightening (about 1/2 Ev) of the image.

The Highlights slider darkens the entire brightness range except for pure black and pure white. It is much more effective in the brightest two Ev than in the midtones and shadows, and seems to have particularly strong effects on contrast across pixels that are in the second-brightest Ev (25-50% gray or so). With the Highlights slider at 0, there is no apparent darkening effect.

The Detail slider, along with the Depth slider, appears to perform a Local Contrast Enhancement (LCE) [7] [8] [9] to help retain the contrast in the midtones that the Shadows and Highlights sliders are squashing out. Like contrast masking, LCE adjusts contrast within an area whose size is determined by the Depth slider. The mathematics of the adjustment are different than with contrast masking — it uses Unsharp Mask (USM) rather than dodging and burning — and the effects can be more striking. Increasing the detail slider tends to darken the image, which may be why the Shadows slider always lightens the image at least a bit. It appears that with the Detail slider at 0, there is no effect. By the way, the two Soft Wow styles add a conventional USM-based LCE with a huge radius (500 pixels) along with the Polarizer.

The Fuzz slider on Polarizer is the great mystery of LightZone. It seems to only matter when some Detail is being added. Higher levels seem to bring out some sharpness in the enhanced detail, with a noticeable leaning toward a bit of darkening of the fine detail. Back in 2007, Jacek Góźdź wrote his observations about "Relight" (PDF), which in retrospect appear to be about Polarizer.

Relight

The Relight tool appears to have been introduced in the LightZone 3.0 release. Although very similar in appearance to Polarizer, the behavior is different, especially with the Highlights slider.

As with Polarizer, the Shadows and Highlights sliders are like automated ZoneMapper controllers. They push the brightness of each pixel up or down depending on its own original brightness. Like Polarizer and unlike Tone Mapper and Contrast Mask, there is no reference to neighboring pixels.

The Shadows slider lightens or darkens the entire brightness range except for pure black and pure white. The general behavior is similar to the Polarizer: it does affect the shadows more than the midtones, and the midtones more than the highlights, but the drop-off in effect is gradual. An improvement over Polarizer is that it's possible to shut off the lightening by setting the Shadows slider to 1.00. In addition, it's possible to darken the image by setting the Shadows slider below 1.

The Highlights slider darkens the entire brightness range evenly, including darkening pure white to a gray. Its behavior appears to be nearly identical to the negative side of the Luminosity slider on the Hue/Saturation tool — a Highlights setting of 0.70 corresponds with a Luminosity setting of -70. Bizarrely, at settings of 0.98 and above the brightest Ev goes into negative-contrast; fortunately, there's little reason to go into this regime, which involves a darkening of over 5 Ev. With the Highlights slider at 0, there is no effect. Personally, I find the Highlights slider to be of very questionable value.

As with Polarizer, the Detail and Depth sliders appear to perform a Local Contrast Enhancement (LCE) to help retain the contrast in the midtones that the Shadows and Highlights sliders are squashing out. Unlike Polarizer, the no-effect point is at 1.00, and unlike Polarizer, increasing the Detail doesn't significantly affect the overall image brightness. Lower values slightly reduce detail contrast.

The Fuzz slider on Relight acts as a USM sharpening tool with a radius of ten times the Fuzz slider setting, which implies that for most uses, the maximum reasonable setting is maybe 0.30 or so. The amount of sharpening isn't controllable except through the Fuzz slider. If the Detail slider is set to 1.00 (no effect), the Fuzz slider has no effect, either.

In Summary

I like the Tone Mapper a lot. For many images, slapping a Tone Mapper on them does wonders. When you're dealing with an HDR problem, especially if the highlights need some help, Polarizer is probably the tool of choice. I'll only use the Relight tool with the Highlights slider set to 0. I like the ability Relight gives me to darken shadows as well as to lighten them. Also, I like being able to set Shadows to 1.00 and Highlights to 0 and use Relight just for local contrast enhancement, often with a bit of sharpening from setting Fuzz to 0.2 or so.

A final note: I primarily use LightZone on B&W images. With color, one needs to be a bit cautious about adjusting the red, green, and blue channel levels independently. Major level changes could result in shifts in both hue and saturation if the changes are per-channel. I don't know which tools and sliders, if any, LightZone handles in full-color mode rather than per-channel mode.