# Use of the xyY color space?

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? Feb 7, 2014 at 23:43
• Did you mean xyZ? en.wikipedia.org/wiki/CIE_1931_color_space Feb 7, 2014 at 23:57
• – user1430
Feb 7, 2014 at 23:58
• 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.
– user1430
Feb 7, 2014 at 23:59
• According to further research xyY seems to seperate Luminescence from Chrominance.
– Fire
Feb 8, 2014 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.