Decals

From Mod Wiki

Jump to: navigation, search

Decals - such as wall stains, cracks and marks - are semi-transparent textured patches placed just slightly in front of world geometry. Using decals adds variety to the monotony of plain, tiled textures, and also help visually integrate map objects with world geometry.

Contents

Example

Before and after example of using decal patch meshes to 'dirty-up' a building, breaking up the repeating textures.
Island's bridge uses a MD5 decal model

Usage

  1. Create a patch for the decal to appear on.
  2. Use the Media Browser to find an decal texture for the patch (search for 'decal')
  3. Move the patch so it is flat against a wall
Using a textured patch placed flat against a wall as a decal.
  • Note: some decals require that the patch be placed slightly away from the wall (0.5 units or so) in order to avoid z-fighting. This can be countered by using decals with the 'polygonoffset' parameter set.
  • Note: most decals don't contribute to the collision mesh, but it is always wise to turn off their 'Solid Collision' flag in the Primitives inspector.

Material Setup

Since decals are non-collidable, (usually) transparent, placed flush against walls and don't cast shadows, they need a special material setup in order to appear correctly in-game.

For example, here's the definition in decals_new.mtr for the textures/decals/decal14 texture in the usage example above:

material textures/decals/decal14
	{
	sort decal
	polygonoffset
	nonsolid
 	translucent
 	{
 		blend		filter
 		map 		textures/decals/decals_14_d.tga
 	}
}

Its parameters are fairly self-explanatory:

  • sort decal - ensures the renderer sorts faces using this texture with other decals
  • polygonoffset - 'lifts' the decal away to prevent z-fighting
  • nonsolid - so the decal won't contribute to the collision hull (to stop the player getting caught on it)


See Also

Personal tools