Difference between revisions of "TXD"

From GTAMods Wiki
Jump to navigation Jump to search
(Texture Native Data)
Line 51: Line 51:
 
===Texture Native Data===
 
===Texture Native Data===
 
  Size      Name
 
  Size      Name
  4 bytes  unknown
+
  4 bytes  Unknown (usually 8 or 9)
  4 bytes  flags
+
2 byte    Texture Filter
  32 bytes  name
+
  1 byte    Texture Wrap V
  32 bytes  alpha name
+
1 byte    Texture Wrap U
  4 bytes  raster format
+
  32 bytes  Name
  4 bytes  has alpha (why you need a whole 4 bytes for a flag is beyond me)
+
  32 bytes  Alpha Name
  2 bytes  width
+
  4 bytes  Raster Format
  2 bytes  height
+
  4 bytes  Alpha/FOURCC
  1 byte    bpp
+
  2 bytes  Width
  1 byte    mipmaps
+
  2 bytes  Height
  1 byte    rastertype
+
  1 byte    BPP
  1 byte    dxt
+
  1 byte    MipMaps
  4 bytes  raster size
+
  1 byte    Raster Type
  followed by "raster size" of bytes for the actual raster image.
+
  1 byte    DXT
 +
[1024 bytes of Palette Data if Raster Format has FORMAT_EXT_PAL8 set]
 +
  4 bytes  Raster Size
 +
  followed by "Raster Size" of bytes for the actual Raster image.
 +
[ if Raster Format has FORMAT_EXT_MIPMAP and MipMaps > 0]
 +
There are "MipMaps" number of MapMips data each containing
 +
 +
4 bytes Raster Size
 +
followed by Raster Size of mipmap data
 +
- it is possible for some mipmaps to be too small and
 +
  therefore have 0 length.
  
These are the raster formats:
+
These are the Raster Formats and extensions:
 
   
 
   
  DEFAULT    = 0x0000
+
  FORMAT_DEFAULT        0x0000
  FORMAT1555 = 0x0100
+
  FORMAT_1555            0x0100
  FORMAT565  = 0x0200
+
  FORMAT_565            0x0200
  FORMAT4444 = 0x0300
+
  FORMAT_4444            0x0300
  FORMATLUM8 = 0x0400
+
  FORMAT_8888            0x0500
  FORMAT8888 = 0x0500
+
FORMAT_888            0x0600
  FORMAT888 = 0x0600
+
  FORMAT_MASK            0x0F00
  FORMAT16  = 0x0700
+
FORMAT_EXT_AUTO_MIPMAP 0x1000
  FORMAT24  = 0x0800
+
FORMAT_EXT_PAL8        0x2000
  FORMAT32  = 0x0900
+
  FORMAT_EXT_MIPMAP      0x8000
  FORMAT555 = 0x0a00
+
  FORMAT_EXT_MASK        0xF000
  FORMATAUTOMIPMAP = 0x1000
+
 
  FORMATPAL8      = 0x2000
+
These are the Texture Filters:
  FORMATPAL4      = 0x4000
+
 
  FORMATMIPMAP     = 0x8000
+
  FILTER_NONE                0x0
 +
  FILTER_NEAREST            0x1
 +
  FILTER_LINEAR              0x2
 +
  FILTER_MIP_NEAREST        0x3
 +
  FILTER_MIP_LINEAR          0x4
 +
  FILTER_LINEAR_MIP_NEAREST  0x5
 +
  FILTER_LINEAR_MIP_LINEAR  0x6
 +
 
 +
These are the Texture Wrap:
 +
 
 +
  WRAP_NONE    0x0
 +
  WRAP_WRAP     0x1
 +
WRAP_MIRROR  0x2
 +
WRAP_CLAMP    0x3

Revision as of 20:06, 10 December 2006

Copyed from Spooky, just to make a start..: Please note that this is the Vice City format, although it doesnt differ that much.. Copied from here


The TXD Format

a TXD file is a Renderware texture dictionary.

TXD files have the same basic format as DFF files and consist of sections with different purpose. See KCows dff documentation for more infos. Every section has a 12 byte section header, containing type, size and ver id. Here are some version id's along with the renderware api version they are associated with and the gta game they're found in:

 File Tag   API version 
 0x00000302 0x30200
 0x00000310 0x31000
 0x0800FFFF 0x32000 for GTA3,
 0x0C02FFFF 0x33002 for VC PS2 and
 0x1003FFFF 0x34003 for VC PC
 0x1400FFFF 0x35000
 0x1803FFFF 0x36003 for SA
 0x1c020001 0x37002


The (usual) txd format looks like this:

 (22) Texture Dictionary
 |
 +--> (1) Data ( Specific to the Texture Dictionary )
 |
 +-+ (21) Texture Native No. 1
 | |-+ (1) Data (all the texture information and the image itself)
 | |
 | +-- (3) Extension (always empty - size=0) --> MISSING
 |
 +-+ (21) Texture Native No. 2
 | |-- ... (same as above)
 |
 +-+ (21) Texture Native No. 3
 |-- ...

(The number in brackets stands for the section type - dword)

The break down for each section is as follows

Texture Dictionary Data

4 bytes nbrTextures

This section only contains the number of textures in this texture dictionary.

Texture Native Data

Size      Name
4 bytes   Unknown (usually 8 or 9)
2 byte    Texture Filter
1 byte    Texture Wrap V
1 byte    Texture Wrap U
32 bytes  Name
32 bytes  Alpha Name
4 bytes   Raster Format
4 bytes   Alpha/FOURCC
2 bytes   Width
2 bytes   Height
1 byte    BPP
1 byte    MipMaps
1 byte    Raster Type
1 byte    DXT
[1024 bytes of Palette Data if Raster Format has FORMAT_EXT_PAL8 set]
4 bytes   Raster Size
followed by "Raster Size" of bytes for the actual Raster image.
[ if Raster Format has FORMAT_EXT_MIPMAP and MipMaps > 0]
There are "MipMaps" number of MapMips data each containing

4 bytes Raster Size
followed by Raster Size of mipmap data 
- it is possible for some mipmaps to be too small and 
  therefore have 0 length.

These are the Raster Formats and extensions:

FORMAT_DEFAULT         0x0000
FORMAT_1555            0x0100
FORMAT_565             0x0200
FORMAT_4444            0x0300
FORMAT_8888            0x0500
FORMAT_888             0x0600
FORMAT_MASK            0x0F00
FORMAT_EXT_AUTO_MIPMAP 0x1000
FORMAT_EXT_PAL8        0x2000
FORMAT_EXT_MIPMAP      0x8000
FORMAT_EXT_MASK        0xF000

These are the Texture Filters:

FILTER_NONE                0x0
FILTER_NEAREST             0x1
FILTER_LINEAR              0x2
FILTER_MIP_NEAREST         0x3
FILTER_MIP_LINEAR          0x4
FILTER_LINEAR_MIP_NEAREST  0x5
FILTER_LINEAR_MIP_LINEAR   0x6

These are the Texture Wrap:

WRAP_NONE     0x0
WRAP_WRAP     0x1
WRAP_MIRROR   0x2
WRAP_CLAMP    0x3