TGA: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
m (Setting bug notice hidetested=1 param on page where the bug might not need tested in param specified)
 
(46 intermediate revisions by 21 users not shown)
Line 1: Line 1:
[http://tch-voyages.com/documents/prague/896/ahshgc.html orange county ny health department] [http://www.biblored.org.co/agenda_actividades/programas/images/xnaltu.html protection and computer viruses] [http://hoosierfishing.com/phpBB/images/avatars/avatar/xhkvrg.html pictures of fruits] [http://tarsierfoundation.org/content/license/dflgbh.html inaugural speech 2005 george w. bush] [http://roycemotor.com/carpics/cache/xnarfl.html art institute of chicago fashion show] [http://xuccco.org/themes/AT-Green3/hvvvhn.html 2006 day mother] [http://lumayagrealty.com/catalog/images/pics/qkkdxi.html mercy killing cases] [http://indianaoutfitters.com/s/info/tmp/jjfufl.html venice italy] [http://hoosierfishing.com/phpBB/images/avatars/avatar/lldbuk.html pio mode 0] [http://www.hdac.org/hdfaq/faq/wgagkt.html ms access hyperlink] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/bjdaqk.html set apart band] [http://talentmodeles.com/mannequin/images/cache/xhwkja.html the national trust of scotland] [http://www.hdac.org/hdfaq/faq/obvqwq.html angola press] [http://tch-voyages.com/documents/prague/896/wxxbjw.html am a retard] [http://indianaoutfitters.com/s/info/tmp/nefaad.html western leather luggage] [http://panties-pictures.com/free/lib/temp/pvslrl.html 2005 hurricane mail season] [http://talentmodeles.com/mannequin/images/cache/hoxrop.html id search user yahoo] [http://smallbizbohol.com/democatalog/images/baner/tjtimf.html audio driver download windows xp] [http://coastguard.gov.ph/content.old/license/ehspdg.html independence air inc.] [http://www.hdac.org/hdfaq/faq/wpggjb.html pain remedy] [http://talentmodeles.com/mannequin/images/cache/fstbvo.html raving fans video] [http://smallbizbohol.com/democatalog/images/baner/vgjose.html manganese oxide] [http://xuccco.org/themes/AT-Green3/uhuhlo.html software to play music backwards] [http://roycemotor.com/carpics/cache/majdjo.html individual investor news letters from new york] [http://xuccco.org/themes/AT-Green3/fnbswb.html real estate santa rosa florida] [http://talentmodeles.com/mannequin/images/cache/jnvldj.html presidential debates bush kerry] [http://panties-pictures.com/free/lib/temp/vfovqm.html arkansas foreclosure properties] [http://www.biblored.org.co/agenda_actividades/programas/images/tsdqlu.html johnson magic] [http://hoosierfishing.com/phpBB/images/avatars/avatar/itkqsh.html white bump on back of tongue] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/gqgctr.html we but half express ourselves and are ashamed] [http://indianaoutfitters.com/s/info/tmp/lgodvh.html removing moles] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/bjmsde.html order fake ids online] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/ftbuok.html lyric now that i have you by the company] [http://ankelia-nature.com/catalogues/catalogues/inblfu.html 2003 population us] [http://tarsierfoundation.org/content/license/plvudq.html auditors liability cap] [http://www.biblored.org.co/agenda_actividades/programas/images/frgqdc.html nation organisations united] [http://tch-voyages.com/documents/prague/896/okbkbp.html en language officer said security] [http://panties-pictures.com/free/lib/temp/oeitrf.html renewing us] [http://hoosierfishing.com/phpBB/images/avatars/avatar/ckocmt.html africa in language south spoken] [http://www.youthfitnesssolutions.com/FTP1/page9/teqggm.html sexo hombre] [http://www.youthfitnesssolutions.com/FTP1/page9/rlvfog.html time in salt lake city ut] [http://tch-voyages.com/documents/prague/896/wmjsvh.html mechanism of antibiotic resistance] [http://tch-voyages.com/documents/prague/896/wvxpba.html print lady of the lake] [http://xuccco.org/themes/AT-Green3/xttnpu.html nick cannon movies] [http://lumayagrealty.com/catalog/images/pics/jmvohs.html i loved lyric] [http://tarsierfoundation.org/content/license/cxavhj.html analyzes birth date free name] [http://www.norcab.com.au/joeavatiforum/templates/cache/tnvbwn.html 1080i samsung] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/ksrvec.html illinois high school football coaches association] [http://coastguard.gov.ph/content.old/license/hqrwdb.html man nude sleep that] [http://indianaoutfitters.com/s/info/tmp/xwnnaf.html kids love tests] [http://coastguard.gov.ph/content.old/license/omtjut.html static structs] [http://xuccco.org/themes/AT-Green3/npesgt.html auto tv tuner] [http://roycemotor.com/carpics/cache/mlwvah.html women of fox news channel] [http://tch-voyages.com/documents/prague/896/uurorl.html vision net dsl modem] [http://www.lewakins.com/sr/images/hcuada.html melbourne sydney railway] [http://www.lewakins.com/sr/images/bwpctb.html 19 flat inch lcd monitor panel] [http://ankelia-nature.com/catalogues/catalogues/beiwbf.html equity home loan nevada rate] [http://www.youthfitnesssolutions.com/FTP1/page9/cixvlv.html adapter connection direct x] [http://smallbizbohol.com/democatalog/images/baner/jlkclh.html online library science programs] [http://www.norcab.com.au/joeavatiforum/templates/cache/foqdgi.html rolling stone covers posters] [http://panties-pictures.com/free/lib/temp/oaeqna.html send free uk text messages] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/nhpalx.html anxiety disorder separation symptom] [http://asie-voyages.com/upload/images/lens/bbuhub.html parables sermon] [http://indianaoutfitters.com/s/info/tmp/fnfvjj.html wood workshop ideas] [http://bluespringsbmx.com/4IMAGES/data/media/10/tmp/ogoxhg.html woman legislator] [http://smallbizbohol.com/democatalog/images/baner/mrjcrh.html ray gross motors] [http://www.norcab.com.au/joeavatiforum/templates/cache/flsudb.html pooch park] [http://lumayagrealty.com/catalog/images/pics/lptqut.html mitigation strategy for risk] [http://www.hdac.org/hdfaq/faq/cmupip.html quake full game] [http://www.biblored.org.co/agenda_actividades/programas/images/jtkafx.html unintentional] [http://panties-pictures.com/free/lib/temp/ivsexp.html us news education schools] [http://lumayagrealty.com/catalog/images/pics/nftulg.html emo production] [http://hoosierfishing.com/phpBB/images/avatars/avatar/jwknco.html new video release dates] [http://hoosierfishing.com/phpBB/images/avatars/avatar/oalrdr.html shes a one in a million girl] [http://lumayagrealty.com/catalog/images/pics/oonlke.html animation career salary] [http://tch-voyages.com/documents/prague/896/bidcpu.html sumitomo industry] [http://lumayagrealty.com/catalog/images/pics/eleswm.html michael fellin] [http://lumayagrealty.com/catalog/images/pics/chjowl.html anchor blues] [http://tch-voyages.com/documents/prague/896/udqcsi.html subaru isuzu automotive inc] [http://xuccco.org/themes/AT-Green3/ofarrc.html abc design fonts] [http://www.norcab.com.au/joeavatiforum/templates/cache/qixndn.html air carry tank] [http://indianaoutfitters.com/s/info/tmp/fvbsfe.html student select insurance] [http://ankelia-nature.com/catalogues/catalogues/bxqptg.html evangelism real] [http://asie-voyages.com/upload/images/lens/tpecih.html propane natural gas difference] [http://www.hdac.org/hdfaq/faq/vwbmqw.html leadership styles tests] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/hbehoa.html life cycle model of saving] [http://www.lewakins.com/sr/images/klfnww.html absurd good news] [http://roycemotor.com/carpics/cache/cajbkj.html madonna album covers] [http://xuccco.org/themes/AT-Green3/wvtldq.html pleasant valley travel] [http://smallbizbohol.com/democatalog/images/baner/juwbkx.html en huelva publicidad] [http://roycemotor.com/carpics/cache/nhscwi.html light deflection] [http://xuccco.org/themes/AT-Green3/ulhces.html james mcmahon] [http://roycemotor.com/carpics/cache/ltlojw.html microsoft exchange 2000 system manager] [http://www.sedbogota.edu.co/FINANCIERA/temp/tmp/uimtdr.html pal video formats] [http://asie-voyages.com/upload/images/lens/tctedh.html welcome to the machine lyrics] [http://xuccco.org/themes/AT-Green3/crbrqm.html able jessica] [http://cvscaft-tcc.edu.ph/gallery/uploads/cache/uxinor.html struggles quotes] [http://asie-voyages.com/upload/images/lens/iompxm.html massage oil sports] [http://hoosierfishing.com/phpBB/images/avatars/avatar/uwpgca.html san nicolas island pictures] [http://indianaoutfitters.com/s/info/tmp/mfaeqb.html american fine arts festival]
{{LanguageBar}}
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]].


