Please or Register to create posts and topics.

[TUTO] How to create the alpha channel in Paint.Net

Hi everyone!

I decided to turn a pm to JoeyGuy917 into a public post in the case that someone needs help with the alpha channel and is working already on (or would like to give it a try to) Paint.Net...

Download it here. It's free!!

OK, so I'll let you know a couple of ways to have an alpha channel on your texture using Paint.Net.

First off I must say that I am aware that Photoshop is by far a better program, and when it comes to the alpha channel creation is really easy and straight forward, but I still prefer working with Paint.Net myself. Indeed I've discovered a few terrible bugs that PS has, like some "ghost images" that may appear when working on transparent backgrounds... >.<

It's been some time working with Paint.Net before achieving a good alpha channel for my textures. There are multiple ways to achieve the same thing and many methods, but I'll focus into just 2, which depending on the case, you can choose to apply. I'll be assuming that you have at least the basic knowledge of Paint.Net and about working with layers. However, do not hesitate to ask whatever you don't understand, ok?

Also, I'm assuming you already have all required programs for editting and making your custom textures. Let me briefly tell you the basic ones at least:

- VTFEdit
- GCFScape

You'll also need a handy plugin pack that is very complete. Grab it here and install it.

OK, so let's get to the point. The alpha channel acts as some sort of "map" to tell the game about the brightness/transparency of the pixels in your texture. In general, the game uses it to make certain parts of the textures (or models' textures) to glow in the dark (if the parameter "selfillum" "1" is included into the VMT file), which is pretty awesome, or only to define the brightness amount of each pixel (or texel, to be precise). Always remember that the black colour, when creating the alpha channel, means zero brightness, while white will mean full brightness... but let's go step by step.

I'll take as example one of the textures of the cube, "metal_box.VTF". First you should do is to use VTFEdit to export (Ctrl+E) the texture to a .JPG image to work with it. This is what we've got:

metal_box.vtf

Spoiler
Sorry, only logged-in users can see spoilers.

You can easily open this texture on Paint.Net and work with it. Go creating layers here and there and modify what you want until you are satisfied.

If you open a .VTF texture into VTFEdit and go to/click on "View > Mask" you can turn the view between the "whole" texture or the alpha channel alone. Well, this is what we see in the alpha channel:

Image

From that image we can know what has been decided to be spotted on the cube model. that blue circle. You can see how the rest of the texture seems transparent, while this circle is still noticeable. You can also check how the black parts completely disappear in the alpha channel (unless we invert it ;)).

This will make that circle to glow in dark in-game, BUT ONLY IF:

1. The shader UnlitGeneric is the one declared into the .VMT material file of your texture.
2. The .VMT file for that texture has the parameter "selfillum" "1" in.

------------------------------
How can you make this?
------------------------------

1. FIRST METHOD: "Alpha Transform" adjustment.

- Open your texture (metal_box.JPG I mean) into Paint.Net.
- Now simply go to your "Adjustments" menu and click on "Alpha Transform"
- You'll see this window:

Image

That is what by default you would get. As you can see, not only the circle is watchable, but also many other parts on the texture. If you try this version for instance into Portal2, you'll see how the cube model will be much brighter than usual, but since it has the parameter selfillum 1, not just that, you'll see it way too spotted and weird. So we can tweak the default values a bit to get something closer to VALVe's alpha channel:

- As you move the upper level value to the right, you can check how the texture starts to disappear a bit more little by little; the blue circle remains though a bit more until more or less a value of around 70; let's set it to for example 50. We'll have this:

Image

Well, this is the closest you'll get by using this method :p

(In order to save your texture properly in VTF format including the alpha channel, read below... after the 2 methods have been explained)

2. SECOND METHOD: "Alpha Mask" effect.

- Once you open your texture, go to "Effects > Alpha Mask" (it must be right there, not inside any effects category).
- You'll see this window:

Image
(It looks like the first time we used the "Alpha Transform" adjustment, right?)

- This effect is really powerful once you know how to use it. Mainly, it is good for defining in advance an alpha channel and then import it via this effect by browsing a previously saved Mask File. So we should have this mask file already prepared in advance. Usually you'll want a .PNG file, which can store the transparency pixels (this effect cannot read .TGA files :p)

- Let's try to use as example the .PNG version of the metal_box.VTF texture (export it from VTFEdit but to .PNG this time). Before importing the mask file, since it will contain all information we need and since what this effect does is to mix what you have already in screen with the alpha content of that mask file, we should first do one important step: use the previous adjustment "Alpha Transform" again and this time set the upper value up to 100 until you see the whole texture transparent. This will prepare the texture for the mask file to be imported and implemented.
You'll have this:

Image

- And now, let's use the Alpha Mask plugin to import as the Mask File the image metal_box.PNG. You'll have the following:

Image

As you can see there is not a single difference at all to what we first had when using the Alpha Transform adjustment above on the "First Method" section, right? well, then let's make a new mask file, our own one ;)

