Translucency

From DoomWiki.org

A translucent Golem from Heretic.

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, where it is called a TRANMAP. Utilizing the tool MAKTRLMP.EXE, a TRANMAP.DAT file made by Boom can be made into a TRANMAP.LMP file that can be included as a custom translucency lump.

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 foreground * percentage and background * (100-percentage), 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.

Doom Legacy implements RGB translucent draws for 15 bit, 16 bit, 24 bit, 32 bit software draw, and OpenGL drawmodes. It draws 10%, 20%, 25%, 50%, 75%, 80%, 90%, fx1, and fire translucency in support of several standard effects. It draws alpha (0 to 255) translucency for several effects such as translucent water, fluid, fog, textures, 3D floors, and corona lights. It supports Boom translucency maps and colormaps for 8 bit palette draw, and analyzes colormaps to generate colored alpha drawing for other drawmodes.

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 OpenGL or Direct3D.