This is article 8 in a series on VTK. The first in this series can be found here. We cover colour models used in VTK.
The following information on colour models is useful for anybody unfamiliar with the common RGB and HSV colour models. Their use in VTK was described above. Either colour model can be used to describe the same colour but one may be more intuitive for the reader.
Colour is very important to scientific visualisations. VTK uses mappings from scientific data to colour palettes to present data to the user. This lets them quickly scan an image and see important information from the input data.
Colours are described by these models using 3 floating point values; VTK uses the range [0.0, 1.0]. The first is the red/green/blue (RGB) model[1]. Methods in VTK take or return 3 floating point numbers that describe the amount of red, green, and blue, that constitute that colour. An RGB value of
-
(1.0, 0.0, 0.0) is bright red;
-
(1.0, 1.0, 1.0) is white; and,
-
(0.0, 0.0, 0.0) is black.
Increasing or decreasing all three values together will lighten or darken the resulting colour.
The other model is the hue/saturation/value (HSV) model[2]. It also takes 3 parameters to describe a colour but each parameter describes different pieces of information.
The first value, hue, is what a person would likely think of as the colour. Imagine moving across a rainbow, the hue would decide whether the colour is red, orange, yellow, etc.
The saturation and value describe two different aspects of the intensity of this colour. The saturation describes how much colour there is. A saturation of 0.0 would change all colours to appear in greyscale whereas 1.0 produces the complete colour. The value describes how bright or dark the colour is. A value of 0.0 would always produce black, no matter the other values, with 1.0 the brightest.
In some places a 4th value is specified: the alpha value. This is the same no matter the colour model used. This specifies how transparent a surface is. An alpha value of 0.0 is a surface that is entirely transparent, no matter the other 3 colour values. An alpha value of 1.0 produces a surface that is entirely solid/opaque and appears as the colour specified by the other 3 values.
Continue here for a summary of important VTK commands covered in this series.