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

From GTAMods Wiki
Jump to navigation Jump to search
m
m
Line 63: Line 63:
 
* 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
 +
 +
[[File:Txdgen_tut_samip_copy.png|650px|center|Copying the generated files into the game]]
 +
 
'''Congratulations! Every world texture is now using mipmaps!'''
 
'''Congratulations! Every world texture is now using mipmaps!'''
  

Revision as of 06:32, 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.

Console window

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
Copying the generated files into the game

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.