On the picture below you can see mathematically perfect smooth transition from black to white. But I noticed that on all gradient picture I see strange strips and the color transition doesn't feel smooth. I even see that if you pass from black to white, there are some small jumps back to a bit darker color, when theoretically the color should become always whiter and whiter.
3 Answers
The 'jumps' to 'a bit darker' are an optical illusion due to how human perception works. Check out Mach bands in wikipedia. Now as for why you get a step function even though you have a smooth transition in code: this is due to quantization. Your monitor can reproduce a finite amount of grey levels, so you quantize your otherwise continuous range.
-
$\begingroup$ Thank you for pointing the wikipedia article about the Mach bands. It is very interesting $\endgroup$– DavidFeb 7, 2019 at 10:25
-
$\begingroup$ @lightxbulb "Your monitor can reproduce a finite amount of grey levels". One could also argue that if you're only storing the image with 8bits/channel, it's not just the monitor's fault! David : One suggestion would be to compute your gradient with 9 or 10 bits/channel and use, say, ordered dither when reducing to 8bpc precision. $\endgroup$– Simon FFeb 11, 2019 at 9:19
-
$\begingroup$ @SimonF You're sending off 8bit buffers for displaying precisely because of the limited capabilities of your monitor. Most (budget) monitors are not even 8bit but 6bit+FRC. You may as well be using doubles on your app side, you still need to display the colours on your monitor, so you will convert to 8bit at some point if your monitor doesn't support higher. Obviously dither can help a little. $\endgroup$ Feb 11, 2019 at 10:06
-
$\begingroup$ @lightxbulb Ha! You youngsters with your digital input monitors. I feel you have put the cart before the horse. Shall I send you a picture of a graphics card with its separate DAC chip set to drive an analogue input CRT monitor? ;-) It's more a historical, memory cost reason for the choice of precision and that 8-bits (with gamma) is almost enough for certain use cases: poynton.ca/notes/colour_and_gamma/GammaFAQ.html#smoothly_shade $\endgroup$– Simon FFeb 12, 2019 at 8:40
-
1$\begingroup$ What I mean is, display devices from, say, the 70s through to late 90s, had analogue input, so the precision (arguments about noise etc, limiting precision excepted) of these devices could be said to be > 8bpc. It was the graphics subsystem memory + DAC which then determined the effective image depth. Since memory was typically rather expensive, 8bpc was usually the limit. (Some systems did use higher precision, e.g. some Silicon Graphics work stations, but then they were probably also rendering in linear space and so would need greater precision in order to obtain the required dynamic range.) $\endgroup$– Simon FFeb 12, 2019 at 15:18
The non smooth appearance, or visual stripes you see, is called color banding. (Wikipedia) It is produced since the medium, in this case your screen, is only capable of producing a finite array of colors and as the mathematical equation progressively passes through the color change you monitor "jumps" a visual amount of "steps". Higher resolution monitors will suffer from banding less but still still have noticeable steps in high contrast gradients, such as from black to white.
The "jumps" back to a darker color is, as lightxbulb mentioned, an optical illusion called Mach bands. (Wikipedia)
Printing a gradient will often have the same issue, no matter how high the resolution is. I have often had clients provide artwork for high quality printing and have been very disappointed with banding effect.
Banding is not only present in gradients but most noticeable in high contract change gradients and low resolution mediums.
There are techniques to help with banding like dithering or adding noise. But these techniques will often require moving to pixel based artwork and not mathematical perfect vector. Here is a great article to understand banding and how to avoid it using Photoshop. https://www.slrlounge.com/remove-banding-photoshop/
The image's histogram isn't entirely flat which could imply that some grey levels are represented more than others, I'm not sure this would cause the effects you see - I expect not. Try printing the image as a hight quality photo on glossy paper, this should eliminate the shortcomings of your screen.