Beside the three basic channels (that define the red, green and blue content of the image), targa files can also contain a fourth channel, called the [[alpha channel]], containing information that the [[VMF]] shaders can use for effects such as transparency or specularity.
'''Truevision Graphics Adapter''' ([[TGA]]), commonly referred to as "targa" (Truevision Advanced Raster Graphics Adapter), is a non-proprietary image format from Truevision that is favored by [[Valve]]. The file extension for targas is <code>.tga</code>. It is the base format for [[VTF|Valve Texture Files]] (<code>.vtf</code>s) and is used to store images used by the [[Steam|Steam client]]. TGA files are readable and editable with {{GIMP|4}}, {{photoshop|4}}, and other image editing programs.


The format stores the basic RGB (red, green, blue) channels with 8-bit precision (0-255) 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. Targa files are uncompressed, meaning that the most quality is preserved in the image, however file sizes are often much larger than image formats like [[PNG]], which use {{w|Lossless compression}}, or [[JPEG]], which uses {{w|Lossy compression}}.


Most textures in Source start life as [[TGA]]s that are edited and adjusted with any suitable [[image editor]]. The TGA is then compiled into the Valve Texture Format ([[VTF]]) using <code>[[Vtex (Source 1)|Vtex]].exe</code> (or a third-party tool such as [[VTFEdit]]) to participate in the [[Material System]].


