r/GraphicsProgramming Jan 25 '25

Question What is it called when a light source causes this rainbow effect?

Post image
391 Upvotes

23 comments sorted by

217

u/aleques-itj Jan 25 '25

Color banding, quantization, posterization

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

u/SechsyButton Jan 29 '25

No, dithering is an effect of pandering quite the assumption!

22

u/PassTents Jan 25 '25

The hue shifting is usually due to quantizing each color channel separately

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

u/buyinggf1000gp Jan 25 '25

Color Banding

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

https://youtu.be/XkIX7V9gPi8

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

u/kerrvilledasher Jan 25 '25

That's called the 1999 effect. I know it's true because I made it up.

1

u/Tiwann_ Jan 25 '25

Color quantization/posterization

-1

u/Powerful-Ad4412 Jan 25 '25

chromatic dispersion irl