The Alpha Channel
From GameStudio Wiki
Contents |
Introduction
Hello everyone. Lately the questions "how do i add some transparency to my model" or "my transparent TGA is not showing up" became quite a lot in the forums, so I decided to make this tut for everyone to see how it is done properly. Due to the fact that i own only PSP, everyone is invited to complete this tut section with a GIMP, Photoshop etc. tutorial.
Paint Shop Pro Tutorial
The aim of this tutorial is how to create transparent/semi-transparent areas from an existing image. I will introduce two ways which i mainly use.
Simple Masking
First, load your Image into PSP. See that the background which we want to have transparent is plain white. It could be plain black as well, i will refer to that later.
go to masks-->new-->from a picture...
A dialogue box appears. If you want to set all WHITE areas to fully transparent, select "create mask from opposite values". If you want to set all BLACK areas to fully transparent, don't check this box. In our case, the BG is 255³, so we check it.
Huh, what happened to our picture?
This is normal, PSP uses the checker-like background to show transparency. What did we do? all White areas have been converted to a full transparency, all other values were set to a semi-transpareny due to their RGB components, the mor a colour is near to 0³, the more untransparent it will become (or, it you chose a black background, the other way round). Go to "proceeding" in this tutorial if you want to set up the alpha channel this way.
Threshold Method
Another method whic is better for sharp edges is what i call the threshold method. It is based on the threshold colour key. Load your image into PSP. select colours--> colour settings--> threshold.
Adjust the value to your needs. the black/white behaviour is similar to the method i described above.
make a mask and save it.
go to "Proceeding".
Proceeding
However you decided, you have to save your mask as a FILE.
Close your image-in-work, do NOT save changes. (this is the easiest way, or hit "redo" until you are at the very beginning).
Re-open your TGA.
go to masks-->open file...
The image should become as transparent as before.
Click masks-->save as Alpha Channel.
A Dialogue Box appears. All transparent areas are BLACK (no matter what you chose before), all others WHITE/GREY.
Save it.
Now hit one time REDO to change the picture to its original appearence, without any transparency. Your alpha channel will be saved, but if you do not do it, PSP will interprete all transparent areas as shades of white and you will have a picture that is much brighter that the original one. Save yor picture as 32 bit uncompressed TGA.
Hope this helped a lil. --DaBro0zar 16:45, 16 June 2006 (CEST)
Adobe PhotoShop Tutotial
Based on Adobe Photoshop 6.0
This will be as simple as i can make it.
Step:1 Select an image you want to make transparent. I have chosen a plant with no background at all. Maybe a bit to simple.
Step:2 Set up your window to show the CHANNEL window as well.
This window should now be showing.
Step:3 Now select the wand and select the parts of the image you DO NOT want transparent. Change the tolerance to your likings as you go. The selection should start to show a dotted out line around the parts.
Step:4 Now goto the CHANNEL window and select the CREATE NEW CHANNEL ,as seen marked with an arrow, You should now see a new black image appear with your selection in the background outlined
Image shown in black channel
Step:5 Next goto IMAGE menu and choose INVERT.
Step:6 You should now see the following.
Step:7 Next select the LAYER menu and choose FLATTEN image.
Step:8 Choose file and save as, Then choose the tga format and there you go a image with a alpha channel.
Gimp
Cut Method
Using Gimp to create alpha channels can be done in a few ways. I'll try and explain two of them and mention on other ways.
Step 1: Launch gimp, open your texture that you want to have an alpha channel.
Step 2: Select LAYER from the menu, scroll down and select TRANSPARENCY, then select ADD ALPHA CHANNEL.
Step 3: We will now select the areas we want to get rid/make transparent. To do this select the magic wand as seen in the image as number 1 and select the areas, OR you can choose the eraser marked by the number 2 on the image and erase the areas you want.
You can also do it by going back to step 2 and select add color to transparency and a few other options in there but i won't cover them here as the wand and eraser are the best way to go i figure.
Step 4: Select the areas as i stated in the step 3 seen here in the image.
Step 5: Now that the areas are highlighted you must go to the EDIT button at the top and select CUT and or CLEAR, this will get rid of the colors/areas you chose.
you should now have an image looking like the one below or simular, I never fined tuned this image as its just here as an example, As you can see there are still some areas that could be cut out.
Step 6: Once you have everything you want cut away got to the FILE menu and select the SAVE AS button.
Step 7: A new menu will pop up once you select the SAVE AS button.
Step 7.a - 1 = the name of you texture your going to save it as
7.b - 2 = folder your saving it in
7.c - 3 = Select file type so a new menu drops down and then select TGA shown as number 4 in the image.
7.d - 5 = save image.
Image in milkshape showing the alpha channel working, minus the small details that i never bothered to take out to make it a perfect texture
Greyscale Method
Welcome back. this tut will deal with advanced methods of alpha channel creation in GIMP. You will see mainly screens from the german GIMP version, but i will translate the most important things. This is the picture we are working on:
a right click in the "layers" dialogue will bring up this menu:
Select "add layer mask".
In the dialogue box, select "greyscale copy". if you want the white areas to apear transparent, select "invert mask", otherwise all black areas will show up more transparent. Let's have a look at the result:
--DaBro0zar 00:47, 7 March 2007 (CET)
Selection Method
We use the same image as in the method above. Select the wand tool, click all white areas (means the areas you want to mask out). Take care your feather ("ausblenden") value is between 2 and 4. A right click on the selection will bring up the dialog box shown below:
In the dialogue box, define a value that suits the resolution of your image:
a right click in the "layers" dialugue will bring up this context menu, select "add layer mask"...
Select "selection" and "invert", now all selected areas will be masked out:
This is the final result:





































