Using colors
In games, you might have seen many kinds of graphical effects, such as screen desaturation, HDR image enhancing, or hue shifting. All these effects use the principle of converting between color models to another color representation, which allows you to easily change certain aspects of drawing things on screen. This recipe will try to explain how to convert between color models and how to use them in further image processing.
Usually, colors are defined by three color components—red, green, and blue. This color representation is also known as RGB. There are more methods to define a color. These methods are also called color models. They describe that each one is used in different situations. For example, the RGB color model uses additive color mixing. This is because computer displays use these three colored lights to mix the final color you can see on the screen. Printers use the CMYK color model, which uses subtractive color mixing. This is based on mixing colors like when...