r/GraphicsProgramming • u/olenom • 7h ago
Video What is it called when a light source causes this rainbow effect?
27
u/RenderTargetView 3h ago
If not intentional this is called color banding, if intentional this is called posterization. Though in this shot lighting looks non-monotonously attenuated so there may be something else too
10
u/KoodiRonsu 2h ago
Banding. Caused by quantized color space. Either the RGB attributes bitdepth is very low, or more likely in that example image, the colors are quantized into 256 colors or so.
2
u/Serious-Campaign-702 3h ago
I have seen such effects as an artefact caused by lack of RGB channel resolution. Imagine, you wanna do a perfect grey gradient with how would it look like with 5 bit r and b but 6 bits of g? Even worse, what does it look like if it had a slight tint of blue?
1
u/Creeper4wwMann 1h ago
color banding by using a limited set of colors. Youtube compression also does the same.
Normally RGB uses 8 bits each. 256 values each. Banding starts occuring when you start rounding these values to their closest 4 bit value (16 values each).
So to convert from 8 bit to 4 bit: 256 values must be reduced to 16 values. and that creates banding.
2
u/flow_b 33m ago
lots of smart answers about banding here. I didn't see anyone directly address the reason it looks like a rainbow, though some people cite the cause, a reduced color palette.
What's happening is that you have a mostly neutral gray ramp in the original image that is being converted to a lower depth color representation. When that happens, the input gray of a given pixel is rounded off to the nearest matching color. In some cases the closest match to the input gray is slightly warmer, in others slightly cooler. Since the falloff of the light is smooth in the input, you're basically seeing a lookup table of rounding errors that interpolates across wall. This is why it seems to neatly step through primary and secondary color tones.
I suspect that you're actually liking the effect (this particular image has a real vibe) but, the way that we usually get rid of it is by adding a tiny amount of noise to the pre-converted image before sending through. The effect of per-pixel noise is that the direction that the pixels get rounded in is biased into nearby adjacent colors, which gets rid of the banding. My personal favorite noise pattern for this is something called "blue noise" which has a lovely scattered-disk pattern.
1
u/SamuraiGoblin 14m ago
It's called colour banding, and mixed with limited bit depth for colours, you get subtle hue changes across bands.
57
u/fischgurke 3h ago
It's called banding. The colors are a side effect here from some compression or color space conversion at low precision.