How to Use the Full Photographical Dynamic Range of Your Camera
Holiday Season Sale!
All LibRaw Products and Bundles - 25% off
Our Special Prices are valid until January 02, 2025.
First published on PhotographyLife
Suppose you've read somewhere that the dynamic range of your camera at a certain ISO setting is 11 stops. And here comes the immediate question – how can one use such a treasure to its full potential? Optimal exposure for RAW is the answer. But now we need to explain what we mean when we say, "optimal exposure for RAW".
Let’s start with one of the problems, which arises as a result of non-optimal exposure for RAW.
Here is a typical wide dynamic range low-light scene. According to Sekonic spot-meter, it is wider than 11 stops.
We made two shots of the same scene – one (#4152) was exposed according to the in-camera exposure meter set to matrix metering mode. The other shot (#4153, Figure 1.) was exposed 1 2/3 EV hotter (spot-metered from white half-dome, for the procedure to determine the amount of correction please read on, or you can simply bracket). Matrix metering seems to have gotten fooled by the specular highlights on that white half-dome, hence it underexposed a little more than usual.
We opened them both in FastRawViewer, applied Shadow Boost to both of them to open the shadows, and applied +1.67 EV exposure correction to shot #4152 (the one that was exposed according to in-camera exposure meter recommendation, so that both of the shots had the same overall brightness).
As we can see on to the RAW histogram for shot #4153 (Figure 2) the capture definitely has more than 11 stops.
Now we look at shot #4152.
As we can see, shot #4152 exhibits significant noise everywhere below midtone.
The thing with a camera's dynamic range is that those exciting numbers become valid only when the signal reaches the maximum; that is, the exposure is the hottest possible for the given camera at a given ISO. Imagine a bucket having a volume of 2 gallons. If you do not fill it up to the top, some volume is wasted. It's the same with a camera. If your whitest white is not exposed to the maximum, the top portion of the dynamic range is not being used. This immediately means that in order to use the dynamic range of the camera to its fullest and simultaneously to have as little shadow noise as possible, the whitest whites where you want to keep some texture details need to be exposed so that they are just below clipping. In a sense, one can say that dynamic range characterizes the depth, and starts from the top, while the bottom is sort of fuzzy because of individual tolerance to noise, viewing conditions, size of the output, etc.
Back to our bucket analogy – if one tries to pour, say, 2.5 gallons in it, an overflow happens, and half a gallon will end up on the floor. In digital photography we know this as highlight clipping. That is, if we try to expose a pixel hotter than its capacity allows, everything that is above the capacity will pour out, causing blown-out highlights. By the way, if one tries to set exposure low to keep from clipping all the light sources and specular highlights, he is, most probably, also wasting a couple of stops of dynamic range.
Unfortunately the metering systems of our cameras are not designed to provide the proper placement of the highlights right out of the box (this is partially because to do so, the camera's AI needs to make a guess as to what a photographer considers to be "important highlights", and if it guesses wrongly, it may arrive at an unacceptable exposure).
One can try different metering modes with the camera, with mixed results when it comes to optimal exposure for RAW. You can use RawDigger or FastRawViewer to see how close you are; be prepared for more misses than hits, in part because the complex metering modes are optimized for JPEGs rather than for RAW. Reliability and repeatability, however, come with manual metering in the spotmeter mode. While placing important highlights at the top, let's take advantage of one very well-known and stable feature of the camera: cameras are calibrated in such a way as to provide the exposure that will result in the rendering of whatever was under the spotmeter as "middle grey".
For a JPEG middle grey is defined as 118 RGB in sRGB color space, which corresponds to the proverbial 18% grey (and L* = 50 in Lab color model, too).
For RAW, middle grey is not fixed by common standards, and camera makers have some freedom while placing it. Why is this so? Modern cameras have relatively low noise, and customers often complain that the highlights in their exposures are blown out. To provide extra room for the highlights, camera makers tend to calibrate the exposure so that it shifts middle grey down to 13% (instead of 18%), and often even lower than that. This is what often causes the rumors that camera makers cheat with ISO. In fact it is not cheating, because in most cases the ISO speed is defined for the processed output (JPEG) and not for RAW.
Lets look at the shots of the scene we have already used in the article “Why Bother Shooting RAW if Culling JPEGs”.
Shot #1861 was exposed according to the in-camera exposure meter and it has the hottest possible exposure for JPEG. Shot #1866 had exposure increased by 1 2/3 EV, and it has the optimal exposure for RAW (ETTR). If we look at the shadows of those two shots after running them through ACR (shot #1866 was converted without any adjustments; while shot #1861 was converted with +1.67 exposure correction applied in ACR, to “match” the exposure difference between the shots), we see that there’s quite a difference in the shadows between these two shots. By the way, the smaller the sensor is, the more difference optimal exposure will make.
A tone curve applied when rendering a JPEG takes care of matching of whatever the middle grey is in RAW to the standard 18% grey in JPEG. But if we are shooting RAW and trying to exploit the dynamic range of our cameras to its full potential we need to set an exposure which is close to optimal, and place the highlights in the RAW where they belong – at the top of the dynamic range of your camera.
In other words, the top of the dynamic range of the scene (and by scene we mean everything you want to capture, and not the irrelevant / specular highlights) needs to be placed at the top of the dynamic range of the camera.
Back to the question of achieving this goal in a reliable and repeatable manner:
- First, we need to know the value for the middle grey in RAW numbers. This varies by camera model and sometimes by ISO setting.
- Next we need to know the maximum value that the RAW file may contain. This also varies by camera model and may depend on ISO setting; it may be the same as the maximum value for ADC (12 bits, 4095; 14 bits, 16383), or it may be less.
- Finally we need to calculate the result – the number of stops between the middle grey in RAW and the maximum in RAW for this specific camera and given ISO setting, to use this number as the exposure compensation when metering off the highlights that we want to keep.
Again, to use the result we need to meter from the whitest white in the scene where we want to preserve some texture and details, and apply exposure compensation in the camera that equals the number we have just determined. Consequently, the important whitest whites of the scene will receive the maximum allowed exposure, thus being placed at the top of the dynamic rage of the camera. This way you have achieved optimal exposure, also known as ETTR.
The whole thing hinges on the theory that whatever is presented to an exposure meter will be recorded as middle grey as soon as the exposure meter recommendations are followed. Let’s check this theory.
We made six shots of the ColorChecker (Figure 6):
For each shot, we spot-metered one of those neutral grey patches at the bottom row, starting from the white patch, setting the exposure according to the recommendations of the spot meter. Next, we opened those shots one by one in RawDigger, sampled the patch we spot-metered, and checked the RAW values for this sample.
As you can see, the RAW values for the patch under the meter are very close to each other:
Because the camera was set to record both RAW and JPEG, we can check the RGB values in Photoshop too. As expected, they also turned to be very close to each other and to the target value for the mid-tone for JPEG, RGB=118.
Now that we are confident that the spot meter indeed guides the exposure in such a way that whatever shade of grey we put under the spot meter, the result will be the same number in RAW, with the number representing middle grey in terms of camera calibration for RAW.
Because the theory proves to be true, you don't need to meter and shoot all 6 patches: one is enough, or you can use a grey card.
1. Determining the Value for the Middle Grey in RAW Numbers
To get the most accurate reading for the middle grey in RAW, it is more practical to use a light grey patch / card (ColorChecker Passport has a separate grey page for white balance, it has L*=81, or, in other words, it is 60% grey, light enough to use with confidence) or matte white. The reason for using lighter tones is to keep flare as low as possible for both metering and capture. The higher reflection values of the lighter samples are less prone to flare compared to lower reflection values for dark grey and black samples.
So to get GMiddleGrey, make a shot with exposure setting according to the spot meter recommendation for a white or a light grey patch, open the shot in RawDigger, place a sample on the patch from which you metered, and read average value for the Green channel, Avg G.
In our case, GMiddleGrey = 1435.
2. Determining the Maximum Value that the RAW May Contain
Now let's determine the maximum value for the G channel that RAW can contain (maximum values may be different for different channels).
There are basically 2 ways to determine the maximum:
- One way, which does not require additional shots, is to include from the beginning some source of relatively small specular highlights in the scene (a shiny metal ball, for example, is what is often used); however, this can create flare in the shot, and that flare will throw the metering off; maybe just a little, but sometimes significantly.
- The other way is to simply shoot with long exposure, ensuring that part of the shot reaches clipping.
The truly clipped region will usually have a very small sigma (s, standard deviation, Std.Dev.) value, in the order of single digits, in many cases very close to 0.
The mean (average, Avg) value of the green channel for the clipped region is the maximum raw value we are after.
On Figure 10, the average for green (Avg G) is 14,594.4; the standard deviation for green (sG) is 59.4. This means that there is no clipping.
On Figure 11, the average for green (Avg G) is 15,478.7; the standard deviation for green (sG) is 2.03. That is the G channel clipping all right, and increasing exposure further will not help decrease sG in any significant manner - see the next Figure, #12.
On Figure 12, the average for green (Avg G) is 15,477.3; the standard deviation for green (sG) is 1.81; that is, the green channel G is clipped, like it is on the previous one:
Nevertheless, the Avg G from the previous shot, #2255 (Figure 11) is a better choice: as you can see the Avg G is larger here, and this is because we triggered intense anti-blooming on shot #2256 (Figure 12), and it acts like solarisation, also known as a Sabattier effect. On film, increasing exposure results in decreased density of the negative; however, it is much milder on digital.
So, we will consider Avg G for a sample area from shot #2255 (Figure 11) as maximum raw value: Gmax = 15,478.7
3. Calculating the Exposure Compensation for this Specific Camera and Given ISO Setting
Finally, let’s calculate the value of exposure compensation (the number of stops, EV, between the middle grey in RAW and maximum / clipping point in RAW) for the given camera at a given ISO.
We are going to use the formula:
EV = log2(GMax / GMiddleGrey) | (1) |
If you are interested in what the corresponding percent of grey is, you can calculate it as:
percent = 100% * GMiddleGrey / GMax | (2) |
In our case GMiddleGrey = 1435 and Gmax = 15,478.7, so using the formula (1a) we get:
log2(15,478.7 / 1435) ≈ 3 1/3 EV |
That is this value of exposure compensation turns to be +3 1/3 EV (meaning the calibration for our camera puts the mid-tone in raw to 9.27%, nearly a stop lower than the "expected" 18%).
Let's shoot with calculated exposure compensation and see...
For the next shot #2257, we metered off the white patch, applying to the meter readings the exposure compensation we just determined, +3 1/3 EV.
Now we open it in RawDigger and check raw values of the white patch:
As you can see, for a white patch average RAW value for Green channel (Gavg) is 14592.5. That is we are very close to the clipping point but still below it.
If we look at the JPEG of the shot #2257 (Figure 14) we will see that we “overexposed”: R=G=B=255. That is, of course, not so. OOC JPEGs do not use the full dynamic range available in RAW.
If you hate calculations, you can use a brute force approach. Shoot some neutral patch or grey card, setting the exposure as per your camera's spot-meter recommendations and start adding exposure compensation, EC (you can set EC initially to +2 1/3 EV, which corresponds to calibration of the mid-tone in raw to 20% grey; we suggest this because calibration shouldn't be higher than 20%) until the raw values for the patch or card comes close to clipping, within 1/3 EV from it.
Incidentally, you can often hear advice to meter off of the 18% grey card to set the correct exposure. This exposure is not likely to be optimal for raw, as in most cases it does not place the highlights high enough on the DR scale.
Shot #2253 was metered from the N5 patch of ColorChecker with zero exposure compensation, which by design has L*=50, or, in other words, it is 18% grey.
As you can see in RawDigger, the white patch is recorded 1 stop below clipping, and we have not achieved optimal exposure (Figure 15). Not even close.
If we check OOC JPEG for the same shot (Figure 16) we will see that while middle grey was correctly placed at 118 (sample 2), the RGB values for the white patch (sample 1) are (220, 220, 225), that is, seriously below maximum value.
Sekonic 758 in incident metering mode recommended 1/4s for shutter speed, matrix and center-weighted metering in the camera suggested 1/6s and 1/5s, respectively, while the shutter speed for ETTR, as we already know from shot #2257, is 1/2.5s. All out-of-the-box metering turned to be inefficient in terms of ETTR, but very consistent with the ≈1 EV difference we observed between calibration for raw for this camera (≈9%) and calibration for JPEG (≈18%).
We are very happy to hear that a new camera has ½ of a stop more DR than a previous model. We consider those ½ stop to be a huge improvement. However, if we are not using ETTR, we will be getting from this new camera the same or even lower image quality an ETTR practitioner is getting from the previous model.
Comments
Jim (not verified)
Wed, 05/10/2017 - 19:01
Permalink
How to recognize clipping using standard deviation
Could you please clarify the following:
You said that lack of clipping will be seen by a small standard deviation. You used the example in Figure 5 of 59.4. On figure 6 you used the example of 2.03 as almost clipped and in Fig 7 1.8 as definetly clipped. This seems backwards to me. A) is there a cut-off point that indicates clipping and B) are small SDs indicative of clipping or are small numbers?
Thanks in advance for your time.
LibRaw
Tue, 06/20/2017 - 13:57
Permalink
Dear Sir:
Dear Sir:
> You used the example in Figure 5 of 59.4
That would be Figure 10, shot taken at ISO 200, 1/2.5 sec, f/8.
> On figure 6 you used the example of 2.03 as almost clipped
That would be Figure 11, shot taken at ISO 200, 1 sec, f/8, that is hotter .
> in Fig 7 1.8 as definetly clipped
And that would be Figure 12, shot taken at ISO 200, 1.3 sec, f/8, even more exposed than the previous.
Std.Var. goes down to near zero because signal minus photon noise is already causing clipping. Generally, for highlights, as soon as we enter the territory where Std.Dev. starts decreasing, we are closing to clipping.
Howard (not verified)
Thu, 10/25/2018 - 16:19
Permalink
sony a6500 testing for dynamic range per your web page.
I tried to carefully follow your instructions on this page. My middle grey is roughly similar to yours at 1675 but my G max is only just under 4096. 4096 is the maximum theoretical value for 12 bits. Your example for a Nikon used a 14 bit raw file. So my EV distance between midle grey and max is only 1.27. That does not seem reasonable. I tried looking at the same sample raw files with a number of other programs, even FastRawViewer and they show that I have at least 3.3 stops between middle grey and blown.
My determination of the maximum values works exactly as you describe, including the Standard Deviation. When it goes to maximum, 4096 is as far as it gets.
I am a new user of RawDigger and I've had FRV for more than a year (I love it).
If I am missing something, I'd appreciate some guidance.
Thanks,
Howard
LibRaw
Thu, 10/25/2018 - 16:42
Permalink
Dear Sir:
Dear Sir:
Hard to say anything not having your raw files to study. Please upload raw files using a file-sharing service (some of the free ones are Dropbox, Google Drive, WeTransfer) and e-mail us the links (to support@rawdigger.com )
Howard (not verified)
Thu, 10/25/2018 - 19:28
Permalink
maximum values, Sony a6500
Mr. Borg, your recommended settings immediately fixed the problem. THANKS! I am extremely pleased with your rapid and helpful response. I won't need to upload files now. I will remember how to do that should I need it later.
Bruno (not verified)
Tue, 11/20/2018 - 11:46
Permalink
Sony A6500 Settings
Hi Howard,
Would you mind please sharing the recommended settings for a Sony A6500?
Many Thanks
Bruno
Brian R Patterson (not verified)
Fri, 11/01/2019 - 15:38
Permalink
100% Zebra as Compensation Measurement?
On a Sony a7r3 (or similar), would setting the Zebra function to 100% essentially provide a compensation measurement if one is using spot metering on the brightest image area desired for retaining detail?
Not sure how the Zebra function relates to the default 18% metering function of a camera - any background on that would be insightful...
lexa
Sat, 11/02/2019 - 04:48
Permalink
AFAIK, Zebra works on
AFAIK, Zebra works on processed (JPEG-like) image: with (at least) White Balance applied. It also may depend on contrast settings (and, more generally, on all Live-View/EVF settings).
It makes sense to measure and study under different conditions/different EVF settings (RawDigger may help a lot when comparing EVF image w/ real raw shot data).
Someone from the fellow photographers told me that he managed to get the zebra to work correctly on the A7R3, but with quite non-standard settings. As far as I remember, these settings included a black-and-white viewfinder mode and a non-standard gamma (It’s possible that I mixed everything up :)
--
Alex Tutubalin/FastRawViewer team
Iliah
Sat, 11/02/2019 - 11:47
Permalink
The zebras level: 107+ .. 108
Deniz (not verified)
Sun, 10/22/2023 - 17:50
Permalink
Very interesting read. So
Very interesting read. So what does this all mean for studio flash photography? Shooting RAW and light metering for the flash power and exposure. ETTR?
Add new comment