NFSAddons Forums

Feb 22, 2024, 6:43 PM

Alpha channels with GIMP

This is a discussion for the topic Alpha channels with GIMP on the board NFS:HS Workshop.

Author Topic: Alpha channels with GIMP  (Read 35850 times)

5 Replies on Alpha channels with GIMP
on: Feb 13, 2012, 1:48 PM
Hero Member
Posts: 253 Joined: June 07, 2006

  • *****
Thanks to AJ_Lethal for this tutorial! I'll post it over here to make sure it won't get lost.
(download off-line tutorial here - click on the icon, then "download")

 NFSHS (and NFS3) car textures (car00.tga) do have something called "alpha channel", which tells the game what kind of colors are assignated for the car. To edit them, people usually has Photoshop or Paint Shop Pro to do the job, but if you are broke (and want to stay legal), there's a third way: GIMP.

 GIMP is basically the freeware alternative to Photoshop, with some interesting features. But when it comes to editing alpha channels, it could be a royal PITA to accomplish the task. Luckly, I figured it out and I'm going to tell you how to do it.

    Step 1: Meeting GIMP and asking her out
    The first time you fire up GIMP, it would look like this:

    • Toolbox: This is the place where are located the painting and selection tools, mostly. The foreground/background color selection is also in there.
    • Tool Options: Here you can adjust the selected tool parameters.
    • Layers/Channels/Paths Undo: Here you will see the images layers for edition. Were are going to focus only on the Layers and Undo (in case you screw up).
    • Brushes/Patterns/Gradients: IMO these are redundant, since they can be setted up from their respective tools. In fact, the only use I found for them was adding/editting brushes, but we won't make that kind of stuff in here right now.
    The toolbars can be customized to your liking, but we're going to use the default layout for this tutorial.

    Step 2: Let's put the channel together
    At this point, I will assume you will have your shiny new texture map ready for this. But you don't want to risk your precious job in case you screw up, right? Well, I packed a testing texture map file (test.bmp) attached to this tutorial in here.

     The map as you see, is weird (since it's a testing map, don't try to figure out it's sense, otherwise you will end up in a psych ward for the rest of your life)

     Alright, let's put our hands to work.

    • Go to File > Open (or Ctrl+O, if you regonize the keyboard as the supreme speed king) and look for the "test.bmp" file. Open it (duh).   Your GIMP screen will look like this:

    • Go to the the layers panel and right click the current layer we're working on (Background) and select "Add Layer Mask...". In the following dialog, under the "Initialize Layer Mask to:" section,  select "White (full opacity)"and hit OK. The layer window will change to this:

    The image thumbnail's clone next to the original image thumbnail's, is the mask layer. When you create (or import) one, GIMP will automatically switch to it, so you can start to work on it right away. When you work on the mask layer, the layer's thumbnail corresponding to the mask layer will have a white outline (well, currently we can't tell that at first glance since the mask is currently white, lol), and the same applies if you work on the image itself. Now click the image's thumbnail to work on the image, we need to select the areas for the colors.
    • Use the Fuzzy Select Tool (keyboard: U) and select the gray area with the white stripe (you can use the Free Select Tool -keyboard: F- as well, that's useful if you want to select a part of the image from its surroundings), well pretend this is the main body color. Now switch to the mask layer and click the foreground color in the toolbox. This dialog will pop-up:

    Write 224 on the R, G and B spaces, then hit OK. That shade of gray you will get is the alpha color for the main body color of the car (RGB: 224,224,224 / HSV: 0,0,88 / HTML:  E0E0E0). Your image will look like this:

    • Now, since I'm too damn lazy, I will let you finish the alpha channel; the parts remaining are:

    -White stripe: secondary body color (RGB: 96,96,96 / HSV: 0,0,38 / HTML:  606060)
    -Gray drops area: interior color (RGB: 160,160,160 / HSV: 0,0,63 / HTML:  a0a0a0)
    -Gray rectangle: driver's hair color (RGB: 32,32,32 / HSV: 0,0,13 / HTML:  202020)
    -Blue rectangle: anything you want transparent (RGB: 0,0,0 / HSV: 0,0,0 / HTML:  000000)

     You should have got something like this:

    Now let's proceed to the last step.

    Step 3: Saving the alpha (and the file)
    Now that we have the alpha ready, it's time to save it, alongside the file. Right-click the "Background" layer and select "Apply Layer Mask". Now the alpha will merge with the image. Then go to File > Save / Save As... (keyboard: Ctrl+S / Ctrl+Shift+S) and save it as car00.tga.

     A dialog will appear. Set it this way:

    And you're done. Is not that difficult, isn't?

    Additional notes
    If you want to edit an existng file's alpha channel, right-click the "Background" layer, select "Add Layer Mask", check the "Transfer Layer's Alpha Channel" option. Edit as you desire and save as described in Step 3.

    I hope this tutorial will be useful to you. AJ signing out.

    Reply #1
    on: Feb 14, 2012, 10:36 AM
    Hero Member
    Posts: 331 Joined: May 24, 2008

    • *****
    • Personal Text
      Stupid blunt claws.
    Step 3 fix: the origin should be "Bottom left", otherwise the texture will appear flipped in ZModeler.

    Reply #2
    on: Feb 17, 2012, 3:42 PM
    Hero Member
    Posts: 502 Joined: April 19, 2006

    • *****
    • Personal Text
      Dark Paladin
    Does it save in the "correct" NFS4 tga format? I remember PSP9 saved the file in a format that NFS4 could read correctly, but NFSWizard displayed the tga with a yellowish hue.

    Reply #3
    on: Feb 18, 2012, 7:44 AM
    Hero Member
    Posts: 331 Joined: May 24, 2008

    • *****
    • Personal Text
      Stupid blunt claws.

    Reply #4
    on: Aug 18, 2023, 12:34 PM
    Hero Member
    Posts: 331 Joined: May 24, 2008

    • *****
    • Personal Text
      Stupid blunt claws.
    Massive necrobump, but I updated the tutorial a time ago to include values for GIMP 2.10

    Reply #5
    on: Sep 02, 2023, 6:00 AM
    Sr. Member
    Posts: 72 Joined: December 01, 2020

    • ***

    In case you want to convert alpha channels between NFS3, NFSHS, and MCO, the above scripts are available. Includes documentation. Does not require GIMP or other huge installations.


    Support NFSAddons: