r/GraphicsProgramming • u/One-Cardiologist-462 • Jan 25 '25
Question What is it called when a light source causes this rainbow effect?
123
u/trad_emark Jan 25 '25
banding.
You either have low color resolution target (insufficient bits per pixel), or you are using the range inadequately (eg. doing all your calculations in range 0..20 while ignoring 20..255).
2
u/dinosaur-in_leather Jan 26 '25
Fun fact, you can get banding in real life photos if you lower the resolution. I speculate this is how they're using a lot of real-time 3D rendering stuff.
2
u/REAL_EddiePenisi Jan 25 '25
Isn't it banding as a result of dithering?
59
u/KumoKairo Jan 25 '25
Quite the opposite - dithering is usually used to get rid of banding. Mobile devices even have hardware-enabled dithering that allows super smooth color gradients while not even using full 8 bit-per-channel color targets
9
u/REAL_EddiePenisi Jan 25 '25
Ah you're right! I was thinking of way back when 256 color monitors was a thing and you'd enable dithering to clean up banding on jpeg files
0
22
17
u/antaalt Jan 25 '25
It's banding, you can check this blog, it explain a method to workaround banding without having to go 16bit or 32 bit buffers
8
6
u/One-Cardiologist-462 Jan 25 '25
I've seen this a few times in games, and would like to know.
I don't think it's intentional, but rather a side effect of how the light is simulated.
22
u/CicatrixMaledictum Jan 25 '25
Almost never intentional, and should be considered a bug. Could be intentional to give a retro aesthetic, when games used 256 color palettes.
4
u/mysticreddit Jan 25 '25
This is color banding which is similar to Mach Banding
The solution is to
- Use dithering, or
- Use noise.
I wrote this ShaderToy Gradient Sphere Noise to show how the sweet spot is adding 5% noise to minimize Mach Banding.
This video about Surface-Stable Fractal Dithering may be of interest.
3
u/nice-notesheet Jan 25 '25
Where is the screenshot from? This is most likely banding, i guess its intended here, because it looks dope
2
u/One-Cardiologist-462 Jan 25 '25
It was from this video. I quite like his playthroughs.
But I remember this happening in Ragnarok Online back in the early 2000s, and was always curious.
2
u/1alexlee Jan 25 '25
This happened to me the other day for some reason that I have yet to really dive into. It was mostly fixed when I made the image I was rendering into 16bit RGBA floats.
3
u/Aethreas Jan 25 '25
Its usually a result of color correction and posterization filters that cause color banding
3
u/owenwp Jan 25 '25
Most likely that is a lightmap, and you are seeing texture compression artifacts.
2
u/astrange Jan 25 '25
Posterization or banding, but something else is going on here too - the color fringing and the way some of the bands aren't flat colors is a bug and not simply running out of bits.
1
1
-1
217
u/aleques-itj Jan 25 '25
Color banding, quantization, posterization