Half Life 2 Graphics and Alpha channels

Adobe Photoshop is the king of graphics programs… no contest, it is awesome.

Everything is so easy and other programs are always missing something that Photoshop has. Half Life 2 graphics use the VTF / VMT files all over the place, … Nem’s VTF Plugin for Adobe Photoshop and Paint Shop Pro made life very simple. Why use anything else?

Well Nem has done it again, he has a plugin for another graphics program, Paint.NET.

When you first look at Paint.NET you think… WOW it’s fairly good for free and then you start using it for making VTF files … OK for some stuff but making anything that requires transparency and it can drive you nuts! yank_icon.jpg

Why? When you make an item like a spray for CS Source or a Day of Defeat Source Player icon, you have to make it from a square or rectangular image that has a totally transparent area around the image and make the “seen” part of the image show through.

The Transparency, in the case of the image next to this text, the shield of the US 101st is slightly transparent with other parts of the 128 x 128 square image not shown. You need Alpha Channel support in your graphics program to make this happen!

It’s so easy to manipulate the Alpha channel in Photoshop, the layout is very visual and easy to change the way the Alpha channel affects the layers in a final image.

Paint.NET makes this difficult because of the way it handles the alpha channel. It lacks support at the moment. That will change in the future… don’t worry there are plug-ins to help.


Lets have a look at making the image above in different graphics programs and how the Alpha Channel can be your best friend… not a big pain in the butt.

I like Adobe Photoshop best because of the ease of use… dead simple. All you need is Nem’s VTF Plug-in and you’re all set.

Open a new image, the size for a normal Player icon is 64 x 64 but we will go with 128 x 128 image because of the extra detail required in the text and items like the eyes of the eagle. The image can be Transparent or a background, it matters not, the Alpha layer will take care of that latter.

The next thing to do is to grab an image of the 101st and manipulate it until you have it looking good, copy and paste into the new image you made, if the edges are blocky… use the blur filter to soften it a bit if you wish…
























The next bit is why Photoshop is best for making Transparent VTF’s.


Click on the Channels tab; notice the channels RGB, Red, Green and Blue. We need to add a Alpha channel, Click the “Create new channel” button (next to the trash bin icon) a new channel comes up, all black by default.


It’s the “colors” or to be more precise the level of Greyscale in this channel that will control what parts of the image will show through and how visible it will be…
























As you can see the image now has the new Alpha Channel and it is pure black. If I made a VTF file from this now, none of the 101st shield would show through, not a bit, it would be completely invisible!


That’s because black will block anything in the Layers tab, think of the Alpha channel as a gate that will allow things through it based on how white or grey it is … with black a complete lock. If the Alpha layer is white it lets things through 100%, if you make it a mid grey half way between black and white… 50 % will show through.


Using varying strengths of grayscale in different places of the image we can now control what parts of the shield will show through.


First hide the Alpha channel by clicking on the channel visibility button, (the small eye) now click on the RGB channel (where the “RGB” and small thumbnail image is) and click it’s visibility button.

Go back to the Layers tab, remember we positioned the shield image over a white or transparent background? With the Magic Wand tool, select all the parts of the image that are NOT the shield… in other words the background of the layers.


You can do this by clicking on the background once, then holding down the Shift and select the small arched area just below the “Airborne” text banner. But we don’t want the background, that part of the image is black.

We now need to reverse the selection so we have the area we want to show through… go to “Select” in the top menu and click on click on “Inverse”… now only the shield image is selected.


I did it this way because it is easy for the wand tool to select a clean background rather than all the complex shapes and colors in the shield… you could adjust the wand tool to do it on some images but selecting the simple parts of an image then inversing the selection most times is more efficient.


Now you have that selected you can go back to the Channels tab and select the Alpha Channel for editing. It’s the reverse of what we did before, deselect the RGB visibility, select the visibility of the Alpha Channel and click on the area of the Alpha 1 text and the small thumbnail image.


What you have now is the parts of the image that you want to show through, you can select white and fill that selected area and it will show through at 100%. We will select a grey here because Player icons are normally see through.


Select the color picker for the foreground color and choose a grey, it varies from image to image in this case a RGB 153 153 153 will suit because I want the shield image details to show through, (more opaque) quite strong… ones with less detail I may consider going further towards the darker gray’s …closer to black and more transparent.

















You can save it as a VTF now but one more thing to mention… an extra touch of class that gets over looked sometimes… a bit of blur on the Alpha Channel can get rid of some blocky edges in these small images. As you can see I have couple of things to fix…


alpha_101_4.gif alpha_101_5.gif


Giving the alpha layer a manual touch up and just a hint of blur makes a lot of difference sometimes… even if the image edges in the Layers tab looks a bit jagged this will also enable a smoother edge.

Now you may or may not know all about using the VTF plug-in but for this kind of image I use the following settings. “File” “Save as” select VTF and the filename will be “american” in this case for a US player icon VTF file.

Format … DXT5

Mipmap Filter … Box

Sharpen Filter … None

And… because it is a HUD image and should look the same on low video settings if the user so inclines, make sure you tick the Flags…

No Mipmap

No Level of Detail

Press OK, You are done. The result is a nice image that has varying degrees of transparency, with the help of the Alpha Layer and a few simple tricks.



Enter Amount

dodbits.com Copyright © 2011. All Rights Reserved.