TxdGen/Mipmapping San Andreas for PC

From GTAMods Wiki
Revision as of 08:28, 20 February 2015 by The GTA (talk | contribs) (another neat tutorial for you folks)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Mipmapping is an important final touch to game textures. Using mipmaps you can improve the visual quality of models when they are rendered in the distance. Both CPU and GPU performance is increased: Mipmaps do not have to be generated during runtime, the GPU has an easier job mapping lower resolution textures onto triangles. When done correctly mipmapping only bears advantages. Unfortunately, Rockstar Games has not entirely done things right, which is the cause in the "black roads bug" that plagues the PC and XBOX version of San Andreas. In this tutorial, we want to put a closure to the dark history and fix San Andreas textures how they were supposed to be.

At time of writing, TxdGen version 0.9 is current.

Directions

Step 1: Requirements

There are only a few requirements for fixing your game.

Step 2: Downloading and Preparing

First off, you need to install GTA:SA if you have not already. The recommended location to install to is C:/Program Files (x86)/Rockstar Games/GTA San Andreas/. If you have installed somewhere different, please adjust the following steps accordingly.

How to install TxdGen

  • Place the downloaded txdgen_*.zip archive onto your desktop
  • Right click on the icon and select "Extract All"
  • Press the "Extract" button.
  • You now have a txdgen_* folder on your desktop

Next we want to configure the tool. Inside of the TxdGen folder you see a txdgen.ini file. This is the central configuration file. You should fiddle around with the settings if you got spare time.

This is a specialized version of that file that we need.

txdgen.ini
[Main]
gameRoot=C:/Program Files (x86)/Rockstar Games/GTA San Andreas/models/
outputRoot=txdgen_out/
targetVersion=SA
targetPlatform=PC
generateMipmaps=true
mipGenMode=default
mipGenMaxLevel=6
mipGenSafe=true
compressTextures=false
compressionQuality=1.0
palRuntimeType=PNGQUANT
dxtRuntimeType=SQUISH
warningLevel=3
ignoreSecureWarnings=false
reconstructIMGArchives=true
fixIncompatibleRasters=true
dxtPackedDecompression=false
imgArchivesCompressed=false

Keep the TxdGen directory window around.

Step 3: The Conversion

That is all you need to do to prepare the conversion. Once you are ready, execute txdgen.exe. A console window will open in which you can see debug information. Most importantly it displays what TXD files it currently processes. Since it requires a long time (even more so depending on your workstation processing power) please be patient.

Just like it was stated earlier the converter will fix a lot of textures. For each fixed texture it will display a warning which tells you about the bugs that the texture had. So if you cannot wait, sit back and relax while reading the output of the console window!

When the console window has closed automatically, the conversion is finished.

Step 4: Modding the game

  • open the game directory of GTA:SA (C:/Program Files (x86)/Rockstar Games/GTA San Andreas/)
  • browse into the "models/" subdirectory
  • (OPTIONAL): back up the .img and .txd files inside of this directory
  • return to the TxdGen directory window
  • browse into the "txdgen_out/" directory
  • copy the entire contents of that directory into the "models/" directory we opened earlier

You have successfully fixed the black roads bug! All of the game texture should now be using pre-built mipmaps!

Technical Details

Streaming Memory

Adding mipmaps to game textures significantly increases their size. Since the San Andreas engine uses a concept called streaming memory, you may encounter slower loading of the world around you. This effect is increased if you have set a high draw distance in your game settings.

To fix this issue, I recommend that you install one of the many streaming memory fixes from the GTA modding community.

Conversion Behavior

Each texture that has been converted will just be extended by mipmaps if it did not have them already. The converter has been carefully crafted so that textures do not loose quality (avoiding recompression). Automatic mipmap generation is turned off for all textures.