User Tools

Site Tools


arma:file_formats:paa

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
arma:file_formats:paa [2007-07-06 01:40]
snakeman moved paa page here
arma:file_formats:paa [2017-10-06 19:26] (current)
snakeman http to https switch.
Line 1: Line 1:
 +====== PAA / PAC file format ======
 +
 +
 ====== Introduction ====== ====== Introduction ======
  
 Of the many image file formats 'out there',​ such as jpeg, such as gif. BI choose to use a specially developed file format (paa) as the base texture file for all engine types. The reason for this is the raw data within the file can be passed directly to Miscrosft'​s Direct X as a DCT1 picture (eg) without further massaging. While all engines except Elite also support JPG files, PAA files can result in much better performance. Of the many image file formats 'out there',​ such as jpeg, such as gif. BI choose to use a specially developed file format (paa) as the base texture file for all engine types. The reason for this is the raw data within the file can be passed directly to Miscrosft'​s Direct X as a DCT1 picture (eg) without further massaging. While all engines except Elite also support JPG files, PAA files can result in much better performance.
 +
  
 ====== Main Format ====== ====== Main Format ======
Line 7: Line 11:
 Overall structure of a Paa file is Overall structure of a Paa file is
  
-<​code>​+<​code ​cpp>
 struct overall struct overall
 { {
Line 19: Line 23:
  
 Every PAA file starts with a **TypeOfPaa** Every PAA file starts with a **TypeOfPaa**
-<​code>​+<​code ​cpp>
 ushort TypeOfPaa; ​ // type of texture, known values are  ushort TypeOfPaa; ​ // type of texture, known values are 
     // 0xFF01 DXT1 compressed texture (may have 1 bit alpha map, check MSDN documentation for details)     // 0xFF01 DXT1 compressed texture (may have 1 bit alpha map, check MSDN documentation for details)
Line 36: Line 40:
 followed by **optional** header tags followed by **optional** header tags
  
-<​code>​+<​code ​cpp>
 struct PAA_Tag { struct PAA_Tag {
  byte    name[8]; // name of tag is actually reversed when written in file,   byte    name[8]; // name of tag is actually reversed when written in file, 
Line 55: Line 59:
 Indecipherable commentary from Feersum:\\ Indecipherable commentary from Feersum:\\
 If format not 0x4747 then end of header tag data is marked by UWORD 0x0000, else this is a `size of palette` and next block it`s a palette(sizeof = `size of palette` * 2) If format not 0x4747 then end of header tag data is marked by UWORD 0x0000, else this is a `size of palette` and next block it`s a palette(sizeof = `size of palette` * 2)
 +
  
 ====== HexDump ====== ====== HexDump ======
  
-{{http://tactical.nekromantix.com/images/wiki/​Paacformat.gif}}+{{https://pmc.editing.wiki/​images/​Paacformat.gif}} 
  
 ====== Known Header Tags ====== ====== Known Header Tags ======
Line 66: Line 72:
 **OFFSTAGG** **OFFSTAGG**
  
-<​code>​+<​code ​cpp>
 Sizeof Data (16 x ULONGS) Sizeof Data (16 x ULONGS)
 Example: Example:
Line 78: Line 84:
 </​code>​ </​code>​
  
-MipMap data is presented in '​blocks'​. One or more '​blocks'​ exist in a paa file. This is a pointless and redundant tag that declares where each of these blocks are in the file, relative to start of file. The location of each block is already known, relative to the size of the previous block (if any). So, although almost always present in paa files, it's use, is redundant. This tag always contains 16 ULONG offsets. Each one is a hard offset to actual mipmap data relative to start of file. Not all entries are used (obvuously) since most paa files contain less than 16 mipmaps. Unused offsets contain the value 0x00000000. There are no known examples of splattered offset entries. All offsets after the first 0 entry are 0 as well.+MipMap data is presented in '​blocks'​. One or more '​blocks'​ exist in a paa file. This is a pointless and redundant tag that declares where each of these blocks are in the file, relative to start of file. The location of each block is already known, relative to the size of the previous block (if any). So, although almost always present in paa files, it's use, is redundant. This tag always contains 16 ULONG offsets. Each one is a hard offset to actual mipmap data relative to start of file. Not all entries are used (obviously) since most paa files contain less than 16 mipmaps. Unused offsets contain the value 0x00000000. There are no known examples of splattered offset entries. All offsets after the first 0 entry are 0 as well.
  
 **AVGCTAGG** **AVGCTAGG**
  
 Average Colour Average Colour
-<​code>​+<​code ​cpp>
 Sizeof Data (1 x ULONG) Sizeof Data (1 x ULONG)
 example: GGATCGVA = FF443D39 example: GGATCGVA = FF443D39
Line 119: Line 125:
 </​code>​ </​code>​
  
-Swizzle is apparently used to modify texture components processing like swizzle modifiers in pixel shaders. For example ArmA sky texture has green channel stored in alpha channel and inversed ​to take advantage from feature that in DXT5 64 bits are used for alpha channel in each block and 64 bits for RBG, giving double the accuracy to green channel as opposed to storing texture just normally. Exact format of swizzle data is still unknown.+Swizzle is apparently used to modify texture components processing like swizzle modifiers in pixel shaders. For example ArmA sky texture has green channel stored in alpha channel and inverted ​to take advantage from feature that in DXT5 64 bits are used for alpha channel in each block and 64 bits for RBG, giving double the accuracy to green channel as opposed to storing texture just normally. Exact format of swizzle data is still unknown. 
  
 ====== Mipmap Data ====== ====== Mipmap Data ======
Line 125: Line 132:
 After end-of-header marker, actual mipmap data follows. Tag OFFSTAGG (if supplied) contains (up to) 16 offsets. Each offset points to the following struct type (relative to start of the file). After end-of-header marker, actual mipmap data follows. Tag OFFSTAGG (if supplied) contains (up to) 16 offsets. Each offset points to the following struct type (relative to start of the file).
  
-<​code>​+<​code ​cpp>
 struct Mipmap_Data { struct Mipmap_Data {
  UWORD width;​ //​ width of this mipmap  UWORD width;​ //​ width of this mipmap
Line 138: Line 145:
 **Decompression Code** **Decompression Code**
  
-<​code>​+<​code ​cpp>
 /* /*
 by Flea by Flea
Line 189: Line 196:
  
 After last mipmap, there are six (6) bytes set to 0x00 to mark end of texture data. And,​consequently,​ end of file. No further data is known to occur after this End mark. After last mipmap, there are six (6) bytes set to 0x00 to mark end of texture data. And,​consequently,​ end of file. No further data is known to occur after this End mark.
 +
  
 ====== Alpha Channel Interpolation ====== ====== Alpha Channel Interpolation ======
Line 196: Line 204:
 **FLAGTAGG = 1, interpolated alpha channel (default behaviour)** **FLAGTAGG = 1, interpolated alpha channel (default behaviour)**
  
-{{http://tactical.nekromantix.com/images/wiki/​paa_alpha_channel_default.jpg}}+{{https://pmc.editing.wiki/​images/​paa_alpha_channel_default.jpg}}
  
 **FLAGTAGG = 2, alpha channel interpolation disabled** **FLAGTAGG = 2, alpha channel interpolation disabled**
  
-{{http://tactical.nekromantix.com/images/wiki/​paa_alpha_channel_no_interpolation.jpg}}+{{https://pmc.editing.wiki/​images/​paa_alpha_channel_no_interpolation.jpg}} 
  
 ====== Bibliography ====== ====== Bibliography ======
  
-Feersum'​s original posting on BIS forums: [[http://​www.flashpoint1985.com/​cgi-bin/​ikonboard311/​ikonboard.cgi?;​act=ST;​f=50;​t=38131|Paa/​pac texture format documentation]]\\ 
 MSDN documentation on DXT1 textures: [[http://​msdn.microsoft.com/​library/​default.asp?​url=/​library/​en-us/​directx9_c/​Opaque_and_1_Bit_Alpha_Textures.asp|DirectX:​ Opaque and 1-Bit Alpha Textures]]\\ MSDN documentation on DXT1 textures: [[http://​msdn.microsoft.com/​library/​default.asp?​url=/​library/​en-us/​directx9_c/​Opaque_and_1_Bit_Alpha_Textures.asp|DirectX:​ Opaque and 1-Bit Alpha Textures]]\\
 Squish Compression [[http://​www.sjbrown.co.uk/?​code=squish|DXTn compress/​decompress]] Squish Compression [[http://​www.sjbrown.co.uk/?​code=squish|DXTn compress/​decompress]]
arma/file_formats/paa.1183686035.txt.gz · Last modified: 2007-07-10 09:52 (external edit)