Window opacity - grayscale Alpha in GIMP?

Discussion in 'Car Modding' started by MileSeven, Mar 4, 2022.

  1. MileSeven

    MileSeven Registered

    Joined:
    Apr 1, 2014
    Messages:
    652
    Likes Received:
    256
    Banging my head on this one - Googled until I’m blue in the face but still can’t comfortably solve this…

    So my understanding is that to achieve realistic windows with *some* opacity, I need to apply a grayscale alpha channel instead of pure black (representing 0% opacity)?

    If so, I can’t for the life of me work out how to do this in GIMP - can anyone help?

    (I’m comfortable, generally, with skinning in GIMP).

    Thanks.
     
  2. ThomasJohansen

    ThomasJohansen Registered

    Joined:
    Dec 27, 2019
    Messages:
    956
    Likes Received:
    2,191
    Unfortunately Gimp's DDS plugin/support is limited, and doesnt support latest DDS formats.
    I usually end up exporting to transparent png and runs it through paint.net or Compressonator to export it as BC7 dds format.

    Udklip2.PNG
     
    Last edited: Mar 4, 2022
  3. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,008
    Likes Received:
    2,875
    I don't use Gimp, but maybe THIS can help you out.
    And full black is full Transparency.
     
  4. ThomasJohansen

    ThomasJohansen Registered

    Joined:
    Dec 27, 2019
    Messages:
    956
    Likes Received:
    2,191
    I use Gimp and works for the most part.
    - create a transparent picture.
    - Add a layer, color it ( like RGB 87,109,100 for greenblueish)
    - Change layer tranparency to 16-17%
    - Export to png.
    - open in paint.net
    - export to dds
    - choose BC7
     
  5. Coutie

    Coutie Moderator Staff Member

    Joined:
    Oct 5, 2010
    Messages:
    3,782
    Likes Received:
    2,243
    If you save it as a tga, you can use the texture converter that comes with rf2.
     
  6. MileSeven

    MileSeven Registered

    Joined:
    Apr 1, 2014
    Messages:
    652
    Likes Received:
    256
    Thanks - I’ll take a look (but would still love to know how to add a greyscale alpha in GIMP)
     
  7. redapg

    redapg Registered

    Joined:
    Jan 16, 2012
    Messages:
    4,008
    Likes Received:
    2,875
    Gilles Benoit likes this.
  8. svictor

    svictor Registered

    Joined:
    Jan 20, 2019
    Messages:
    935
    Likes Received:
    6,344
    Same as ThomasJohansen said:
    1. Add a "new layer" in GIMP
    2. Move this new layer to the bottom so they don't cover any part of your livery
    3. Fill this new layer with a color you like for the tint glass
    4. Change opacity % of this layer
    5. Export as TGA format
    6. Then use 397 Mapconverter (requires proper naming convention), or other tools to convert it to DDS BC7.
     
  9. MileSeven

    MileSeven Registered

    Joined:
    Apr 1, 2014
    Messages:
    652
    Likes Received:
    256
    @redapg - sadly, not quite. I had actually found that page myself. It might be a gap in my understanding of alpha channels, but the tutorial doesn’t (appear to me) to address how to change the level of transparency (which I understood from the PS world to involve a grayscale alpha mask).

    @svictor - thanks, I will check that out.
     
  10. FuNK!

    FuNK! Registered

    Joined:
    May 26, 2013
    Messages:
    626
    Likes Received:
    491
    May I chime in with a full GIMP approach here!? Due to lack of time, it's just a text tutorial and just one of at least two workflows I know of:
    1. Paint/create the window texture (could be multiple layers in or outside of a group)
    2. Paint/create the alpha texture (same as window texture: can be multiple layers in or outside of a group)
    3. Disable the visibility of the alpha (here groups are the most practical thing because it's just one click).
    4. Make sure all window texture is visible and the way you want it. Now right-click on any layer or go to the "Layer" menu and click on "New from Visible". Move that new layer to the very top or into a new image/project (for ease of use).
    5. Now make the alpha texture visible again, make sure it's not covered by the newly created layer or any other window texture layer. Again, create "New from Visible" and either put the layer to the very top or copy/move it to the new image/project you started (see step 4).
    6. Right-click on the window texture layer or select the layer and go to the "Layer" > "Mask" menu and click on "Add Layer Masks...". Chose to initialize the mask with "White (full opacity)" option (tbh, it doesn't really matter what you select here but let's keep it simple). You should see a little white box right next to the layer preview. This is the mask preview.
    7. Select the alpha texture layer. Press CTRL + A or click "All" from the "Select" menu. Now copy the texture to the clipboard with CTRL + C or click "Copy" from the "Edit" menu.
    8. Select the window texture layer again and do a single left-click on the previously created mask preview (the small box should have a white frame now to show it's active). Now paste the alpha texture from clipboard by either pressing CTRL + V or click "Paste" from the "Edit" menu. You should see a "Floating Selection". Right-click on that or open the "Layer" menu and click on "Anchor Layer". This will basically paste the copied alpha texture to the mask of your window texture.
    9. To export this layer as a dds texture with alpha, make sure it is selected and open the "Files" menu, select "Export As..", rename the file (don't miss to change the extension to ".dds") and select the location where you want to save it, and press "Export". In the "Export as DDS" dialogue just set the compression to "BC3 / DXT5" and mipmaps to "Gnerate mipmaps". Finally click on "Export".
    10. To verify the exported texture is correct, you can just open the file with GIMP again. It should have transparency according to the alpha you created before.
    Please note that you get the best results and avoid any issues beforehand if you work with separate files. So pasting the created single-layer window texture and single-layer alpha texture into a new file/project and only do the merging of layers and masks there.

    If the exported texture does not have the alpha channel or you believe the result looks wrong, you can always apply the layer mask before exporting the texture. Therefore simply right-click on the layer mask and click on "Apply Layer Mask".

    Hope this is of any help ;)

    PS: I can confirm this workflow works with GIMP 2.10.24 and GIMP 2.99.11 (dev version).
     
    Gilles Benoit and MileSeven like this.
  11. ThomasJohansen

    ThomasJohansen Registered

    Joined:
    Dec 27, 2019
    Messages:
    956
    Likes Received:
    2,191
    just tried @FuNK!'s guide, it works too.

    Udklip2.PNG
     
    FuNK! likes this.
  12. ThomasJohansen

    ThomasJohansen Registered

    Joined:
    Dec 27, 2019
    Messages:
    956
    Likes Received:
    2,191
    here is also a good video on it.goto 11:16
     
    Last edited: Mar 6, 2022
  13. MileSeven

    MileSeven Registered

    Joined:
    Apr 1, 2014
    Messages:
    652
    Likes Received:
    256
    Thanks guys - I’ll give it all a go later.
     
  14. MileSeven

    MileSeven Registered

    Joined:
    Apr 1, 2014
    Messages:
    652
    Likes Received:
    256
    Thanks @FuNK! - your method certainly seems to work. I might knock up a quick visual guide to add to this thread too.
     
    FuNK! likes this.

Share This Page