Definition

With 8 bits you can only create 256 different colors. But if you place different colors close to each other and you look at this pattern from a distance then this collection of colors will be blended together by the human eye to form a new "mixed" color. This technique of placing specific colors close to each other in such patterns that they create the impression of being another colors, is called dithering. Dithering is often used with color printing techniques. Old Black-and-White printers also show very obvious "dithering"-patterns.

With 3D cards, this technique is used to create the impression of smoother colors, less banding (visible switches from one color into another). It is especially used in the 16 bit color modes, because there the number of colors is too limited to show smooth blends between colors. Dithering is applied to 24 or 32 bit input data and the result is usually a 16 bit dithered image. For 3D cards, dithering is done on a per pixel basis.

In depth:

We know that dithering works by placing different colored pixels close together, so that they tend to be blended together to form a new color. Now suppose we have a 24 bit color with 8 bits for each component (components are Red, Green and Blue). Now we have to reduce this 24-bit information to only 16 bits or 5 bits for Red, 6 bits for Green and 5 for Blue. Lets look at an example:

Input: 01110110 (118) / 01010110 (86) / 11110001 (241) (most significant bits on the left side)

Now with this input what is the possible output? All we need to do is drop 3 bits for the Red and Blue component and 2 bits for Green component. We could just drop the least significant bits and that would leave us with:

Output: 01110-000 (112) / 010101-00 (84) / 11110-000 (240)

This is called clipping and its very easy to do and this is what happens if no dithering is applied. However, the real color value is not equal to this clipped value. We can track down the 2 nearest 16 bits color values. The nearest lower value is found above. The nearest higher value is:

Output: 01111-000 (120) / 010110-00 (88) / 11111-000 (248)

Basically, we can see that for Red and Blue there are 7 different values possible (pure 24 bit colors that are not available in 16 bits mode) between the colors that are equal in both 16 and 24 bits (e.g. between 112 and 120 there are 7 values). For Green, we have only 3 intermediate values (between 84 and 88 there are 3 color values). Now by switching between the slightly higher and slightly lower color values, we can try to approach the in-between levels.

A simple example case for the green component: assume we want value 86 (trues 24 bits color), that's right in the middle of 84 and 88 (possible 16 bits colors). Now logic tells us that we can approach that color very easily by just switching between 84 and 88 for every pixel we draw.

Problems are, however, slightly more complex than this. After all, we don't have surfaces filled with one color, we have different 24 bits colors for each pixel. Now how do we figure out whether we should take the higher or lower value? I will illustrate this technique using a much easier example. We will assume that we only have 2 colors available: Black and White and a fixed collection of patterns. A 2 by 2 Matrix defines the patterns: