3. Dynamic Range
The pictures shown in Figure 4
were taken in sequence from a roof on a winter morning. Anyone who has
ever tried to photograph a sunrise or sunset with a digital camera
should immediately recognize the problem at hand, even in an era in
which a phone camera can deliver HDR images. With a standard exposure,
the sky comes in beautifully, but foreground houses are nearly black.
Using longer exposures you can bring the houses up, but by the time
they are looking good the sky is completely blown out.
The
limiting factor here is the digital camera’s small dynamic range, which
is the difference between the brightest and darkest things that can be
captured in the same image. An outdoor scene has a wide array of
brightnesses, but any digital device can read only a slice of them. You
can change exposure to capture different ranges, but the size of the
slice is fixed.
Our eyes have a much larger dynamic range and our
brains have a wide array of perceptual tricks, so in real life the
houses and sky are both seen easily. But even eyes have limits, such as
when you try to see someone behind a bright spotlight or use a laptop
computer in the sun. The spotlight has not made the person behind any
darker, but when eyes adjust to bright lights (as they must to avoid
injury), dark things fall out of range and simply appear black.
White on a monitor just isn’t very bright, which is
one reason professionals work in dim rooms with the blinds pulled down.
When you try to represent the bright sky on a dim monitor, everything
else in the image has to scale down in proportion. Even when a digital
camera can capture extra dynamic range, your monitor must compress it
in order to display it.
Notes
| Floating point decimal numbers
(which are effective for storing a wide range of precise values
efficiently) and high dynamic range numbers (which extend beyond
monitor range) have tended to be lumped together, but each is a
separate, unique concept. If your 8-bit color range is limited to 0 to
255, then as soon as you have a value of 256, or –1, you are in high
dynamic range territory. Floating-point values are merely a method used
to store those out-of-range values without hitting an absolute low or
high cutoff. |
A standard 8-bpc computer image uses values 0 to 255
to represent RGB values. If you record a value above 255—say 285 or
310—that represents a pixel beyond the monitor’s dynamic range,
brighter than white or overbright. Because 8-bpc pixels can’t actually
go above 255, overbright information is stored as floating-point
decimals where 0.0 is black and 1.0 is white. Because floating-point
numbers are virtually unbounded, 0.75, 7.5, or
750.0 are all acceptable values, even though everything above 1.0 will
clip to white on the monitor (Figure 5).
In recent years, it has become simpler to create
still HDR images from a series of exposures—files that contain all
light information from a scene (Figure 6). The best-known paper on the subject was published by Malik and Debevec at SIGGRAPH ’97 (www.debevec.org
has details). In successive exposures, values that remain within range
can be compared to describe how the camera is responding to different
levels of light. That information allows a computer to connect bright
areas in the scene to the darker ones and calculate accurate HDR pixel
values that combine detail from each exposure.
But with all the excitement surrounding HDR imaging
and improvements in the dynamic range of video cameras, many forget
that for decades there has been another medium available for capturing
dynamic range far beyond what a computer monitor can display or a
digital camera can capture.
That medium is film.
4. Cineon Log Space
A
film negative gets its name because areas exposed to light ultimately
become dark and opaque, and areas unexposed are made transparent during
developing. Light makes dark. Hence, negative.
Dark is a relative term here. A white piece of paper
makes a nice dark splotch on the negative, but a lightbulb darkens the
film even more, and a photograph of the sun causes the negative to turn
out darker still. By not completely exposing to even bright lights, the
negative is able to capture the differences between bright highlights
and really bright highlights. Film, the original image capture medium,
has always been high dynamic range.
If you were to graph the increase in film “density” as increasing amounts of light expose it, you’d get something like Figure 7. In math, this is referred to as a logarithmic curve. I’ll get back to this in a moment.
Digital Film
If a monitor’s maximum brightness is considered to
be 1.0, the brightest value film can represent is officially considered
by Kodak to be 13.53 (although using the more efficient ICC color
conversion, reveals brightness values
above 70). Note this only applies to a film negative that is exposed by
light in the world as opposed to a film positive, which is limited by
the brightness of a projector bulb, and is therefore not really
considered high dynamic range. A Telecine captures the entire range
of each frame and stores the frames as a sequence of 10-bit Cineon
files. Those extra two bits mean that Cineon pixel values can range
from 0 to 1023 instead of the 0 to 255 in 8-bit files.
Having four times as many values to work with in a
Cineon file helps, but considering you have 13.53 times the range to
record, care must be taken in encoding those values. The most obvious
way to store all that light would simply be to evenly squeeze 0.0 to
13.53 into the 0 to 1023 range. The problem with this solution is that
it would only leave 75 code values for the all-important 0.0 to 1.0
range, the same as allocated to the range 10.0 to 11.0, which you are
far less interested in representing with much accuracy. Your eye can
barely tell the difference between two highlights that bright—it
certainly doesn’t need 75 brightness variations between them.
A proper way to encode light on film would quickly
fill up the usable values with the most important 0.0 to 1.0 light and
then leave space for the rest of the negative’s range. Fortunately, the
film negative itself with its logarithmic response behaves just this
way.
Cineon files are often said to be stored in a log
color space. Actually, it is the negative that uses a log response
curve and the file is simply storing the negative’s density at each
pixel. In any case, the graph in Figure 8 describes how light exposes a negative and is encoded into Cineon color values according to Kodak, creator of the format.
One strange feature in this graph is that black is
mapped to code value 95 instead of 0. Not only does the Cineon file
store whiter-than-white (overbright) values, it also has some
blacker-than-black information. This is mirrored in the film lab when a
negative is printed brighter than usual and the blacker-than-black
information can reveal itself. Likewise, negatives can be printed
darker and take advantage of overbright detail. The standard value
mapped to monitor white is 685, and everything above is considered
overbright.
Close-up: All About Log
You may first have heard of
logarithmic curves in high school physics class, if you ever learned
about the decay of radioactive isotopes. If a
radioactive material has a half-life of one year, half of it will have
decayed after that time. The next year, half of what remains will
decay, leaving a quarter, and so on. To calculate how much time has
elapsed based on how much material remains, a logarithmic function is
used. Light, another type of radiation, has a
similar effect on film. At the molecular level, light causes silver
halide crystals to react. If film exposed for some short period of time
causes half the crystals to react, repeating the exposure will cause
half of the remaining to react, and so on. This is how film gets its
response curve and the ability to capture even very bright light
sources. No amount of exposure can be expected to affect every single
crystal. |
Although the Kodak formulas are commonly used to
transform log images for compositing, other methods have emerged. The
idea of having light values below 0.0 is dubious at best, and many take
issue with the idea that a single curve can describe all film stocks,
cameras, and shooting environments. As a different approach, some
visual effects facilities take care to photograph well-defined
photographic charts and use the resultant film to build custom curves
that differ subtly from the Kodak standard.
As much as Cineon log is a great way to encode light
captured by film, it should not be used for compositing or other image
transformations. This point is so important that it just has to be
emphasized again:
Encoding color spaces are not compositing color spaces.
To illustrate this point, imagine you had a
black pixel with Cineon value 95 next to an extremely bright pixel with
Cineon’s highest code value, 1023. If these two pixels were blended
together (say, if the image was being blurred), the result would be
559, which is somewhere around middle gray (0.37 to be precise). But
when you consider that the extremely bright pixel has a relative
brightness of 13.5, that black pixel should only have been able to
bring it down to 6.75, which is still overbright white! Log space’s
extra emphasis on darker values causes standard image processing
operations to give those values extra weight, leading to an overall
unpleasant and inaccurate darkening of the image. So, final warning: If
you’re working with a log source, don’t do image processing in log
space!