If a 24bit RGB image with a range of 0-255 per channel is displayed on a television that displays a range of approx. 16-235 per channel, color detail will be lost, correct?

If so, should images be pre-processed to only store a valid range? I would like to do this with code, not in a picture editing application. I vaguely recall reading that a linear mapping is not the best way to do this, but unfortunately I can't locate the article I was reading! What is this process called? What other details do I need to know?


Some color data will be lost or changed regardless of your texture format. However, a bigger problem will be gamma correction. Gamma correction can be a tricky subject since your game will not appear visually the same across all display technologies and finding a single solution is not going to be easy.

These might help you out:

  • \$\begingroup\$ Thanks for the links. I am already doing gamma correction at load time with libpng, which helps, but I might have to look again at the code after reading the above information as the images are still 'washed out' on a television. \$\endgroup\$ – x-x Oct 10 '10 at 3:47

Linear mapping is probably not the best solution (which I believe involves converting your RGB to a CIE colorspace, scaling there, and converting back), but it is very easy to implement, and the range difference is small enough it probably won't matter.

If you use SOIL, it can automatically do this when loading the image, by passing SOIL_FLAG_NTSC_SAFE_RGB to the load functions.

Microsoft's documentation says to clamp, and recommends doing it in a pixel shader. (Linear scaling should also be easy in one.) It also mentions chroma crawl, which in my experience is a much more annoying phenomenon when working on TV displays.

  • \$\begingroup\$ SOIL! I forgot about that library. It has helped me in the past with some ideas. Thanks for the links. \$\endgroup\$ – x-x Oct 11 '10 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.