Hacker News new | ask | show | jobs
by iamdead 2517 days ago
This is a pretty thorough article. Why would you focus so much on gamma correction? How would you expand it?
2 comments

If I were writing it, I might start with a physical interpretation of alpha as a blend of transmission and reflection of light (it basically does this) but emphasizing that has to be actual luminance, which RGB isn't. I'm not even sure I'd add a whole lot of content as rearrange it so the role of linearity in blending was closer to the top.
My hot take is that physical correctness for graphics is very much in vogue right now, but this is coming at the sacrifice of psychovisual and physiological properties of graphics.

Gamma-correct compositing is one of those things that is actually quite difficult to detect, by most viewers, in most situations. For that reason it does not deserve to be put at the top.

Compositing may be hard to judge, but crappy gamma-incorrect zoom (same problem) is visible everywhere.

Did you ever notice how the brightness of a zoomed-out photographs suddenly changes? Look for images with fine high-contrast structures, like brightly lit branches or distant fences. For example https://en.wikipedia.org/wiki/Crown_(botany) - see how the picture gets brighter as it de-blurs? This is not intentional. More often a region is just a bit too dark.

Same with thin line art. Zoomed-out cross-hatching is the worst-case. When you do inking on a PC you may only work zoomed-out, so you can print later in much higher resolution. Once you look at the print, the emphasis is all wrong. Some lines disappear while others are much too strong. You are about to complain to the printer but zoom in to check and notice that the print was flawless.

Some older programs (e.g. feh) switch to nearest-neighbour interpolation while you are panning. This looks crappy but actually gives you the correct average brightness (because it doesn't do any color compositing). You can see the brightness jump back to incorrect values when panning stops.

Because taking gamma correction into account when doing blend operations is pretty vital if you want good results.
Also because it's by far one of the most common things people get wrong, or could do better, when implementing alpha blending.
You can get 90% of the way to correct just by using square roots and squares. There's really no excuse.
To the contrary, non-gamma-correct compositing is very common, since so many programs (both historically and today) simply never bothered to do it correctly--but we get good results anyway. In most situations we wouldn't notice the difference, it usually takes a somewhat contrived example to illustrate it well. You can see that the example chosen blends between primary red and primary green, which is not a natural color combination. If you replaced one of the two colors with primary blue, even then the artifacts would be less apparent (because of blue's lower luminosity).
People currently shy away from making images where the current hacky method gives bad results (because nobody likes making ugly images). If implementations were fixed, they might not.