The 'paint' that is applied to solids (
brushes) in maps. They are fundamental to level design, just behind the geometry itself. Textures are found in
WAD files, which can be browsed from within Hammer and edited using tools like Wally and PAKScape.
In
Hammer Editor or
J.A.C.K., pressing
Shift+T applies the currently selected texture to the currently selected object(s), while pressing
Shift+A brings up a dialog that gives you more control over texture scaling and alignment. Consult the
Texture Application tutorial for more information on texture application.
The rest of this page discusses textures as used by the
GoldSrc engine in much,
much more detail.
The GoldSrc engine supports textures and graphics with 256 unique colours per texture, an upgrade from its predecessor the idTech 2 (Quake) engine that only has a single shared 256 colour palette across the whole engine.
The source image files for these textures therefore must be an 8-bit indexed bitmap (.BMP). It means that there is a palette (or list) of 256 colours maximum and each pixel of the image is one of those colours in the palette. You will need to convert your full-colour (RGB[A]) images to an indexed bitmap through a process called quantization. It can be done within most full-fledged image editors, but something lightweight like IrfanView does the job well. Wally can be used to adjust a bitmap's palette entries directly.
Some
texture types look at specific palette indices for their special properties:
!
(water) textures uses palette index #3 (counting from 0) as the fog colour when submerged in water, and the red value of palette index #4 sets the fog intensity.
{
(transparent) textures uses palette index #255 (last index) as the transparent colour. Parts of the image with that colour is transparent when the face is part of an entity with proper render mode as aforementioned.
{
(decal) textures uses palette index #255 (last index) as base colour of the whole decal, which are otherwise monochromatic. The colour index #255 must not be used in the image itself.
The length of the sides of the image must be in multiples of 16. This is to support the
WAD3 miptex (mipmapped texture) format which uses 4 levels of
mipmapping (at full, half, quarter and 1/8th resolutions). The maximum dimensions vary between engine implementations but generally 512 is conventionally taken as maximum. Larger textures need to be split into multiple parts.
Model textures abide by similar rules with regards to being 8-bit indexed bitmaps and using the last palette index for transparent colour (if the texture is flagged as such). For full details, see the303's page on
texture preparation for GoldSource models.
Sprites are also created from 8-bit indexed bitmaps and can be in several formats:
Normal and
additive are analogous to normal textures,
alpha-test is analogous to transparent textures (last index=transparency), and
index-alpha is analogous to decal textures (last index=base colour). It can also contain animation frames, but the crucial difference to animated textures is that all frames of the animation shares a single palette.
Texture types
There are several types of textures with different properties. Usually it's defined by a prefix or suffix.
- Normal textures are anything not covered by other entries in this list.
!
-prefixed textures are water/liquid textures. These are rendered differently in the game. If the game is running in software more, a special caustic effect is applied. If in GL mode, the surface will be composed of wavy polygons instead of static polygons.
- Palette index #3 (counting from 0) sets the fog colour when underwater, and the red value of the palette index #4 sets the fog intensity.
{
-prefixed textures can be either:
- textures with a transparency index such as railings and ladders. The transparent colour is in palette index #255 (last index), and by convention is assigned blue. Note that it's the palette index that matter, not the pureness of the blue (or any colour).
- grayscale decal textures from
decals.wad
. The palette is grayscale (from black to white, or vice versa) save for the last palette index #255, which specifies the colour to apply for the whole decal. Use the infodecal
entity to apply decals.
+0
– +9
and +A
– +J
prefixes are 2 related animating sets of textures. For example, applying a +0
-prefixed texture to a face on a func_wall
or func_button
will make it animate through the number set initially, and when triggered would switch to the alphabet set. Usually the alphabet set is composed of only one item, +A
.
-0
– -9
prefix are random tiling textures. If a -0
-prefixed texture is applied to a face, the game engine will apply a random collage of the set when rendering the map. It is randomized every map load.
- Note: random texture rendering is kinda broken in modern GL mode as of 2024, in that it tends to split over face subdivisions rather than applying uniformly.
~
is used by convention to denote textures that emit light.
- In Quake these textures have certain palette ranges that are full-bright, but that property was lost in GoldSource.
SCROLL
prefixes are textures that scroll towards the right. Used in flowing water and conveyor belt textures. The texture must be applied in the correct orientation for it to scroll in that direction. Apply the texture to a func_conveyor
to set the texture's scroll speed.
- Several tool textures are used by the compiler for specific, quasi- or non-textural applications. Some common examples include
AAATRIGGER
, CLIP
, NULL
, ORIGIN
, and SKY
.
_HIDDEN
suffix makes the texture invisible. This is useful to fix model lighting, as these faces retain lighting data. See: Tutorial: models and lighting. This works on some tool textures too, that are otherwise visible. But for most applications, you only ever need black_HIDDEN
.
_HIDDEN
textures are always visible on brush entities: use NULL
or SKIP
instead.
@
prefix is rarely used. It creates an opaque boundary between spaces that blocks visibility, but no collision. The faces are visible on both outsides and insides of the brush.
Textures and materials
A texture is just one part of the material system. In GoldSource this material system is used to impart materialistic properties for the textures in question, such as footstep sounds and the sounds when hit with a crowbar. But unlike modern game engines, the material system of GoldSource consists simply of the
materials.txt file listing the materials of each texture set.
Condition Zero uses a different system, which will not be discussed here.
Textures and lighting
In the process of lighting the map, the lighting compiler (
RAD) can make textures cast light, called
texture lighting. This can be configured using
lights.rad file or in-map entities like
info_texlights
and
light_surface
, and typically used on light fixtures. The RAD compiler from the latest VHLT
compile tools also picks up the colour of the texture when lights are bounced around the map in the lighting process, so a room with, say, red carpeting, will have the red bounced up the walls close to the floor, something that was absent on the original compilers.
The lighting data (
lightmap) on faces has a
fixed resolution of 1/16th the resolution of the texture applied to it. This means that at each 16 texture pixel (texel) intervals there is one lighting pixel (luxel). The lighting between the luxel points are interpolated linearly giving a smooth lighting effect.
Using a higher resolution texture and applying it to faces at a lower scale (e.g. 0.5) can give you higher luxel resolution measured against world dimensions, but at the cost of shrunken flashlight lighting, and quickly eating up a map's limit on lightmaps (
AllocBlock limit.) Consider using
detail textures to add detail.
See also:
Tutorial: The Complete Guide to Lighting.
Detail textures
Introduced in Condition Zero and available in the HL SDK, detail textures are another layer of texture applied to the base textures. It imparts detailing similar to bump mapping when a texture is viewed up close, to suggest the materials that the texture is made out of such as concrete, metal, wood, bark, snow, etc.
Detail textures are in 24-bit TGA files, where the neutral colour is
gray (
128 128 128, or
#808080
).
Gray on the detail texture becomes transparent over the base texture, brighter colours creates a highlight, and darker colours darkens it. Higher contrast (deviations from the gray) suggests more roughness and vice versa. The maximum dimensions for detail textures are not clear but are usually in 128px by 128px. By convention they are placed in
gfx/detail/
relative to the game/mod folder (or a subfolder within).
Detail textures are specified for each map through
<mapname>_detail.txt
placed beside the .bsp file. The entries consist of the texture name, the path to the detail textures relative to
gfx/
folder, and the x and y multipliers. The multiplier values specifies how many times the detail textures are tiled on that axis relative to the base texture. a 4.0 value on a 64px wide texture means the detail textures repeats 4 times every 64px of the base texture, or once every 16px.
Detail textures can be enabled or disabled in game by entering the
r_detailtextures 0|1
on the console.
See also:
Tutorial: Detailed Textures in Half-Life.
GoldSource vs Source (and more modern engines)
The GoldSource engine's concept of textures are only in the sense of "images applied to a surface," with name affixes and special names dictating special properties. Apart from (or in addition to) the texture types listed above, render properties (such as opacity) are applied using the
render properties of the
brush entity where the texture is applied.
In Source, a surface is instead assigned a
material described in a text-based .vmt files, and that material file in turn lists its own intrinsic properties e.g. being water or animated, material sounds and decals replacing the system described in the previous section, and associated texture or textures.
Furthermore, a texture in GoldSource is composed of only the colour + shadows baked into one image, while in Source and other more modern engines a material has more information about shininess, bumpiness, etc.