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.
The main reasons people use the xyY color space are:
- It cleanly separates luminance (brightness) and chromaticity (color content)
- The chromaticity part (xy) has the same range, namely [0, 1], no matter how bright or dim the color is
- All physically realizable colors lie within [0, 1] in xy. (The Y component is unbounded.)
- 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:
- 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.
- 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.
- 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.