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.

  • \$\begingroup\$ 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? \$\endgroup\$ – concept3d Feb 7 '14 at 23:43
  • \$\begingroup\$ Did you mean xyZ? en.wikipedia.org/wiki/CIE_1931_color_space \$\endgroup\$ – Sean Middleditch Feb 7 '14 at 23:57
  • 1
    \$\begingroup\$ xyY is derived from CIE 1931's XYZ space. \$\endgroup\$ – user1430 Feb 7 '14 at 23:58
  • \$\begingroup\$ 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. \$\endgroup\$ – user1430 Feb 7 '14 at 23:59
  • \$\begingroup\$ According to further research xyY seems to seperate Luminescence from Chrominance. \$\endgroup\$ – Fire Feb 8 '14 at 2:33

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.

| improve this answer | |
  • \$\begingroup\$ What about tone mapping? \$\endgroup\$ – Fire Feb 8 '14 at 3:11
  • \$\begingroup\$ @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). \$\endgroup\$ – Nathan Reed Feb 8 '14 at 3:26

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.