Transcription
What is gamma correction? Why should I care about it?
Well, in this video, we're gonna be discussing what gamma correction is, why it exists, and what you need to know about it as a digital video content creator.
The first thing you need to understand is that the human eye does not perceive luminance in a linear fashion. For example, if I point this light at this piece of paper and then I turn on a second light, I can see that the paper does get brighter, but it's not twice as bright. The difference between one hundred and one light bulbs and one hundred and two light bulbs is barely anything. Well, the difference between one light bulb and two light bulbs is very significant. But although our brains distort relative luminance in this way, it doesn't seem weird to us because it's just what we're used to. We've seen it display our whole lives.
Cameras, on the other hand, are a little bit different. Most cameras nowadays use a digital image sensor, which is essentially just a device that measures how much light reflects off of it during a certain period of time. Since light exists in discrete packets of energy called photons, you can think of a sensor as just counting how many photons hit each photo site or pixel during a certain period of time, and then it stores that information into a file. But since a camera sensor is just counting how many photons reflect off of it, it naturally perceives light in a linear fashion. Twice as many photons means twice as much luminance. Pretty simple, right?
Now, you're seeing the world of how a camera sensor sees it, and we can verify this. So again, I have a piece of paper illuminated by a light, and I can measure the brightness. And I turn on a second light, and this time we can see that the paper does, in fact, get twice as bright. And this is because our camera sensor is seeing the world in a linear fashion. Twice as many photons are bouncing off the paper into the camera, so the camera perceives it as being twice as bright.
But if you look at the world the way a camera sees it, you'll notice it just looks weird. And that's because you're seeing a world where the relationship between light and brightness is linear, and that's just not how our eyes perceive the world. So naturally, it just looks off.
But the thing is, this isn't actually a problem on its own. And that's because in order to actually view the images produced by our cameras, we have to look at them through monitors. A monitor receives a brightness value from the computer and then illuminates or dims its pixels accordingly. The pixels on a monitor change brightness in a linear fashion. So twice the luminance into the camera means twice the brightness out of the monitor. And since the light coming out of the monitor is being interpreted by our human eyes, we'll see the image on the monitor in the same nonlinear fashion as we see everything else.
So where's the problem? Well, the problem with this process is that it creates banding. The luminance levels of a digital image are not infinitely divisible. For an SDR image, you have 256 distinct levels of brightness available to you. There's no such thing as a brightness value of say, 100.275. It has to be either 127 or 128. No in-betweens. When we display this image on a monitor, our eyes distort the luminance values. The values are being shown like we discussed before. You can notice that a huge amount of our 0 to 255 scale is being wasted on the highlights of the image, leaving almost nothing for the shadows. The result of this is that the image will have ugly bands of color in the shadows due to the lack of granularity in the 8-bit container.
What we want to be able to do is distribute the luminance values according to how our eyes will perceive the light, not how a camera would perceive the light. This is where gamma correction comes in. We solve this problem by adjusting the values stored in the file according to a mathematical curve. Essentially, whatever luminance value the sensor reports for a given pixel, we run that value through this mathematical expression and then store the result. Then, when displaying the image, our monitor runs a signal through the inverse of that function and displays the outcome. The result of this is that our eyes perceive the same image as before, except the range of available luminance values is distributed evenly according to how our eyes perceive the image, not how our cameras and monitors do. In short, we're using what we know about human eyesight in order to distort digital images much more efficiently than we could otherwise.
So if our cameras and monitors do all of this automatically by default, why is it important to understand gamma correction when you're creating digital video? Well, because there isn't just one universal gamma curve that's used for everything. There are a wide variety of curves that are used for a variety of different purposes. The most common gamma curves you'll see today are the gamma 2.2, 2.4, and 2.6 family. These curves are used for the vast majority of digital video. If you don't know what gamma curve you're working with, it's probably one of these. For example, the standard for YouTube is gamma 2.2.
Another popular family of gamma curves are the logarithmic gamma curves. There are a lot of these, since essentially every camera manufacturer has their own unique curve. However, these all perform essentially the same function. The purpose of these curves is to squeeze a larger dynamic range into an SDR video container. By using a more extreme curve, it's possible to compress a much wider range of luminance values into the signal, especially in the highlights of the image.
If you shoot in log, you'll probably notice that the image looks really flat when you play it back. This is because the image was captured using a log gamma curve but is being played back using a more standard gamma curve like 2.2. In order to view this log image correctly, you'll need to use software to convert one gamma curve to another. Color grading software like DaVinci Resolve has color management that can do this for you, or you can download a conversion LUT from your camera manufacturer's website. These gamma curves aren't designed to be viewed as is. They're designed to capture as much information as possible and then be converted into a less extreme gamma curve.
Even after the log image has been converted into a more standard gamma curve, it's still possible to access extra information that was captured in the highlights. Because I captured this image in log, I'm able to recover these blown-out highlights where I wouldn't have been able to if I hadn't shot in gamma 2.2 to begin with.
You also might encounter a gamma curve of 1.0, or just linear, which is exactly what it sounds like. It's a gamma curve of no curve at all. You'll most often find this when you're working with raw images or raw video. This is because raw represents the unprocessed data off of the digital sensor, and since a sensor sees the world in linear, so will your raw file. This is okay though, because raw isn't designed to be viewed without being processed first, and that processing usually includes converting it to a more typical gamma curve.
What about the banding problem, you ask? Well, since raw photos and raw video have a much higher bit depth than normal videos or photos, they have a lot more discrete luminance levels to work with than the standard 255. As such, banding is much less of an issue because there's so much more data to work with.
So those are the fundamentals of gamma correction for digital video. Well, you might not need to worry about your gamma curve in most situations, it's still important to have an understanding of the fundamental concepts that make digital video work.
If you enjoy this video, be sure to let me know in the comments and subscribe to my YouTube channel if you want to see more content like this. Anyways, my name is Kaman Crocker, signing off.
[Music]