TGA

From Valve Developer Community
Revision as of 23:16, 11 January 2008 by Andreasen (talk | contribs) (Clearified the RGBA format.)

Jump to: navigation, search

Truevision Graphics Adapter (TGA), commonly referred to as "targa" (Truevision Advanced Raster Graphics Adapter), is a non-proprietary image format from Truevision that is favoured by Valve. .tga is also the file extension of that format. It is the base format for Valve Texture Files (.vtf), and used to store images used by the Steam client.

The format stores the basic RGB (red, green, blue) channels with 8 bit precision (0-255) each, for a total of 24 bits/pixel, with an optional additional 8 bit alpha channel, for a total of 32 bits/pixel. The extra channel contains information that the VMF shaders can use for effects such as transparency or specularity.


Targa for Vtex

Valid format

For a targa image to be recognized as valid by Vtex, it must meet the following criteria:

  • It must be 24 or 32 bits/pixel in depth. (16 bits/pixel is not recognized.)
  • Its dimensions (height and width) must have a pixel size equal to a power of 2. (i.e. 2^4=16, 2^5=32, 2^6=64, 2^7=128, 2^8=256, 2^9=512, etc.)
  • Its dimensions can not be bigger than 2048 pixels.
  • The height and width doesn't need to be the same - 64x128, 256x512 works fine - but square images are preferred by the Source engine, so use them whenever possible, even when it doesn't seem like the best way to go.
  • RLE compression is optional, but should be avoided due to occational convertion troubles.

Scale

The default texture scale in Hammer is .25. This means that 4 pixels (in an image) = 1 Hammer unit = 1 inch (in game) or (4x4=) 16 pixels for every square inch.

For textures that appear on large surfaces a good scale is 512 pixels for 128 Hammer-units. This is the default scale at which Hammer will apply textures and equals about 10 feet or about 3 meters in the game.

Save location

Remember that Vtex is only able to locate targa images located inside the /materialsrc/ folder of the current game, so you may want to save it there directly to spare you the trouble of having to move it there later.

See also