LogoLogo
简体中文
简体中文
  • 主页
  • 联系我们
  • 感谢名单
  • 维基101 - 如何开始?
    • 修改指南
      • 如何备份,解包和重新打包
      • 如何配置修改用一个工作环境
      • 修改工具
        • 如何使用RSPNVPK
        • 资源
          • 游戏目录
          • BSP
            • BSPSource
            • BSP Viewer
            • BSP2MAP
            • BSPZIP
            • EntEd
            • Entspy
            • Map Analyst
            • PackBsp
            • Pakrat
            • VBSP_h4xed
            • VIDE
            • VMEX
            • WinBSPC
            • WinBSPZip
          • Hammer
            • 位移Luxel密度
          • VTF & VMT
            • VTFEdit
            • Vtex
              • Vtex - 编译参数
              • Vtex - 疑难解答
  • 信息
    • 纹理
      • Valve纹理格式-VTF
        • 创建材质
        • 创建动画粒子
        • 修改动画粒子-Wanty的方法
      • Valve材质类型-VMT
      • 纹理和颜色
        • 颜色和纹理信息
      • 着色器
        • $basetexture
        • $color
        • $reflectivity
        • 材质标志
      • 反照率贴图
      • 凹凸贴图
        • $bumpmap
        • $ssbump
      • 立方环境贴图
      • 光照贴图
      • 矢量材质
      • 纹理映射
      • 内容丢失
      • 基础天空盒
        • 2D天空盒
        • 3D天空盒
    • 脚本
      • 关键值
        • Gameinfo.txt
        • 武器配置
      • VScript
    • 文件格式
      • NUT & GNUT-Squirrel游戏语言
      • PSD-Photoshop文档
      • TGA-Truevision图像文件
      • TXT-文本文件
      • VPK-Valve包文件
    • 文件位置
      • VPK
      • 武器
        • 武器模型
        • 武器脚本
        • 武器配置
      • 模型
        • 模型-天空背景
        • 铁驭
          • 模型-铁驭能力
          • 模型-铁驭武器
        • 泰坦
        • 模型-引导标志
        • 模型-容器
        • 模型- Fixtures
        • 模型-IMC基础
        • 模型-工业
        • 模型- 虎大前进基地_live_fire
        • 模型-NPC
        • 模型-边境防御
  • 修改
    • 武器
      • 自定义武器皮肤
        • 使用\应用自定义武器皮肤
          • VTF文件制作
        • 制作武器自定义皮肤
          • 2D图像线框渲染模式(Wireframe mode)
        • 武器自定义皮肤样例
      • 武器效果
      • 准星修改
        • 批量修改准星
        • 准星样例
      • 武器定位
      • 武器视野
      • 一键更换武器视野
      • 特殊/独特武器修改
        • 电能步枪-电弧枪
        • 电能步枪-蓄力颜色
        • LSTAR-蓄力颜色
    • 铁驭
      • 模型-铁驭类
    • 泰坦
      • 泰坦的穹顶护盾
      • 北极星
        • 线缆-钩爪和绊索陷阱
        • 电浆磁轨炮-蓄力特效
        • 北极星-重力特效
        • 北极星-铝热剂特效
      • 浪人
        • 剑封颜色
      • 军团
        • 强大火力-蓄力颜色
      • 离子
        • 镭射炮-蓄力颜色
        • 漩涡防护罩颜色
    • 地图
      • 地图-天空背景
      • 地图-立体地图
      • 战争游戏
        • 全息墙颜色
    • 用户界面
      • 游戏文本修改-r1_language
      • 游戏中
        • 计分板背景
      • 菜单
        • 暂停菜单模糊
        • 主菜单背景
        • 网路-菜单
        • 新闻和聚焦
        • 设置
          • 控制
          • 按键设置
    • 声音
      • 击杀音效
      • 大厅背景音乐
    • 杂项
      • 电缆-滑索
      • 马文机器人-胸部显示屏
      • 脉冲刀范围特效
      • 被声呐探测到的效果
      • 模型-炸蛛
      • 尼斯湖水怪模型
  • 脚本数据
    • 准星
    • 特效(FX)
    • 特效
      • 特效-铁驭
        • 特效-铁驭武器
          • 特效-突击步枪
          • 特效-冲锋枪
          • 特效-轻机枪
          • 特效-狙击步枪
          • 特效-散弹枪
          • 特效-榴弹发射器
          • 特效-副手武器和手枪
          • 特效-反泰坦武器
          • 特效-特殊武器
        • 特效-铁驭投掷物
          • 特效-电弧效果
          • 特效-飞火星
          • 特效-重力星
        • 特效-铁驭能力
      • 特效-泰坦
        • 特效-离子
        • 特效-强力
        • 特效-北极星
          • 特效-电浆轨道炮
          • 特效- Holo Railgun
          • 特效-毒蛇
        • 特效-帝王
          • 特效-Monarch Beam
        • 特效-浪人
        • 特效-烈焰
          • 特效-铝热剂发射器
          • 特效-Meteor First
          • 特效-火墙
        • 特效-军团
      • 特效-NPC和炮台
        • 特效-NPC
          • 特效-无人机
          • FX - Drone Cloak
          • FX - Drone Frag
          • FX - MRVN
          • FX - Mortar
          • FX - Holo Spectre
        • 特效-炮台
      • 特效-杂项和未知项
        • FX - Holo Map
        • FX - Beacon
        • FX - Skybox
          • FX - Skybox 1K
          • FX - Skybox Carrier
          • FX - Skybox Creature
          • FX - Skybox Nuke
          • FX - Skybox Station Traffic
        • FX - Skyway
        • FX - Dev
          • FX - Bug Repro
        • FX - Droppod
        • FX - Scan
      • 特效-原始数据
        • FX - EMP
        • FX - Env
        • FX - Grenade
        • FX - Harvester
          • FX - Coop Harvester FX
        • FX - HUD
          • FX - HUD AR FX
          • FX - HUD AR Impacts
          • FX - HUD AR Lines
          • FX - HUD AR Ordinance
          • FX - HUD AR Pings
          • FX - HUD AR Titandroppoint
        • FX - Impact
          • FX - Impact FX EXP Cutom
        • FX - Light
        • FX - Orbital Strike
        • FX - Projectile Plasma
        • FX - Reload
        • FX - Shell Eject
        • FX - Smoke
        • FX - Tracers
        • FX - Weapon
          • FX - Arc Cannon
          • FX - Dragonbreath
          • FX - Flamethrower
          • FX - Malta Gun
          • FX - Triple Threat
    • 声音
      • 声音-默认语音
      • 声音-铁驭
        • 铁驭武器
          • 突击步枪
          • 冲锋枪
          • 轻机枪
          • 狙击步枪
          • 散弹枪
          • 榴弹枪
          • 副手武器及手枪
          • 反泰坦武器
        • 铁驭投掷物
        • 铁驭能力
      • 声音-泰坦
        • 声音-离子
        • 声音-强力
        • 声音-北极星
        • 声音-帝王
        • 声音-浪人
        • 声音-烈焰
        • 声音-军团
      • 声音-无人机和NPC
        • 声音 -巨型炮塔
      • 声音-杂项和未知项
        • 声音-电弧炮
        • 声音-电弧枪
        • 声音- Flamethrower
        • 声音- Triplethreat
    • 图标和HUD
      • 菜单
        • 私房加载界面
        • 私人比赛
        • 计分板
  • 修改样例
    • 低配模式
    • 无HUD修改
  • 导出资源
    • 导出地图
    • 导出模型
    • 使用Legion的方式导出
  • 资源
    • 纹理库
