Monday, August 6, 2012

TUTORIAL 3: Editing DDS Files



So I Decided to make a tutorial for those who want to Edit DDS files from HITMAN GAMES Glacier Engine (Silverballer...), in order to create mods for their games.
 
This tutorial will be based on Hitman Blood Money DDS Files. There's no big difference modding other Hitman Games, be careful because texture files are different from one game to the other.
I recommend you to follow steps carefully, so you can get a 100% success.

So, Here we go:


_________________________________________________________________________________



1. What's a DDS File:


The DirectDraw Surface graphics file format was established by Microsoft for use with the DirectX SDK. The format is specifically designed for use in real-time rendering applications, such as 3D games. It can be used to store textures, cubemaps, mipmap levels, and allows for compression. Due to the fact that most video cards natively support DXTn texture compression, use of this format can save memory on the video card.

Drivers can perform this compression on the fly thanks to the GL_ARB_texture_compression extension. Thus, it would appear the only advantage of DDS is just reduced space (meaning faster loading) without "double degradation" caused by recompressing already-compressed formats like JPEG. However, DDS files expose this automated process to artists. This allows the image author to correct or prevent artifacts that might occur in a completely automated compression process, or even emphasize specific parts of an image's MIP maps.



2. Tools You Need:

  • Glacier Engine Editor : Download HERE
Glacier Engine is the 3d engine used in Hitman Games. This Tool created by "Elbereth" is used to Extract and Import the game's files.
So, you will need it to extract DDS files and Import them after being modified.
  • GIMP 2.6.8 : Download HERE
GIMP is a powerful graphic editor, it is very similar to photoshop, except that GIMP is a FREE Software.
This is a perfect stable version of GIMP. This software is the one that we will use to edit texture files.
Install the application, the nmove to the next step.
  • DDS Plugin For GIMP : Download HERE
Like I said, GIMP is a powerful graphic editor but when it comes to DDS Files, GIMP IS incapable to read and save them.
And, yes, this plugin will do the job.
Installation is easy, just put the DDS.EXE you have downloaded in the GIMP Plug-ins Directory, it is usually located in:

C:\Program Files\GIMP-2.0\lib\gimp\2.0\plug-ins


3. Extra Tools:

  • DDS Converter 2 : Download HERE
We will use this software to convert DDS files modified by GIMP.
When Gimp saves DDS files after being modified, it adds an extra Mipmap level. We need this software to remove that extra Mipmap so Tex Editor can insert the texture in the game.

Make sure that you have all those tools installed on your PC before starting to work, then move to the next part.



_________________________________________________________________________________



1. Extracting DDS files With Tex Editor:


Here, we are going to export dds files from the game to modify them:

- Open Glacier TEX EDITOR.exe

- Click on Open ZIP, then a dialog will appear asking you to locate Glacier resource archive.

- Into that dialog: Go to Your Hitman Blood Money Directory (Here we are using Hitman: Blood Money as an example, but there's no big difference doing this with other Hitman Games).

- Open "Scenes" folder, you will find folders named "M01, M02, ...". Those folders contain the levels' files, and M01 for Example refers to Mission 01.

- Open the folder of the mission you want to edit, (If you want to edit Silverballers from the 2nd mission, you will have to open folder M02), and select the file named "Mxx_main" (xx refers to number of the mission you want to edit). This is what you get:

Posted Image

The image represents the texture files of the game. Here, you should select the texture you want to modify and export it. I will modify here the Silverballer Texture in this tutorial. So :

- Select the texture called: "Weapons_Custom/Pistol_01_WPNC_H3" (Use the search function) and export it where you want.

Now, I have the Silverballer Texture Exported ass a DDS file.

Note: Every DDS file uses a compression and it's very important that you know what type of compression you using for the texture you want to modify and save it, compressed properly to work in TEX Editor.

---> But, how do I recognize the type of compression the file is using ?
---> Too simple, In Glacier Tex Editor, There's in front of each texture its type of compression, it is whether DXT1 or DXT3. Keep that information in your mind, we will need it later, in the next step.


2. Modifying Texture Files:


Here, we will use GIMP as a graphic editor, to modify the texture extracted:

- Launch Gimp.

- Go To "File" menu.

- Choose the command "Open".

- Go to the folder where you exported the texture and select it.

- The following dialog will appear:

Posted Image

- Uncheck the "Load Mipmaps" Checkbox, then click on "Valider" (Sorry, but my GIMP copy is in French. So, instead of "Valider", you should have "OK" or "Validate")

- Now, you have the texture in the graphic editor. Make your modifications. For example, I painted the Silverballer texture with Golden color, so that I have a Golden Silverballer. Here's a preview:

Posted Image


3. Saving modifications:


We will continue with GIMP:

- Select "File" Menu.

- Select "Save as"

- Change your file's name but keep the extension as .DDS ( For example, my file's name is "Goldenballer" so I'll write "Goldenballer.dds)

- Click on "Save". A dialog will appear:

Posted Image

- Select the compression type of your file (the one we spoke about in the previous step), and check the "Generate Maps" Box. Here's a preview:

Posted Image

NOTE: Compression Type is not always DXT3. For the Silverballer, like in here, it is DXT3 but it can be DXT1 for other files.


4. Converting:


We're almost done. Now, we need DDS Converter 2 to convert the texture we modified with GIMP:

- Launch "DDS Converter 2".

- Look for the texture you modified, and, just select it.

- Click On Options, the following dialog will appear:

Posted Image

- In the DXTc format, check the type of compression the file is using (Like I said, Silverballer is using a DXT3 Compression. As you can see in the image above, I've selected DXT3. If you're modifying Silverballer too, do so :) )

- Check "Build Mipmaps" box and set "Number" to 8 (Just with the Silverballer)

- Click On "OK"

- Now, Click On "Convert", and your file is ready !


5. Importing:


This is the final step. Here we need "Glacier Tex Editor" :

I explained how to open the game files. If you forgot or you don't know how, click on spoiler:
Spoiler


- Select the original file you exported in the 1st step.

- Click on "Import"

- Select the texture you modified, then click on "Open".

- Now, click on Update ZIP, and wait until the program finishes updating.


And there you go, you can modify any DDS file you have in the game.

2 comments:

  1. hlp! i am getting sum linear size error while importing!

    ReplyDelete
  2. Check "Build Mipmaps" box and set "Number" to ? for minigun?

    ReplyDelete