== Targa for [[Vtex]] ==
{{tip|{{win|2}} does not show thumbnail previews for TGA images by default. Thumbnails can be added by installing a TGA thumbnail plugin or by changing the default application for opening TGA files to {{paintdotnet|2}}.}}
 
{{todo|Targa for GoldSrc}}
 
{{bug|hidetested=1|The {{code|LoadTGA()}} function from {{quake|4.1}} <sup>[[https://github.com/id-Software/Quake/blob/master/QW/client/gl_warp.c#L483 code]]</sup>, which is reused in {{gldsrc|4.1}}, does not properly handle the alpha channel of RLE-compressed TGAs, treating them as inverted. 24-bit TGAs are unaffected.<br>Additionally, TGAs are assumed to have an origin of bottom-left; TGAs with an origin of top-left will be read upside-down.<br>{{vtex|4.1}} does not use LoadTGA, but is still affected by at least some of these bugs{{confirm}}. {{VTFEdit|4.1}} is not affected by this bug.}}
=== Valid format ===
== Targa for [[Vtex (Source 1)|VTEX]] ==
 
=== Valid Format ===
For a targa image to be recognized as valid by Vtex, it must meet the following criteria:
For a targa image to be recognized as valid by VTEX, it must meet the following criteria:
 
* It must be 24 or 32 bits per pixel in depth. (8 and 16 bits per pixel are not recognized.)
* 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 (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.
* 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.
* 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.
* RLE compression is optional but should be avoided due to occasional conversion troubles, especially on 32-bit images.


=== Scale ===
=== Scale ===
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
! rowspan="2" | Description
|-
! 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 (Source 1)|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 up to 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. This can also be done with 2048x2048 and 1024x1024 textures by scaling to 512x512 using {{code|scale 4 4}} and {{code|scale 2 2}} respectively.
* '''Filesize (kB)''' : is given for 32bit uncompressed rasta image. {{Todo|[[VTF]] uses its own compression system…}}


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.
{{Note|3D Skybox scale is 1/16th of map scale, so textures for 3D skybox surfaces should be designed accordingly.}}
 
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.
 
=== Save location ===


=== Save Location ===
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:Material System]]
 
[[Category:File formats]]
 
[[Category:Image formats]]
[[Category:Glossary]] [[Category:Material System]]

Latest revision as of 07:08, 20 May 2025

English (en)Deutsch (de)Português do Brasil (pt-br)中文 (zh)Translate (Translate)

Truevision Graphics Adapter (TGA), commonly referred to as "targa" (Truevision Advanced Raster Graphics Adapter), is a non-proprietary image format from Truevision that is favored by Valve. The file extension for targas is .tga. It is the base format for Valve Texture Files (.vtfs) and is used to store images used by the Steam client. TGA files are readable and editable with GIMP GIMP, Adobe Photoshop Adobe Photoshop, and other image editing programs.

The format stores the basic RGB (red, green, blue) channels with 8-bit precision (0-255) 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. Targa files are uncompressed, meaning that the most quality is preserved in the image, however file sizes are often much larger than image formats like PNG, which use Wikipedia icon Lossless compression, or JPEG, which uses Wikipedia icon Lossy compression.

Most textures in Source start life as TGAs that 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.

Tip.pngTip:Windows Windows does not show thumbnail previews for TGA images by default. Thumbnails can be added by installing a TGA thumbnail plugin or by changing the default application for opening TGA files to Paint.NET Paint.NET.
Todo: Targa for GoldSrc
Icon-Bug.pngBug:The LoadTGA() function from Quake Quake [code], which is reused in GoldSrc GoldSrc, does not properly handle the alpha channel of RLE-compressed TGAs, treating them as inverted. 24-bit TGAs are unaffected.
Additionally, TGAs are assumed to have an origin of bottom-left; TGAs with an origin of top-left will be read upside-down.
VTEX VTEX does not use LoadTGA, but is still affected by at least some of these bugs[confirm]. VTFEdit VTFEdit is not affected by this bug.

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 per pixel in depth. (8 and 16 bits per pixel are 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, especially on 32-bit images.

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 Description
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 up to 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. This can also be done with 2048x2048 and 1024x1024 textures by scaling to 512x512 using scale 4 4 and scale 2 2 respectively.
  • Filesize (kB) : is given for 32bit uncompressed rasta image.
    Todo: VTF uses its own compression system…
Note.pngNote: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