Difference between revisions of "TxdGen/Mipmapping San Andreas for PC"

From GTAMods Wiki
Jump to navigation Jump to search
(another neat tutorial for you folks)
 
(added more stuff about conversion and fixed some statements)
Line 5: Line 5:
 
==Directions==
 
==Directions==
 
===Step 1: Requirements===
 
===Step 1: Requirements===
There are only a few requirements for fixing your game.
+
There are only a few requirements for fixing your game textures.
 
* the [[TxdGen|latest version of TxdGen]] (0.9+)
 
* the [[TxdGen|latest version of TxdGen]] (0.9+)
 
* an installation of ''Grand Theft Auto: San Andreas'' (no matter what version)
 
* an installation of ''Grand Theft Auto: San Andreas'' (no matter what version)
Line 28: Line 28:
 
targetVersion=SA
 
targetVersion=SA
 
targetPlatform=PC
 
targetPlatform=PC
 +
clearMipmaps=false
 
generateMipmaps=true
 
generateMipmaps=true
 
mipGenMode=default
 
mipGenMode=default
 
mipGenMaxLevel=6
 
mipGenMaxLevel=6
 
mipGenSafe=true
 
mipGenSafe=true
 +
improveFiltering=true
 
compressTextures=false
 
compressTextures=false
 
compressionQuality=1.0
 
compressionQuality=1.0
Line 59: Line 61:
 
* browse into the "txdgen_out/" directory
 
* browse into the "txdgen_out/" directory
 
* copy the entire contents of that directory into the "models/" directory we opened earlier
 
* 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!'''
+
'''Congratulations! Every world texture is now using mipmaps!'''
  
 
==Technical Details==
 
==Technical Details==
Line 69: Line 71:
 
===Conversion Behavior===
 
===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.
 
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.
 +
 +
'''Filtering modes''' are fixed for all textures. This enables mipmapping for textures that had it disabled previously. Using <code>improveFiltering=true</code> the rendering quality of textures is upscaled closely to how the GTA:SA engine does it.
 +
 +
===Game Configuration===
 +
It is recommended to load the game on at least '''high FX quality setting'''. This will enable anisotropic filtering for loaded game textures which in turn ''reduces the black roads effect''.
 +
 +
Black mipmap layer rendering is part of the engine. Removing it requires restructuring of the engine.
 
{{N|SA}}
 
{{N|SA}}
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]

Revision as of 05:53, 23 February 2015

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 textures.

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
clearMipmaps=false
generateMipmaps=true
mipGenMode=default
mipGenMaxLevel=6
mipGenSafe=true
improveFiltering=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

Congratulations! Every world texture is now using 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.

Filtering modes are fixed for all textures. This enables mipmapping for textures that had it disabled previously. Using improveFiltering=true the rendering quality of textures is upscaled closely to how the GTA:SA engine does it.

Game Configuration

It is recommended to load the game on at least high FX quality setting. This will enable anisotropic filtering for loaded game textures which in turn reduces the black roads effect.

Black mipmap layer rendering is part of the engine. Removing it requires restructuring of the engine.