Powered by GitBook
On this page
  • 历史
  • 技术细节
  • 头部
  • 图像和彩色地图数据
  • 开发版本 (可选)
  • 文件页脚 (可选)
  • 规格差异
  • Vtex的目标
  • 有效格式
  • 比例尺
  • 保存目录

Was this helpful?

  1. 信息
  2. 文件格式

TGA-Truevision图像文件

PreviousPSD-Photoshop文档NextTXT-文本文件

Last updated 3 years ago

Was this helpful?

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 . The file extension for targas is .tga. It is the base format for , and used to store images used by the .

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 , for a total of 32 bits/pixel. The extra channel contains information that the 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 . The TGA is then compiled into the Valve Texture Format () using .exe (or a third-party tool such as ) to participate in the .

历史

The TGA file format was originally defined and specified by EPICenter with feedback from Island Graphics Inc in 1984. AT&T EPICenter was an internal spin-off of AT&T created to market new technologies AT&T had developed for color . What later became Truevision was the result of a leveraged employee buyout from AT&T in 1987.

技术细节

All values are ; field and subfield numbers are per Version 2.0 of the specification.

Version 2 added the extension area and footer. The developer area exists to store application-specific information.

头部

Field no.

Length

Field name

Description

1

1 byte

ID length

Length of the image ID field

