Editing ui icon equipment.dds

From Mod Wiki

Jump to: navigation, search

Here you will learn how to add the equipment mini image of your new weapon or item to the game so it appears properly in your inventory. You need to do this if you have a completely new item that you modeled or if you retextured an item, you would want to retexture the inventory icon of it as well.

Required tools

Either of the following tools will work. It depends mainly on which program you like most.

Note that Photoshop adds a black background to DDS images. This probably makes it more difficult to preserve the alpha channel. GIMP allows working on transparent background, so you might want to try it, if you get stuck with Photoshop.

If you need to merge several ui_icon_equipment textures, there is a tool that can help you.

Getting Started

We will skip past all the gamedata folder setup and assume you know how mod structure works and to back up your files before working in them and use a working folder etc. The file you need is located in gamedata\textures\ui and called ui_icon_equipment.dds.

Before we do anything we need to set up a grid because the units the game counts by to find an image to display on this blue print is very specific. Since I am using Photoshop the tutorial will be geared towards it. If you are using GIMP or something similar, refer to a tutorial to find how to set up a grid. Go up top left and click Edit, go down to Preferences, and select Guides, Grid & slices. Set grid style and color to anything you want, and set gridline every: 50 : pixels, and set subdivisions to 1. Now click up top View - Show - Grid. There you have it, a grid in which to work with.

How the Grid Works

In every weapon .ltx file, you can see this:

inv_grid_width  = 2
inv_grid_height = 1
inv_grid_x      = 16
inv_grid_y      = 8

These four lines exactly refer to this file, and the numbers count boxes to find the image. You don't need advanced geometry to figure this out, just a few basic principles are needed. X refers to across or horizontal, think of it as the base line. Y refers to vertical units or up and down. When the game counts the units, each grid box is a unit, and you always end a box BEFORE the item. The numbers above come from the binoculars. If you would like to take the time to count horizontally in the picture from the left side of the image to the binoculars to understand, go ahead. It counts how many boxes come before the first one containing the binocular, NOT including the binoculars. Then the Y grid does the same thing, only going down.

The grid width and height are very simple, this just says how long (width) or how many boxes your image takes up across and how high (height) or how many boxes it takes up going vertical. The binoculars take up two boxes on X and one box on Y.

Placing your image

Once you understand how it works it doesn't need much more explaining. Pick an empty area somewhere on this image and make sure your image fits in exactly the amount of boxes you say it does. You don't want to waste space unnecessarily, so try to find a good corner where your item doesn't block more space than needed. Also pay attention to weapons on the left side of your item. Weapons that can have silencers attached may use more fields than the image actually shows, so it may be better to leave one field empty on the right ride of a gun. Then define where it is located (Remember HOW it counts the boxes) and how many boxes it takes up, in your weapon.ltx file.

Creating Alpha Channel

Once you've got everything in place where you want it on the .dds, take one of the lasso tools (polygon/magnetic work well, but the regular lasso tool can work better with rounded images if you've got a smooth hand) and take that lasso tool and select/wrap the lasso around the image you want, what ever is inside the lasso/selection when you make both ends connect, is what your going to have the game load up from the .dds. So it's up to you if you want it sloppy or not.

Now right click your selection you made with the lasso, and click "Save selection" and save the selection, as the same document, and choose your alpha channel, and select "Add to channel". Congratulations, you now have a working equipment file.

Saving Format

  1. Save Format: DXT5 (Interpolated Alpha)
  2. MIP maps: No MIP maps
Personal tools