- This article is about color translations. For language translations, see LANGUAGE.
The Translation DECORATE actor property or TEXTURES keyword may be used to redefine the colors of an actor's sprite. Translation may be given either a numeric value representing one of the current IWAD's standard translations, a string value representing one of ZDoom's built-in translations (currently only "Ice"), or a comma-delimited set of string values describing a custom translation. The CreateTranslation ACS function and the Thing_SetTranslation action special provide similar functionality within ACS.
Palette range to palette range
Custom translations are defined by a simple syntax. A translation block consists of an original color range from the palette, followed by the "equal" sign, followed by the destination range. A range, in turn, is defined by its first color index, the "colon" sign, then the last color index. The ranges do not need to have the same length. Several translation blocks can be listed in a single translation, separated by comma.
Translation "original_start:original_end=destination_start:destination_end" CreateTranslation (number, original_start:original_end=destination_start:destination_end);
Direct color translations
It is possible to use directly RGB values instead of a palette color range for the destination (the original colors still need to be a paletted range). The destination range is defined by two RGB triplets (of integer values between 0 and 255), within square brackets.
Translation "original_start:original_end=[rs,gs,bs]:[re,ge,be]" CreateTranslation (number, original_start:original_end=[rs,gs,bs]:[re,ge,be]);
Desaturated color translations
In DECORATE, TEXTURES and ACS (development version only) translation definitions, it is possible to use saturated or desaturated translations. The destination range is defined by two RGB triplets (of floating point values between 0.0 and 2.0), within square brackets, and the percentage symbol follows the equal symbol between the original and destination range.
For each palette entry in the original range, the destination color is calculated as follows:
- translatedcolor = (rs,gs,bs) + grayscale(originalcolor) * (re-rs, ge-gs, be-bs)
See the palette article for reference on each game's palette. Translations only work reliably on images that use the game palette stored in PLAYPAL. Please note that even PNGs with the exact same palette are not guaranteed to work correctly because some duplicate colors will not get mapped to the same index as in the source image. Therefore anything that is supposed to be translated should use graphics in Doom patch format.
For cross-game mods, note that while Strife defines more preset translations than Doom or Heretic, ZDoom will only allow these to be used in Strife. In Doom or Heretic, using a preset value greater than 2 will result in an error at startup. In such a case, when replacing Strife actors such as Acolytes and Peasants, the provided translation values should be used instead of the preset number.
- 0 turns green into grey (112:127=96:111)
- 1 turns green into brown (112:127=64:79)
- 2 turns green into red (112:127=32:47)
- 0 turns fern green into light brown (225:240=114:129)
- 1 turns fern green into red (225:240=145:160)
- 2 turns fern green into blue (225:240=190:205)
- 0 turns tan into red (32:63=0:31, 128:143=64:79, 241:246=224:229, 247:251=241:245)
- 1 turns tan into rust (32:63=0:31, 128:143=176:191)
- 2 turns tan into grey (32:47=208:223, 48:63=208:223, 128:143=16:31)
- 3 turns tan into dark green (32:47=208:223, 48:63=208:223, 128:143=48:63)
- 4 turns tan into gold (32:63=0:31, 80:95=128:143, 128:143=80:95, 192:223=160:191)
- 5 turns tan into bright green, and white into bright green (32:63=0:31, 80:95=16:31, 128:143=96:111, 192:223=32:63)
- 6 turns tan into blue, and gold into red (32:63=0:31, 80:95=64:79, 128:143=144:159, 192=1, 193:223=1:31)
Any ZDoom-supported game
- "Ice" turns the sprite into the color that it would be if it was in its ice death state. The exact translation is calculated by the game depending on what colors are available in the palette to be the closest to light blue.
The files Thing_SetTranslation in ACS. A screenshot can be seen .contain playable test maps illustrating the use of
This line changes the green color range into the into red color range when the Doom PLAYPAL is in use.
This line changes the green color range to the orange color range and the blue color range to the pink color range when the Doom PLAYPAL is in use.
Translation "112:127=208:223", "192:207=16:31"
This line changes the actor's colors to icy blue shades (or as close to icy blue shades as the current PLAYPAL allows).
This line changes the actor to be completely red.