What's the use of the xyY colorspace in games? I'm not sure what's the advantage of using it in shader programming or elsewhere.

  • I never heard of xyY color space, it either has an alternative name, or there is sth wrong, either way can you provide a link where you read about it? – concept3d Feb 7 '14 at 23:43
  • Did you mean xyZ? en.wikipedia.org/wiki/CIE_1931_color_space – Sean Middleditch Feb 7 '14 at 23:57
  • 1
  • I'm not really sure this is on-topic, though, since there's no particular reason this color space is more compelling or useful for games than it is any other application. – Josh Feb 7 '14 at 23:59
  • According to further research xyY seems to seperate Luminescence from Chrominance. – Fire Feb 8 '14 at 2:33
up vote 0 down vote accepted

The main reasons people use the xyY color space are:

  1. It cleanly separates luminance (brightness) and chromaticity (color content)
  2. The chromaticity part (xy) has the same range, namely [0, 1], no matter how bright or dim the color is
  3. All physically realizable colors lie within [0, 1] in xy. (The Y component is unbounded.)
  4. You can convert an arbitrary reflectance spectrum to XYZ (and thence to xyY) by integrating the products of the spectrum with the color matching functions.

xyY is useful for investigating color gamuts, such as the gamut of human vision (the famous CIE horseshoe diagram), or the gamuts of various color spaces (e.g. sRGB versus Adobe RGB), where we care about chromaticity but not brightness.

However, there are some reasons why xyY is not a very good space in which to do image processing:

  1. It's nonlinear. This means you can't easily do physically correct lighting calculations, such as adding together the contributions of multiple lights, in this space.
  2. Not every point in the xy [0, 1] square actually represents a color. Points outside the horseshoe are invalid. That makes it annoying to do any kind of image operation on xyY space, as you have to ensure you don't generate invalid colors.
  3. It's not very perceptually uniform either, so you can't easily measure perceptual distances between colors (e.g. for perceptual error estimation, or selecting complementary sets of colors, etc.) CIELAB space is better suited for this.

In short, I can't think of a reason to ever use xyY in games or shader programming. If the goal is to separate luminance and chromaticity, YCoCg is probably a better choice; it's linear (if you transform to it from linear RGB) and is cheaper to transform to and from than xyY.

  • What about tone mapping? – Fire Feb 8 '14 at 3:11
  • @Fire Maybe. If you're trying to do chrominance-preserving tone mapping, CIELAB might be better; I'm not sure. If you're trying to do filmic tone mapping, you do it in RGB (since films have separate R, G, and B pigments). – Nathan Reed Feb 8 '14 at 3:26

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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