2

1 byte

Color map type

Whether a color map is included

3

1 byte

Image type

Compression and color types

4

5 bytes

Color map specification

Describes the color map

5

10 bytes

Image specification

Image dimensions and format

图像ID长度 (field 1)

0–255 The number of bytes that the image ID field consists of. The image ID field can contain any information, but it is common for it to contain the date and time the image was created or a serial number.

As of version 2.0 of the TGA spec, the date and time the image was created is catered for in the extension area.

颜色映射类型(field 2)

has the value:

  • 0 if image file contains no color map

  • 1 if present

  • 2–127 reserved by Truevision

  • 128–255 available for developer use

图像类型(field 3)

is enumerated in the lower three bits, with the fourth bit as a flag for RLE. Some possible values are:

  • 0 no image data is present

  • 1 uncompressed color-mapped image

  • 2 uncompressed true-color image

  • 3 uncompressed black-and-white (grayscale) image

  • 9 run-length encoded color-mapped image

  • 10 run-length encoded true-color image

  • 11 run-length encoded black-and-white (grayscale) image

彩色地图规格(field 4)

has three subfields:

  • First entry index (2 bytes): index of first color map entry that is included in the file

  • Color map length (2 bytes): number of entries of the color map that are included in the file

  • Color map entry size (1 byte): number of bits per pixel

In case that not the entire color map is actually used by the image, a non-zero first entry index allows to store only a required part of the color map in the file.

图像规格(field 5)

has six subfields:

  • X-origin (2 bytes): absolute coordinate of lower-left corner for displays where origin is at the lower left

  • Y-origin (2 bytes): as for X-origin

  • Image width (2 bytes): width in pixels

  • Image height (2 bytes): height in pixels

  • Pixel depth (1 byte): bits per pixel

  • Image descriptor (1 byte): bits 3-0 give the alpha channel depth, bits 5-4 give direction

图像和彩色地图数据

Field no.

Length

Field

Description

6

From image ID length field

Image ID

Optional field containing identifying information

7

From color map specification field

Color map data

Look-up table containing color map data

8

From image specification field

Image data

Stored according to the image descriptor

开发版本 (可选)

Version 1.0 of the TGA specification was very basic, and many developers had a need to store more information, and so opted to add on extra sections to their files, specific to their application only.

In Version 2.0 of the specification, these application-specific enhancements/extras are supported by the developer area. Only the offset and size of the developer area are relevant to the spec, and developers are free to add whatever they want in the area.

If a TGA decoder cannot interpret the information in the developer area, it will generally ignore it, since it is assumed to have been created by a different application. It is recommended that developers build logic into their applications to determine whether the data in the developer area is compatible with the application; one step towards this is to check the software ID in the file footer.

