Texture Last edited 3 months ago2024-09-09 11:46:57 UTC

You are viewing an older revision of this wiki page. The current revision may be more detailed and up-to-date. Click here to see the current revision of this page.
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 User posted image GoldSrc engine in much, much more detail.

Format and dimensions

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: 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 and sprite textures
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.

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.

Related links

Comments

You must log in to post a comment. You can login or register a new account.