# Understanding and editing HDR light environments in Photoshop

I'm working with an in-development system that uses .hdr environments (equirectangular projection) to provide image-based lighting (IBL) to a 3D rendering. I'm trying to understand what range of values can be stored in an .hdr image, and how to edit them in Photoshop.

In Photoshop, I can open (or create) .hdr images with 32-bits per channel. In this mode, 'normal' colors have RGB values in the range 0.0 - 1.0. However, I can pick colors that go as high as 20.0 in each channel. I thus assumed that a value of 20.0 was the maximum that could be stored in a .hdr file.

However, if I fill a region with brightest white (20.0,20.0,20.0), and then fill again with (4.0,4.0,4.0) on Multiply mode, I end up with colors that have a value of ~80 (as reported by the Info palette in 32-bit mode). Do it again and I get ~320. I can keep repeating the multiplication and the values shown in the Info palette get successively larger, until the Info palette display maxes out at -231 (-2,147,483,648).

Some of the free .hdr panoramas that I have found online max out with the sun at around 20 brightness. Some of them, however, max out at 16000 or so. The result is that there are massive tone mapping differences needed between different environments that should be equivalent, e.g. both are a sunny day outdoors. I want to normalize the maps we use and generate, but I first need to figure out what "good" values are for the sun, sky, and ground.

• What is the largest channel value represented in a .hdr image?
• What is the significance of Photoshop's 20.0 maximum for a color?

Edit: Manually entering RGB channel values of 1, 4, 10, and 20 and painting one pixel using them shows the following results. The fifth square was painted with RGB of (20,20,20) on Normal mode, and then painted again with RGB of (4,4,4) using Multiply mode. The color of this pixel is shown at the top of the Info palette. (The first RGB entry is set to Actual Color, while the second is set to RGB; both readouts are set to 32-bit, as shown.)

Note that these colors are obtained by typing values in the RGB channels of the Color Picker (section "D" in the picture below from Adobe's help), NOT by using the "Intensity: [______] stops" entry. Typing in RGB values of 20.0 sets the Intensity to 4.73 stops. Entering larger intensity values—up to a maximum of 20.0—still results in the RGB values showing 20.0 each in the color picker, but the resulting paint showing larger RGB values of up to 786432 in the Info palette.

Photoshop CS3 HDR Color Picker http://livedocs.adobe.com/en_US/Photoshop//10.0/images/im_hdr_picker.png

As described above, however, even this "largest" value can be made even larger by multiplying the color.

• All investigations occur using Adobe Photoshop CS6 Extended on OS X. Apr 3, 2014 at 5:56

The .hdr format represents colors using a variant of floating-point format, so its maximum value is similar to that of float, i.e. about 10^38.

In practice, you will likely not see values this large, but as you've found, different .hdr files may have very different value ranges. There is no standard for what the values in an .hdr image "mean". They could be measured in some physical unit such as nits or foot-lamberts, or they could be measured relative to some arbitrary reference value. There is no way to normalize .hdrs from different sources to the same range without either knowing how they were captured and processed, using some independently calibrated data for expected values of the sky etc. (for instance, measured with a spot meter), or simply eyeballing it.

As for Photoshop and the 20.0 limit, that's actually not an HDR value directly but a value on a log2 scale. When you work with exposure or see references to "stops" (as in the HDR color picker) in Photoshop, that means a log2 scale, i.e. each "stop" is 2x as bright as the previous stop. So 20.0 here actually means 2^20. Indeed if you pick white with intensity 20 stops and fill an image with it, then look in the info palette set to 32-bit mode, you'll see the value is 1048576, which equals 2^20.

At the opposite end of the spectrum you can set the intensity to -20.0 stops, which is 2^-20 or about 0.00000095. (Unfortunately, such small values will simply read as zero in the info palette.)

There is no significance to this [-20, +20] range other than that some programmer at Adobe decided this would probably be a big enough range for most purposes.

Screenshot of the color picker and info palette, illustrating the log scale:

• When I paint with 20.0 rgb white, the info palette shows 20, not a large value. Apr 2, 2014 at 5:26
• @Phrogz 20 in log2 scale, means 2^20. Apr 2, 2014 at 6:03
• @concept3d But that would then mean that when the Info palette shows 2147483648 it is actually 2^2147483648, which is not possible. The Info palette does not appear to be displaying log values. Apr 2, 2014 at 13:18
• @Phrogz I added a screenshot of what I see in Photoshop (CS6), showing how "intensity" of 20 stops corresponds to actual RGB values of 1048576. Apr 2, 2014 at 16:40
• @Phrogz Ah, I see. I guess the individual RGB channel values are not on a log-scale, though the intensity slider is. It's unfortunately confusing (and possibly a bug?) that they both max out at 20, but the "20" means entirely different things. Not sure why you're seeing some error in your values e.g. 3.986 instead of 4.0, or 786432 instead of 1048576, though. Apr 3, 2014 at 6:06