This is a recurring nightmare for a new photographer: they head out with their brand new state-of-the art digital camera, capture a set of images with a vast expanse of sky or smoothly changing background, come home, fire them up on their computer, play with a few sliders and … gasp! … there are visible bands (posterization, stairstepping, quantization) all over the smoothly changing gradient. ‘Is my new camera broken?!’, they wonder in horror.
Relax, chances are very (very) good that the camera is fine. I am going to show you in this post how to make sure that that is indeed the case and hone in on the real culprit(s).
In the absence of noise humans apparently perceive steps in gradients as ‘smooth’ if the change in Luminance from contiguous steps is less than about 1%. They may see them as discrete, separate steps if the change in Luminance is greater than about 1% instead (Weber-Fechner law).
In the presence of Noise the 1% threshold is raised significantly (see here for a very good demonstration of this effect). The trouble is (:-) that modern sensors tend to be mighty clean at base ISOs.
Since Raw data is for all intents and purposes proportional to Luminance (unlike gamma corrected jpegs or TIFFs) it is easy to verify whether image information is rolling off the camera posterized or not: just take a look at the raw data and see whether the green channel values within the smooth gradient jump by more than 1% at any point (that would be 1 level around DN 100, 2 around DN 200, 10 around 1000 and so on).
This is the raw file of a gentleman who saw contour banding in the final image where the yellow frame is shown, as opened in RawDigger. The histogram refers to a two-bit wide vertical slice more or less in the center of the yellow rectangle to the left of the flower (if you squint you can see the very thin selection):
Ignore Red and Blue which Nikon WB pre-conditions. The green histogram above is actually the superposition of G1 and G2 so it represents a true ‘single quartet’ vertical gradient 2000 pixel high within the yellow box .
The green histogram appears fully populated. Nowhere is more than one level skipped from ADU 116 to 530 (the value range in the box), excluding the very first pixel at 111. Therefore any posterization perceived anywhere within the yellow box area was clearly not the fault of the hardware in this case but it is being generated by downstream processing – with 8 bit conversions at the top of the list of potential guilty parties.
Why 8 bit conversions? Ignoring gamma for a second, because level 50 at 8 bits is a relatively large value compared to its full scale of 255 (about 20% in fact) and a change of just one level there is greater than the visibility threshold (1/50 = 2%) in the absence of noise: any gradient around those levels may indeed be perceived as posterized. 20% of full scale in 14-bit raw data would on the other hand be represented by a level around 3000 (like in the example above), so a change of just one level there would be much less than 1% (1/3000=0.03%), hence not visible according to Weber-Fechner.
If you are not using a raw workflow, say you like to shoot 8-bit jpeg, you are potentially in trouble straight from out-of-camera on vast expanses of smooth gradients as found for instance in dark skies.
If on the other hand you are using a 16 bit (or even better floating point) workflow from raw data, as long as you are using a standard gamma corrected color space and you did not apply extreme contrast adjustments (levels and curves for instance) in PP, it is unlikely that you would see banding/posterization on a properly driven and calibrated good quality true 8-bit panel.
Most video drivers and cards work at 8 bits. That’s typically (not always) fine as long as you’ve worked in 16-bits or floating point up to that point and you have not stretched the image too thin in PP. The problem is often that either the calibration has not been done properly or the panel is not truly 8 bit (many are only 6 bits with dithering, especially laptop screens): FRC is a cheap word where low-bit-depth monitors are concerned. These are two of the main reasons for perceived banding. Printer drivers and printers are just as guilty just as often.
So if you see contour banding in a smooth changing part of your photograph, you’ve satisfied yourself that the raw data is not posterized (it virtually never is), you adjusted your image in LR, PS, Capture NX or any application that never converts data to less than 16 bits other than at the very end and you did not perform extreme adjustments on it – feast your eyes on your output chain.
As far as monitors are concerned get a real 8+ bit panel ( no ‘effectively 8 bit’) with 12+ bit internal LUT and calibrate it properly by adjusting its Brightness and Color Temperature through the hardware knobs instead of letting the profiling software do it for you automatically through its typically 8-bit look up tables – which reduce available bits to less than 8. Only then let it profile it. Excellent open source dispcalGUI does a better job than most profilers bundled with the colorimeter and treats calibration and profiling as two separate steps. Here is a simple tutorial on how to use it.
In the field you can Expose To The Right, letting undesirable highlights blow. And if all else fails you can try to add a touch of random noise to the affected area in post processing to hide the banding – because in the presence of noise the 1% visibility threshold is raised significantly.
It’s the price we pay for dealing in integers.