Difference between revisions of "TxdGen"

From GTAMods Wiki
Jump to navigation Jump to search
m (migrated the codebase)
 
(48 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
__NOTOC__
 
{{ToolBox
 
{{ToolBox
 
| name    = TxdGen
 
| name    = TxdGen
| version = 0.7
+
| version = 1.0
 
| patrol  = no
 
| patrol  = no
 
| author  = Martin Turski (The_GTA)
 
| author  = Martin Turski (The_GTA)
 +
| game    = [[GTA III]], [[GTA VC]], [[GTA SA]], '''Manhunt''', '''Sonic Heroes'''
 
| genre  = [[TXD|Texture Dictionary]] generator
 
| genre  = [[TXD|Texture Dictionary]] generator
 
| image  = [[Image:Txdgen_overview.png|250px]]
 
| image  = [[Image:Txdgen_overview.png|250px]]
 
}}
 
}}
'''TxdGen''' is the RenderWare [[texture dictionary]] conversion tool. It supports all PC formats, has full support for all PS2 titles and has partial support for the XBOX titles. It scans for TXD files in a source directory and converts them into a desired format into a target directory.
+
'''TxdGen''' is the RenderWare [[texture dictionary]] conversion tool. It supports every known official Rockstar Games TXD archive (PC, PS2, XBOX, PowerVR, ATITC, ...). It scans for TXD files in a source directory and converts them into a desired format into a target directory.
 +
 
 +
 
 +
'''NOTE:''' this tool has been superseded by [[Magic.TXD]].
  
 
==Features==
 
==Features==
 
* Supports '''all PC TXD formats'''
 
* Supports '''all PC TXD formats'''
 
* Supports '''all known raster formats''' (RGBA, RGB, DXTn, 1555, 565, 4444, etc)
 
* Supports '''all known raster formats''' (RGBA, RGB, DXTn, 1555, 565, 4444, etc)
* Outputs TXD in actually working '''PS2''' and PC format
+
* Outputs TXD in actually working '''PS2''', PC and '''XBOX''' format
 
* Lossless conversion between formats!
 
* Lossless conversion between formats!
 
* '''User-friendly''' configuration file!
 
* '''User-friendly''' configuration file!
Line 18: Line 23:
 
* Debug output on common errors
 
* Debug output on common errors
 
* Automatic processing of IMG archives (version 1 '''and''' 2)
 
* Automatic processing of IMG archives (version 1 '''and''' 2)
 +
* '''DXTn''' compression!
 +
* XBOX IMG (de-)compression!
 +
* Mipmap generation.
 +
* ''black-roads fix''
 +
* GTA3 mobile TXD support
 +
* Gamecube and PSP TXD support
 +
 +
==Media==
 +
* [https://www.youtube.com/watch?v=zkHkgO-lZio Video tutorial on how to generate PS2 textures]
 +
* [https://www.youtube.com/watch?v=YoBace396fs Showing off 'SanAndreas Retextured 3' on PS2 hardware]
 +
* [https://www.youtube.com/watch?v=LB7HFalEdXc Optimizing GTA3 Textures (PC)]
 +
* [https://www.youtube.com/watch?v=6So27GlS5qg Mipmapping San Andreas (PC)]
 +
 +
==Configuration settings==
 +
The conversion parameters are specified in the '''txdgen.ini''' file.
 +
*'''outputDebug:''' boolean whether to dump texture debug into a new "debug_output/" directory
 +
*'''gameRoot:''' directory where the TXDs, that should be converted, are located (needs trailing slash!); make sure it exists
 +
*'''outputRoot:''' directory where the new TXDs should be put into (needs trailing slash!)
 +
*'''targetVersion:''' can be GTA3, VC, SA, MH, SHEROES, LCS or Bully ('''self explanatory''')
 +
*'''targetPlatform:''' can be PC, PS2, XBOX, s3tc_mobile, PowerVR, ATC, uncompressed_mobile, Gamecube or PSP
 +
*'''clearMipmaps:''' removes mipmaps that shipped with textures (before doing anything else)
 +
*'''generateMipmaps:''' decides whether mipmaps should be generated or not
 +
*'''mipGenMode:''' hint to the mipmap generator for stylized mipmap generation
 +
*'''mipGenMaxLevel:''' integer that denotes the maximum mipmap layer that TxdGen should generate to (main texture is layer 0)
 +
*'''improveFiltering:''' enables linear filtering for textures
 +
*'''compressTextures:''' decides whether textures should be '''compressed''' if they are not already (to save memory and disk space)
 +
*'''compressionQuality:''' floating point (0..1) that toggles the quality for compression/optimization (only effective if compressTextures=true)
 +
*'''palRuntimeType:''' decides the technique that should be used for palettization/compression; can be '''NATIVE''' or '''PNGQUANT'''
 +
*'''dxtRuntimeType:''' chooses between '''NATIVE''' or '''SQUISH''' S3TC compression algorithms
 +
*'''warningLevel:''' integer that toggles the warning throughput of the TXD parser (the higher the more warnings)
 +
*'''ignoreSecureWarnings:''' boolean whether to ignore warnings that do not crash the engine
 +
*'''reconstructIMGArchives:''' boolean which decides whether IMG archives should be reconstructed in the target directory
 +
*'''fixIncompatibleRasters:''' if this parameter is true then TxdGen attempts to change raster parameters to prevent game engine crashes
 +
*'''dxtPackedDecompression:''' if true, then rwtools will pack decompressed DXT texels in a close approximate raster format to prefer small size over quality
 +
*'''imgArchivesCompressed:''' if true, then compressed IMG archives will be decompressed upon reading and files inside IMG archives will be compressed on writing (required for XBOX GTA Vice City and GTA III)
 +
*'''ignoreSerializationRegions:''' if true, then the converter will ignore RenderWare block length fields while deserializing anything (just like Criterion's implementation)
  
==Configuration==
+
An Example file:
The conversion parameters are specified in the '''txdgen.ini''' file. It can look like this...
 
 
<source lang="ini">
 
<source lang="ini">
 
[Main]
 
[Main]
Line 26: Line 66:
 
outputRoot=txdgen_out/
 
outputRoot=txdgen_out/
 
targetVersion=SA
 
targetVersion=SA
targetPlatform=PS2
+
targetPlatform=PC
 +
clearMipmaps=false
 +
generateMipmaps=true
 +
mipGenMode=default
 +
mipGenMaxLevel=6
 +
improveFiltering=true
 
compressTextures=true
 
compressTextures=true
 +
compressionQuality=0.5
 
palRuntimeType=PNGQUANT
 
palRuntimeType=PNGQUANT
 +
dxtRuntimeType=SQUISH
 +
warningLevel=1
 +
ignoreSecureWarnings=true
 +
reconstructIMGArchives=true
 +
fixIncompatibleRasters=true
 +
dxtPackedDecompression=false
 +
imgArchivesCompressed=false
 +
ignoreSerializationRegions=true
 
</source>
 
</source>
===Description===
+
 
*'''gameRoot:''' directory where the TXDs, that should be converted, are located (needs trailing slash!)
+
==D3DFORMAT compatibility list==
*'''outputRoot:''' directory where the new TXDs should be put into (needs trailing slash!)
+
===Raw colors===
*'''targetVersion:''' can be GTA3, VC or SA ('''self explanatory''')
+
* D3DFMT_A8R8G8B8
*'''targetPlatform:''' can be PC, PS2 or (WIP) XBOX
+
* D3DFMT_X8R8G8B8
*'''compressTextures:''' decides whether textures should be '''compressed''' if they are not already (to save memory and disk space)
+
* D3DFMT_R8G8B8
*'''palRuntimeType:''' decides the technique that should be used for palettization/compression; can be '''NATIVE''' or '''PNGQUANT'''
+
* D3DFMT_R5G6B5
 +
* D3DFMT_X1R5G5B5
 +
* D3DFMT_A1R5G5B5
 +
* D3DFMT_A4R4G4B4
 +
* D3DFMT_A8B8G8R8
 +
* D3DFMT_X8B8G8R8
 +
* D3DFMT_P8
 +
* D3DFMT_L8
 +
* D3DFMT_A8L8
 +
===Compressed colors===
 +
* D3DFMT_DXT1
 +
* D3DFMT_DXT2
 +
* D3DFMT_DXT3
 +
* D3DFMT_DXT4
 +
* D3DFMT_DXT5
  
 
==Credits==
 
==Credits==
 
* Uses a fork of '''rwtools''' by '''aap''' (https://github.com/aap/rwtools)
 
* Uses a fork of '''rwtools''' by '''aap''' (https://github.com/aap/rwtools)
 
* Uses the '''libimagequant''' library (http://pngquant.org/lib/)
 
* Uses the '''libimagequant''' library (http://pngquant.org/lib/)
 +
* Uses the '''libsquish''' library (https://code.google.com/p/libsquish/)
 +
* Uses the '''lzo''' library (http://www.oberhumer.com/opensource/lzo/)
 +
* Thanks to {{U|aru}} from '''GTAForums''' for XBOX swizzling and unswizzling algorithms (http://gtaforums.com/topic/213907-unswizzle-tool/)
 +
* Some parts are inspired by research from {{U|DK22Pac}}
 +
* Uses the '''PowerVR SDK''' (http://www.imgtec.com/tools/powervr-tools/)
 +
* Uses the '''Compressonator''' library (https://github.com/GPUOpen-Tools/Compressonator)
 +
* Uses the '''libjpeg''' library (http://libjpeg.sourceforge.net/)
 +
* Uses the '''libpng''' library (http://libpng.org/)
 +
* Uses the '''libtiff''' library (http://libtiff.org/)
  
 
The licenses (if present) should be bundled with the tool.
 
The licenses (if present) should be bundled with the tool.
  
==Source code==
+
==See also==
See [https://www.assembla.com/code/green-candy/subversion/nodes/547/trunk/ps2%20export%20tool the MTA:Eir repository] for the source code.
+
* [[TxdGen/Converting_Textures_to_PS2_Format|Converting Textures to PS2 Format]]
 +
* [[TxdGen/Optimizing_GTA3_Textures|Optimizing GTA3 Textures]]
 +
* [[TxdGen/Mipmapping_San_Andreas_for_PC|Mipmapping San Andreas for PC]]
 +
 
 +
==External References==
 +
===Reviews===
 +
* http://br.fenixzone.com/foro/index.php?topic=20804.0 - Review by user "Rachel Sexton"; great comparison images; mipmapping
 +
* http://mixmods.blogspot.de/2016/02/mipmapping.html - Review by [http://gtaforums.com/user/650821-junior-djjr/ Junior_Djjr"]; great comparison images; mipmapping
 +
* https://forum.revival-gaming.net/index.php?page=Thread&threadID=381607 - Review by user "Ethan_Aoki"; German/Deutsch
 +
===Shout-outs===
 +
* http://ashslowgameblog.blog.fc2.com/blog-entry-1525.html - shout-out by visionary [https://www.youtube.com/channel/UCQJV5eJ-VdUoAn4Hwj4S6VA/featured Ashley Slow] (know her mods from my MTA days)
 +
* http://forum.brasilplaygames.com.br/t114979-tutorial-ganhando-desempenho-com-mip-mapping - tutorial by user "Pardal_Dillimore"; mipmapping
 +
===Good examples===
 +
* http://ashslowgameblog.blog.fc2.com/blog-entry-1808.html - Ashley's advice regarding black-roads fix
 +
* [http://mixmods.blogspot.de/2015/07/hd-road-v30-mipmapped.html SA Mipmapped Roads (BR)], [http://libertycity.ru/files/gta-3/92529-gta-3-mipmapped-textures.html GTA3 mipmapped textures (RU)], [http://libertycity.ru/files/gta-vice-city/92532-gta-vc-mipmapped-textures.html GTAVC mipmapped textures (RU)]
 +
 
 +
==Known Issues==
 +
* Generating mipmaps for raw GTA 3 textures has improved but is not perfect yet.
 +
* "If I view my alpha textures they look messed up in TXD Workshop!" - to '''workaround''' this issue please use Magic.TXD instead. If you insist in TXD Workshop then set <code>compressionQuality</code> to 0.5. This will activate TXD Workshop compatibility mode, so that you can still use that TXD editing tool.
 +
 
 +
==External links==
 +
* {{GTAG|26916}}
 +
* {{GTAF|764498}}
 +
* [https://osdn.net/projects/txdgen/ OSDN.net] - source code
  
 
{{N|SA|VC|3}}
 
{{N|SA|VC|3}}

Latest revision as of 21:17, 6 April 2017

TxdGen
Txdgen overview.png
Current version:1.0
Developed by:Martin Turski (The_GTA)
Supported games:GTA III, GTA VC, GTA SA, Manhunt, Sonic Heroes
Type:Texture Dictionary generator

TxdGen is the RenderWare texture dictionary conversion tool. It supports every known official Rockstar Games TXD archive (PC, PS2, XBOX, PowerVR, ATITC, ...). It scans for TXD files in a source directory and converts them into a desired format into a target directory.


NOTE: this tool has been superseded by Magic.TXD.

Features

  • Supports all PC TXD formats
  • Supports all known raster formats (RGBA, RGB, DXTn, 1555, 565, 4444, etc)
  • Outputs TXD in actually working PS2, PC and XBOX format
  • Lossless conversion between formats!
  • User-friendly configuration file!
  • Texture compression on demand!
  • Debug output on common errors
  • Automatic processing of IMG archives (version 1 and 2)
  • DXTn compression!
  • XBOX IMG (de-)compression!
  • Mipmap generation.
  • black-roads fix
  • GTA3 mobile TXD support
  • Gamecube and PSP TXD support

Media

Configuration settings

The conversion parameters are specified in the txdgen.ini file.

  • outputDebug: boolean whether to dump texture debug into a new "debug_output/" directory
  • gameRoot: directory where the TXDs, that should be converted, are located (needs trailing slash!); make sure it exists
  • outputRoot: directory where the new TXDs should be put into (needs trailing slash!)
  • targetVersion: can be GTA3, VC, SA, MH, SHEROES, LCS or Bully (self explanatory)
  • targetPlatform: can be PC, PS2, XBOX, s3tc_mobile, PowerVR, ATC, uncompressed_mobile, Gamecube or PSP
  • clearMipmaps: removes mipmaps that shipped with textures (before doing anything else)
  • generateMipmaps: decides whether mipmaps should be generated or not
  • mipGenMode: hint to the mipmap generator for stylized mipmap generation
  • mipGenMaxLevel: integer that denotes the maximum mipmap layer that TxdGen should generate to (main texture is layer 0)
  • improveFiltering: enables linear filtering for textures
  • compressTextures: decides whether textures should be compressed if they are not already (to save memory and disk space)
  • compressionQuality: floating point (0..1) that toggles the quality for compression/optimization (only effective if compressTextures=true)
  • palRuntimeType: decides the technique that should be used for palettization/compression; can be NATIVE or PNGQUANT
  • dxtRuntimeType: chooses between NATIVE or SQUISH S3TC compression algorithms
  • warningLevel: integer that toggles the warning throughput of the TXD parser (the higher the more warnings)
  • ignoreSecureWarnings: boolean whether to ignore warnings that do not crash the engine
  • reconstructIMGArchives: boolean which decides whether IMG archives should be reconstructed in the target directory
  • fixIncompatibleRasters: if this parameter is true then TxdGen attempts to change raster parameters to prevent game engine crashes
  • dxtPackedDecompression: if true, then rwtools will pack decompressed DXT texels in a close approximate raster format to prefer small size over quality
  • imgArchivesCompressed: if true, then compressed IMG archives will be decompressed upon reading and files inside IMG archives will be compressed on writing (required for XBOX GTA Vice City and GTA III)
  • ignoreSerializationRegions: if true, then the converter will ignore RenderWare block length fields while deserializing anything (just like Criterion's implementation)

An Example file:

[Main]
gameRoot=C:/Program Files (x86)/Rockstar Games/GTA San Andreas/
outputRoot=txdgen_out/
targetVersion=SA
targetPlatform=PC
clearMipmaps=false
generateMipmaps=true
mipGenMode=default
mipGenMaxLevel=6
improveFiltering=true
compressTextures=true
compressionQuality=0.5
palRuntimeType=PNGQUANT
dxtRuntimeType=SQUISH
warningLevel=1
ignoreSecureWarnings=true
reconstructIMGArchives=true
fixIncompatibleRasters=true
dxtPackedDecompression=false
imgArchivesCompressed=false
ignoreSerializationRegions=true

D3DFORMAT compatibility list

Raw colors

  • D3DFMT_A8R8G8B8
  • D3DFMT_X8R8G8B8
  • D3DFMT_R8G8B8
  • D3DFMT_R5G6B5
  • D3DFMT_X1R5G5B5
  • D3DFMT_A1R5G5B5
  • D3DFMT_A4R4G4B4
  • D3DFMT_A8B8G8R8
  • D3DFMT_X8B8G8R8
  • D3DFMT_P8
  • D3DFMT_L8
  • D3DFMT_A8L8

Compressed colors

  • D3DFMT_DXT1
  • D3DFMT_DXT2
  • D3DFMT_DXT3
  • D3DFMT_DXT4
  • D3DFMT_DXT5

Credits

The licenses (if present) should be bundled with the tool.

See also

External References

Reviews

Shout-outs

Good examples

Known Issues

  • Generating mipmaps for raw GTA 3 textures has improved but is not perfect yet.
  • "If I view my alpha textures they look messed up in TXD Workshop!" - to workaround this issue please use Magic.TXD instead. If you insist in TXD Workshop then set compressionQuality to 0.5. This will activate TXD Workshop compatibility mode, so that you can still use that TXD editing tool.

External links