Decals are graphics positioned over a linedef texture. Decals can be automatically generated during the game (blood splats, scorch marks, bullet holes, etc.), or they can be placed directly in the map for decorative purposes. Decals are defined in the DECALDEF lump.
Spontaneous decals are controlled by the following console variables: cl_bloodsplats determines whether blood decals are placed while cl_missiledecals determines whether scorch marks are left by projectiles (hitscan attacks, including railguns, do not have a CVAR toggle).
The cl_maxdecals variable controls how many decals can be placed before the oldest ones are removed to allow new ones to be created; but only spontaneously-generated decals are counted. Decals placed in a map editor are not tallied and are always drawn even if cl_maxdecals is set to 0.
Each decal is applied on a single sidedef. To allow decals to cover several linedefs as needed by its dimensions, ZDoom will duplicate a decal. This behavior is controlled by the cl_spreaddecals variable, and affects both map-placed and automatic decals.
The color of a blood decal depends on the bleeding actor's BloodColor. However, that color is not used directly, as it would generally be too bright. Instead, each of the red, green and blue values are halved to create a darker color.
Actors that do not have a defined blood color generate blood decals that use the DefaultBloodColor values from the GameInfo definition. This color is used directly, without halving values.
Creating a Decal
- The decal graphics are to be placed in the "Graphics" namespace. This is outside of markers in a WAD, and within the /graphics/ subdirectory in a PK3.
- The offset position determines from where the decal will be drawn.
- There are two types of decal formats:
- A normal decal is a palettized image that will display in color.
- An alpha-map decal is an image that is drawn at varying levels of transparency. It contains no color information, but color can be assigned with the DECALDEF lump.
To create a normal decal, you need only load an image as you would any normal graphic resource. This should be a palettized image. If the image's palette contains colors that aren't available to the game you will use the decal with, you are at the mercy of ZDoom's palette remapping. The result may or may not look good. If you only intend to use the decal with one game, then it is advisable to convert it to the game's palette before you save it.
Creating an alpha-map decal requires a few extra steps. First you must create an 8-bit grayscale image, with white as most-visible and black as transparent. Save this image as a grayscale PNG-8. If your image editor cannot directly save 8-bit grayscale images, you can convert the output using ImageMagick's 'convert' utility:
convert -colors 256 -colorspace GRAY <infile.png> <outfile.png>
- All decals need to be specified in the DECALDEF lump, no matter what the intended use is.
- Decals can be created by weapons, or projectiles. To set these, use a special section in the DECALDEF or define a property for the actor.
- Decals can be inserted directly onto walls in maps. See Decal Thing.
Preventing spontaneous decals
Spontaneous decals (blood splatter and scorch marks) can be selectively disabled on certain walls:
- On specific sidedefs: with the nodecals flag set to true in UDMF maps.
- On specific textures: with the nodecals flag set to true in the TEXTURES definition.
- On animated textures: decals are disabled by default on animated textures unless the allowdecals flag is set to true in the ANIMDEFS definition.