Translucency

Translucency is a measure of an object's transparency. There are several methods of achieving translucency with computer graphics; the most popular is alpha blending. When using 32-bit color, only 24 bits are needed for the actual color data. The other 8 bits can be used as an alpha channel. As such, there are 256 possible translucency values. This can range from completely transparent to completely solid.



Doom, however, uses 8-bit color, and thus other methods must be used to calculate translucency color blending. Raven Software's Heretic and Hexen and Rogue Entertainment's Strife support translucency using precalculated lookup tables (the TINTTAB lump in the former case; XLATAB in the latter). The same approach is utilized by the Boom source port. Each color is multiplied by the user's translucency percentage and then blended with all other colors in the palette in turn. The result of each computation is matched to the closest color in the palette and is stored in a way that allows a simple array index to be computed from the foreground and background colors while drawing graphics. While very fast as far as translucency routines are concerned, the results are not memory friendly: each "TRANMAP" held in memory consumes more than 64 kilobytes of RAM.

Most source ports do not support Raven's original method, however, and use their own pre-existing methods instead. For example, the DOSDoom port uses a different method that uses less precision and only precalculates part of the blending operation. The rest of the operation is done on a custom packed color format in low-precision math with the aid of lookup tables. This allows a wide range of translucency levels at a fraction of the amount of memory that would be used by the Boom method for comparable results. This method has also found its way into the ZDoom and Eternity Engine source ports, where it is used to great effect for particles. The cost for this method is in speed, as it is quite a bit slower.

Small adjustments to this latter method can yield other effects, such as additive translucency. Instead of adding together and, the raw color values are added directly with equal weighting, capping each color component to the maximum of 255. This causes the foreground object to appear bright and hot, as if though it gives off its own light. Likewise, the raw color values can be subtracted from the background, capping each color component to zero. This is referred to as subtractive blending, and renders a dark strangely colored image.

Normal, additive, and subtractive blending are all used in the Sony PlayStation version of Doom for the various forms of the spectre. Many hardware-accelerated source ports follow suit, due to the inherent difficulty of simulating the partial invisibility effect in or.