Difference between revisions of "TGA"

From Valve Developer Community
Jump to: navigation, search
m (Valid format: spelling)
(Bold.)
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
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 [[VTF|Valve Texture Files (.vtf)]], and used to store images used by the [[:Category:Steam|Steam client]].
+
{{otherlang2
 +
|de=TGA:de
 +
}}
 +
'''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]]. The file extension for targas is <code>.tga</code>. It is the base format for [[VTF|Valve Texture Files (.vtf)]], and used to store images used by the [[:Category:Steam|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.
+
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 [[VMT]] [[shader]]s can use for effects such as transparency or specularity.
 +
 
 +
Most Textures in Source start life as [[TGA]]s which are edited and adjusted with any suitable [[image editor]]. The TGA is then compiled into the Valve Texture Format ([[VTF]]) using [[Vtex]].exe (or a third-party tool such as [[VTFEdit]]) to participate in the [[Material System]].
  
  
Line 18: Line 23:
 
=== Scale ===
 
=== Scale ===
  
The default texture scale in Hammer is <code>.25</code>. This means that 4 pixels (in an image) = 1 Hammer unit = 1 inch (in game) or (4x4=) 16 pixels for every square inch.
+
The default texture scale in Hammer is <code>0.25</code>. This means that 1 texture pixel = 0.25 [[Dimensions|map units]] in Hammer and in game, or a 512x512 texture covers 128x128 map units (equivalent to 8x8 feet or 2.4x2.4 meters).
 +
{| class=standard-table
 +
|+ Relative [[Dimensions]] for (Default) Texture Scale 0.25
 +
! Texture || Hammer || FileSize
 +
|-
 +
! pixels || map units || kB (32bit)||
 +
|-
 +
|4 x 4 || 1 x 1 || 0.06 ||
 +
|-
 +
|8 x 8 || 2 x 2 || 0.25 ||
 +
|-
 +
|16 x 16 || 4 x 4 || 1 ||
 +
|-
 +
|32 x 32 || 8 x 8 || 4 ||
 +
|-
 +
|64 x 64 || 16 x 16 || 16 ||
 +
|-
 +
|128 x 128 || 32 x 32 || 64 ||
 +
|-
 +
|256 x 256 || 64 x 64 || 256 ||
 +
|-
 +
|512 x 512 || 128 x 128 || 1024 (1MB)|| This is the most common size for archictextures : brickwork, concrete, etc.
 +
|-
 +
|1024 x 1024 || 256 x 256 || 4096 (4MB) ||
 +
|-
 +
|2048 x 2048 || 512 x 512 || 16384 (16MB) || This is the largest size that [[vtex]] can cope with and is only used for large non-tiling brushes like 2D skyboxes.
 +
|}
 +
* '''Texture (pixels)''' : Square format is preferred but rectangles are acceptable. Each dimension must be a power of two upto 2048.
 +
* '''Hammer (map units)''' : using the default Texture Scale of 0.25. This can be overridden locally per surface in Hammer or per ''material'' by using the [[$basetexturetransform]] ''scale'' factor in the [[VMT]]. For example A 512x512 texture with a scale of 0.5 will cover only 64x64 map units, and when viewed up close should appear highly detailed.
 +
* '''Filesize (kB)''' : is given for 32bit uncompressed rasta image. {{TODO|[[VTF]] uses it's own compression system ...}}
  
For textures that appear on large surfaces a good scale is 512 pixels for 128 [[Dimensions|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.
+
{{Note|3D Skybox scale is 1/16th of map scale, so textures for 3D skybox surfaces should be designed accordingly.}}
  
 
=== Save location ===
 
=== Save location ===
Line 26: Line 60:
 
Remember that Vtex is only able to locate targa images located inside the <code>/materialsrc/</code> 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.
 
Remember that Vtex is only able to locate targa images located inside the <code>/materialsrc/</code> 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 ==
+
== External links ==
 
+
* [[Wikipedia:Truevision_TGA|Wikipedia entry for TGA]]
* [[Wikipedia:Truevision_TGA|The Wikipedia entry for TGA]]
 
 
* [http://astronomy.swin.edu.au/~pbourke/dataformats/tga/ TGA Format Specification]
 
* [http://astronomy.swin.edu.au/~pbourke/dataformats/tga/ TGA Format Specification]
 
* [http://www.irfanview.com/ Irfanview, a popular TGA viewer]
 
* [http://www.irfanview.com/ Irfanview, a popular TGA viewer]
 +
* [http://www.snarkpit.net/index.php?s=articles&article=126 Texture file formats from The SnarkPit site]
  
* [http://www.snarkpit.net/editing.php?page=tutorials&game=HL2&id=141 Texture file formats from The SnarkPit site]
+
[[Category:Glossary]]  
 
+
[[Category:Material System]]
 
+
[[Category:English]]
[[Category:Glossary]] [[Category:Material System]]
 

Latest revision as of 13:38, 26 September 2016

Deutsch

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. The file extension for targas is .tga. 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 VMT shaders can use for effects such as transparency or specularity.

Most Textures in Source start life as TGAs which are edited and adjusted with any suitable image editor. The TGA is then compiled into the Valve Texture Format (VTF) using Vtex.exe (or a third-party tool such as VTFEdit) to participate in the Material System.


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 occasional conversion troubles.

Scale

The default texture scale in Hammer is 0.25. This means that 1 texture pixel = 0.25 map units in Hammer and in game, or a 512x512 texture covers 128x128 map units (equivalent to 8x8 feet or 2.4x2.4 meters).

Relative Dimensions for (Default) Texture Scale 0.25
Texture Hammer FileSize
pixels map units kB (32bit)
4 x 4 1 x 1 0.06
8 x 8 2 x 2 0.25
16 x 16 4 x 4 1
32 x 32 8 x 8 4
64 x 64 16 x 16 16
128 x 128 32 x 32 64
256 x 256 64 x 64 256
512 x 512 128 x 128 1024 (1MB) This is the most common size for archictextures : brickwork, concrete, etc.
1024 x 1024 256 x 256 4096 (4MB)
2048 x 2048 512 x 512 16384 (16MB) This is the largest size that vtex can cope with and is only used for large non-tiling brushes like 2D skyboxes.
  • Texture (pixels) : Square format is preferred but rectangles are acceptable. Each dimension must be a power of two upto 2048.
  • Hammer (map units) : using the default Texture Scale of 0.25. This can be overridden locally per surface in Hammer or per material by using the $basetexturetransform scale factor in the VMT. For example A 512x512 texture with a scale of 0.5 will cover only 64x64 map units, and when viewed up close should appear highly detailed.
  • Filesize (kB) : is given for 32bit uncompressed rasta image. To do: VTF uses it's own compression system ...
Note:3D Skybox scale is 1/16th of map scale, so textures for 3D skybox surfaces should be designed accordingly.

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.

External links