Gamma Correction
It all starts with the cathode ray tube (CRT) response to the input voltage. On a CRT, the Gamma curve describes the transfer between the voltage entering the CRT and the corresponding illumination on the face of the CRT. Ideally, that transfer would be linear. That is if we doubled the voltage at the electron gun of a CRT, we would get a corresponding doubling in brightness of the phosphore spot on the face of the CRT.
The graph at the right shows a linear transfer curve. The input comes from the bottom and the output exits at the right and the line indicates which value is output for any input value. So at 25% horizontal position, the curve meets at 25% on the vertical axis. At 50% horizontal position, the curve meets at 50% on the vertical axis and so on.
The linear transfer curve would be the ideal transfer curve for an ideal CRT or for any ideal display device but, unfortunately, that is not the case in practice.
The intrinsic transfer curve of the CRT electron gun is not linear. That is the fundamental nature of the electron gun. Increase in illumination is much faster in the bright range of the CRT output brightness than in the dark range of the same CRT output brightness. This non-linearity of the transfer curve can be represented by a power formula:
brightness = volt gamma.
That is the brightness is proportional to the input voltage, exponent gamma. The gamma of a CRT is about 2.5 so we get
brightness = volt 2.5.
There are all sort of other considerations here and I will not go into those details. For those interested in the real, in-depth explanation, please visit Charles Poynton website where there are several documents that go into much greater details and considerations. Here, I will limit in trying to describe the issue in a very practical way here.
The most important point to consider here, is that if the normalized voltage (normalized meaning the voltage can go from zero volt to one volt max) on the CRT electron gun is linearly increased from 0 to 1, the resulting brightness on the face of the CRT will not be perceived as linearly increasing. It will look like it takes time to get out of black and then sudenly become white. Loooking at the 2.5 gamma graph above, it can be observed that the voltage needs to reach 75% in order for the CRT to output 50% intensity.
This have a direct consequence on how images are displayed on a computer CRT. On a computer, all colors are encoded with RGB channels where each channel values can go from 0 to 255. Those values are linearly converted to voltage on the CRT. A value of 0 converts to 0 volt and a value of 255 converts to 1 volt and a value of 127 converts to 0.5 volt. What we would want to see displayed on the face of the CRT are phosphore brightness that are in proportion to the input RGB values.
The illustration to the right demonstrates a 33 step linear gradient from black to white. The stair stepping graph represents the values that we encoded in the stepping gradient bitmap. And the gray stepping gradient represents what we would expect to see from those values.
Note that the gray stepping gradients at the bottom of the illustrations have been gamma corrected so they display as perceptually intended on a well calibrated standard gamma 2.2 monitor. If your monitor is not adjusted with the standard gamma 2.2, then the gradient will likely not look the way I prepared them. Go back to page 1 of this tutorial to find instructions on how to manually adjust your monitor gamma to 2.2.
So, we supplied a bitmap that contains a linear stepping gray gradient with regularly increasing gray values and we would like to see this linear and regularly stepping gradient displayed in the same way we designed it. But the intrinsic CRT gamma curve will change the brightnesses into something that will looks like the illustration to the right. The original linear stepping gradient is not linear anymore when displayed. It is distorted by the monitor's gamma. The 50% brightness on the CRT is now at 186 instead of at 127 (from 0 to 255) where it should be.
On a CRT, the difference in brightness between 127 and 255 will appear much larger than the difference in brightness between 0 and 127. The gray brightness, which should appear 50% gray, will only appear 17% gray because of the CRT gamma curve.
It would be easy to correct that transfer curve with electronic circuitry in the CRT driver circuits. But when TV was developed, those correction circuitry would have increased the cost of each TV set and it was decided that, for economic reasons, the correction circuitry would be placed in the TV camera instead of in each TV sets. Today, even though such correction circuitry would cost nothing to produce, there are still no gamma correction in the CRT drivers because every CRT needs to stay backward compatible with all the video equipments that are already in circulation and in use.
And guess what? When the digital camera manufacturers gathered together in a commity and discussed a standard, they used the same rationale to decide that, from now on, the tonal or gamma correction should be encoded directly into image data stored in every jpeg file produced by those digital cameras. This standard is known as sRGB.
Roughly speaking, the sRGB standard specifies that JPEG photograph data should be stored with a gamma correction of around 2.2. The illustration to the right shows what this gamma correction does to the image data. Here we have the same 33 steps originally linear gradient that have been transformed by the standardized sRGB gamma. It is not linear anymore. But the non-linear curve is exactly the reciprocal of the previous CRT gamma. So in the end, when the sRGB gamma corrected image is displayed on a CRT, the stepping gradient will look linear and regular again. Neat!
The sRGB standard for digital photos is flexible enough that in practice, every camera manufacturer have devised a proprietary transfer curve that is not a simple power function in order to try to get an edge on their competitors but the transfer curves are still roughly similar to a gamma 2.2. The standard allows each manufacturer to use their own transfer curve anyway.
The two photos, to the right, illustrate the application of the Gamma 2.2 to a digital photo. The top portion represents the digital photo data as it is recorded by the camera image sensor, which is a linear light capturing device, and the bottom portion represents the same photo after it have been gamma corrected with a 2.2 gamma curve. The bottom portion is equivalent to the jpeg image that would get out of the digital camera.
Consequences of the sRGB standard for the CG artist
The sRGB standard have a very important practical implication for every CG artist. The implication is that from now on, the standard CRT display setup for every computer users is assumed to be setup with a gamma correction of 2.2. This is essentially the same gamma setup as any default CRT that gets out of the manufacture. In other words, the standard CRT display is a non-calibrated CRT display as it is delivered from the manufacture. Any graphics file produced by CG artists that are designed to be displayed on a computer screen should assume a CRT with a gamma of 2.2.
There was a time, when Macintosh artists would design CG graphics on their 1.8 gamma corrected CRT and when they sent the file to their customer who were using a PC with a gamma of 2.2, they would get the invariable feedback that the graphics is too dark. The rare PC graphic artists who would send a graphics file to their Macintosh user friends would get the feedback that the graphics is too washed out.
Fortunately, now that there is one sRGB standard, we don't have to deal with those differences anymore. But every CG artist must make sure that their CRT or LCD matches the standard of gamma 2.2 in order to see the graphics the same way that every other users, with a standrad CRT display, will see it.
So let's recapitulate the situation. Because of the sRGB standard, everybody should be using computers with CRT or LCD that have a gamma curve of 2.2. If they don't, they are just not standard compatible. And because of that, every CG graphics or photographs should have their image data corrected so they display correctly on those CRTs.
There are color matching procedures for graphics artists who are doing work for the publishing industry. I will not touch on that. There are already numerous web pages on that subject. I will continue this tutorial for the 3D CG artist and I will explain the different steps that a 3D CG artist must take when preparing a 3D scene so the render matches a digital photograph.
|