- The first thing we must know is what exactly do we want in the alpha channel and what not. Let's say for example that I only want the blue circle spotted and glowing in the dark, and the rest of the texture completely normal (or "non self-illuminated"). We should make a transparent layer containing only that circle, ok? This is how you can do so:

- Use the "Ellipse Select" tool to round the outter edge of the blue circle (if you hold down the Shift key you'll be able to make a perfect circle, instead of an ellipse), like so:

Image

- Now cut it (Ctrl+X)
- Make a new layer
- Paste it on the new layer (Ctrl+V)
- You should have this:

Image

- Now let's take away that inner grey circle from the second layer to isolate the blue circle. Just use the Ellipse Select tool again and this time select the inner edge of the blue circle, which is the same as the outter edge of the grey circle :p
- Now cut it from the second layer where it is currently, and paste it back to the first layer we had. You should have this:

Main Layer:________________Second Layer:
Image Image

- Now you can save the file as PDN (Paint Dot Net file format) in order to have all your layers you just made. This way we can work with it later ;)

- Now let's just leave as active the second layer, and save it as .PNG. When doing this, it will ask you to "Flatten" all layers (not .PNG format or .JPG can store several layers, so you should always flatten them), say yes.

- And now that we made our own Mask File, let's try again to use the Alpha Mask effect but importing our recently saved .PNG (I simply called mine "metal_box_alpha.PNG"). Open the "metal_box.JPG" texture. Remember to first use the "Alpha Transform" adjustment with the upper value set to 100 as explained before to make the texture completely transparent.

- Now go to "Effects > Alpha Mask" and click on "browse" to locate the .PNG file you just created and to use it as the Mask File. You should have this:

Image

Now THIS is closer to what we were looking for, right? :D

There is a variety of ways to add/substract transparency on certain areas of your texture, to make transparency gradients and so on to get the exact amount of brightness for every pixel of your texture (for more complex model textures) but I won't get into that now :p

3. HOW TO SAVE YOUR .VTF TEXTURE + THE ALPHA CHANNEL

- Well, first of all you should already have this plugin to be able to load/save .VTF format files. Be careful because so far it only works on the v3.5.11 of Paint.Net, not with the latest ones, ok?

- Just Ctrl+Shift+S to "Save as..." (or go to the "File Menu > Save As..."), and choose the VTF format from the drop-down menu. Also select as template the "Compressed Texture with Alpha" one, like so:

Image

- Now remember to always choose v7.5 at the "Advanced" tab before you click on OK to save it (it's set by default to v7.2).

If you now check out your new VTF texture into VTFEdit and you turn the alpha mask on-off (View > Mask), you should see your full texture and also the alpha channel as we created it.

I hope all this is clear enough. Do not hesitate to ask me for whatever thing it isn't ;)

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

Putting a reply here so it's marked for future reference. Great post jose! :thumbup: I think there's a lot of people who will find this useful. I haven't tried this in the past, but now that I know how, I think I may just start trying it! :lol:

ImageImage

Thanks mate! :thumbup:

srs bsnss wrote:
now that I know how, I think I may just start trying it!

I'm glad to hear that! I hope you do! ;)

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

Think I might have to get a copy of Paint.Net just to try this out.. I normally use GiMP for stuff like this....

I've edited the post to include the download link for Paint.Net (how didn't I think about it!? >.<). Remember to get yourself the version 3.5.11, not the 4.0 beta.

The best is that this program is free ;)

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]

Bumping this again just to say a huge thanks to jose! Thanks to you, I've been able to make my own BTS signage, which is a huge help for story-driven maps (and ordinary ones too) :thumbup:

Speaking of which, I don't suppose anyone knows what font is used for factory signage?

ImageImage
Quote:
- Well, first of all you should already have this plugin to be able to load/save .VTF format files. Be careful because so far it only works on the v3.5.11 of Paint.Net, not with the latest ones, ok?

Do you have any other method in embedding the alpha channel to the vtf texture? I don't want to use that plug-in because I want to keep using the latest version of Paint.Net and I want to utilize the vtfedit's importing features. For example saving the layers from paint.net first to some other format and then importing them in vtfedit. I have tried tga format and dds format with poor success.

Thanks.

Yes, as you mentioned, the only way to achieve that without the plugin is to use an intermediate format capable of storing the alpha channel, and that one is .TGA. Indeed, I use this format a lot, mainly when I want a multi-framed VTF file which textures (frames) have an alpha channel.

You have to do all the process, including the alpha mask. Then just save it as TGA; I think that the format to use when saving is 32bits... try it. Once the TGA file created, you also saved the alpha channel.

Now, use VtfEdit to import your Tga file. For this, you have to use the Import feature (Ctrl+I) and browse for your TGA file and use the following settings:

-Normal format: DXT1
-Alpha format: DXT5 (this is important)

You should get it to work this way.

ImageImageImageImageImageuseful tools and stuff here on TWP :thumbup:
[spoiler]ImageImageImageImageImage[/spoiler]