扩展区(可选)

Field no.

Length

Field

Description

10

2 bytes

Extension size

Size in bytes of the extension area, always 495

11

41 bytes

Author name

Name of the author. If not used, bytes should be set to NULL (\0) or spaces

12

324 bytes

Author comment

A comment, organized as four lines, each consisting of 80 characters plus a NULL

13

12 bytes

Date/time stamp

Date and time at which the image was created

14

41 bytes

Job ID

15

6 bytes

Job time

Hours, minutes and seconds spent creating the file (for billing, etc.)

16

41 bytes

Software ID

The application that created the file.

17

3 bytes

Software version

18

4 bytes

Key color

19

4 bytes

Pixel aspect ratio

20

4 bytes

Gamma value

21

4 bytes

Color correction offset

Number of bytes from the beginning of the file to the color correction table if present

22

4 bytes

Postage stamp offset

Number of bytes from the beginning of the file to the postage stamp image if present

23

4 bytes

Scan line offset

Number of bytes from the beginning of the file to the scan lines table if present

24

1 byte

Attributes type

Specifies the alpha channel

文件页脚 (可选)

If a TGA file contains a footer, it is likely to be a TGA version 2 file. The footer is the final 26 bytes of the file, of which the last 18 are constant.

Field no.

Length

Field

Description

28

4 bytes

Extension offset

Offset in bytes from the beginning of the file

29

4 bytes

Developer area offset

Offset in bytes from the beginning of the file

30

16 bytes

Signature

Contains "TRUEVISION-XFILE"

31

1 byte

Contains "."

32

1 byte

Contains NULL

规格差异

The older version of the TGA file format specification taken from the Appendix C of the Truevision Technical Guide states that run-length encoded (RLE) packets may cross scan lines: "For the run length packet, the header is followed by a single color value, which is assumed to be repeated the number of times specified in the header. The packet may cross scan lines (begin on one line and end on the next)".

However, page 24 of the TGA v2.0 specification states the exact opposite: "Run-length Packets should never encode pixels from more than one scan line. Even if the end of one scan line and the beginning of the next contain pixels of the same value, the two should be encoded as separate packets. In other words, Run-length Packets should not wrap from one line to another".

Consequently TGA readers need to be able to handle RLE data packets that cross scan lines since this was part of the original specification. However, when saving (creating) TGA files it will be necessary to limit RLE data packets to scanline boundaries in order to be compliant with the newer v2.0 TGA specification.

有效格式

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.

比例尺

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)

  • Texture (pixels) : Square format is preferred but rectangles are acceptable. Each dimension must be a power of two upto 2048.

Note:3D Skybox scale is 1/16th of map scale, so textures for 3D skybox surfaces should be designed accordingly.

保存目录

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.

Source:

Reference:

的目标

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

Relative for (Default) Texture Scale 0.25

This is the largest size that can cope with and is only used for large non-tiling brushes like .

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 scale factor in the . 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: uses it's own compression system ...

.tga type not at

James D. Murray, William vanRyper (April 1996). . . . Retrieved 2014-03-07.

(PDF).

. Digital Preservation. . 2013-09-13. Retrieved 2014-03-11.

Vtex
map units
Dimensions
$basetexturetransform
VMT
VTF
https://en.wikipedia.org/wiki/Truevision_TGA
https://developer.valvesoftware.com/wiki/TGA
MIME
registered
IANA
Encyclopedia of Graphics File Formats, Second Edition
O'Reilly
ISBN
1-56592-161-5
"Truevision TGAª — FILE FORMAT SPECIFICATION — Version 2.0"
"Truevision TGA, version 2.0"
Library of Congress
vtex
2D skyboxes
Valve
Valve Texture Files (.vtf)
Steam client
alpha channel
VMT
shaders
VTF
Vtex
Material System
AT&T
frame buffers
little-endian
image editor
VTFEdit