HateTank@Posted: Tue Aug 17, 2004 3:37 am : Making an Alpha Channel (And making it work!)
You're gonna need a few things to do this, and since I don't know all the resources available to you, I'm gonna write this using the resources I have: Adobe Photoshop CS, Notepad and Doom3.
To give you a little information that will prove useful when making Alpha Channels in your textures, you need to know what it is an Alpha Channel does. Basically, it's a "Mask". It will hide certain parts of your image. You've seen this effect on the chain link fence, some vents, fan blades, etc.. These textures are made using the alpha channel to hide the spaces in between the links, the vents and the fan blades. Armed with this knowledge...
Let's get started:
1. Create a new image in Photoshop (128X128, RGB Color, Background Transparent).

2. Flood fill the image with Black.
3. Click on the Horizontal Text Tool (or press "T")
4. Set the font and size to anything you want, as long as it's not too big. Set the color of the text to white.
5. Rasterize the text layer and merge down (CTRL+E)

6. CTRL+Left Click (Load Selection) on the image "Layer 1" in the "Layers" tab. CTRL+C (copy) the image.
7. Click on the "Channels" Tab (next to "Layers"). Click the button "Create New Channel".

8. A new channel is created called "Alpha 1". Paste the image you copied into the Alpha 1 channel.
9. Save the file as "hi_d.tga" in "Doom3/base/textures/custom/decals/". PAY ATTENTION! You MUST have the "Alpha Channel" box checked before you click "Save". Name the file and save it as a 32 bit .TGA file! PAY ATTENTION! Photoshop will default the image to a 24 bit, which won't work. MUST be 32 bit.


10. Save the file again (in the same directory) as "hi_ed.tga". It doesn't have to be a 32 bit file this time, the default 24 bit is fine. This is so you can see the image in the Doom editor.
11. You CAN make height and spec maps if you want too, but that's covered somewhere else and I'm not adding 3000 more steps to do it for you

Close Photoshop.
12. Open Notepad.
13. Copy/Paste the following blurb into Notepad:
//----HI Decal Test
textures/custom/decals/hi
{
noShadows
nonsolid
noimpact
{
blend diffusemap
map textures/custom/decals/hi_d.tga
alphatest .1
}
qer_editorimage textures/custom/decals/hi_ed.tga
}
//----END HI TEST

(You can find out what each line item here means if you're really into it, but I'm not going to post it here. There's also a LOT of other line items you can add in here also, just like in any other material file, that adds movement, blending, etc. For this tutorial, I'm making it simple.)
14. Save the file as hi.mtr in the Doom3/base/materials folder. That's it!

You can now load up the editor and play around with the decal you made! To apply the decal, the only way I've played around with is by making a regular brush painted with caulk, then applying the texture to the visible face of the brush. This works well, and I don't know any other way of doing it

Please post revisions, questions or comments below!
ohnhai@Posted: Tue Aug 17, 2004 10:45 am : Cool tutorial...
Just to ad an artistic note to this…
As you can see in that last screen shot the “HI!” has a small black outline round the text.
This is caused by the fact that you have an exact copy of the mask in the RGB. When in game filtering smoothes the RGB (and alpha) out, this causes the edges to become blurry. Not a problem with the alpha but on the RGB this allows some of the black to be seen.
For single colour decals (as in the example) the solution is real easy. Once you have made your alpha go back and fill the RGB channels ( normal painting mode in PS) fully with that chosen colour.
For multi colour decals or when you have more than one thing on the texture, paint the details as you normally would but make sure the colour details extend out beyond what you are to reveal with the alpha by a couple of pixels. This way when filtering blurs the image no black will encroach into the masked area….
Another trick when creating alphas is to use 100% magenta (caulk pink) as a back ground. That way it becomes painfully obvious if you are suffering from background bleed….
Anyway that’s it for now.
RedWolf@Posted: Tue Aug 17, 2004 4:16 pm : HateTank wrote:
Quote:
(You can find out what each line item here means if you're really into it, but I'm not going to post it here. There's also a LOT of other line items you can add in here also, just like in any other material file, that adds movement, blending, etc. For this tutorial, I'm making it simple.)
Why not?

(I know probably already stated somewhere, I'll just have ta, hunt down the info.)

idiom@Posted: Wed Aug 18, 2004 8:31 am : How do you make textures with variable opacity?
der_ton@Posted: Wed Aug 18, 2004 10:48 am : idiom wrote:
How do you make textures with variable opacity?
That effect is not related to the texture (except for that the opacity is controlled by the alpha channel), but it's related to the material definition. You have to use something like "blend add" or "blend filter", but I don't know exactly. I'm sure you'll find out if you take note where you see something like that in the game (either in the map or on a monster) and take a look at the material definition.
Maybe you'll find some specific blendmode, like "blend gl_src_alpha, gl_one" (just one example of many possibilities). I'm not going to explain that here, there must be something about this stuff on this board or on the web. If you search and find something, please post a link.

idiom@Posted: Wed Aug 18, 2004 11:41 am : Hmm. Been experimenting a bit, haven't got it to work but I've looked at the .tga files used for the web decals in D3 and they don't seem to have alpha channels at all... They just fade to black so I guess that's what gives variable opacity textures the opacity information.
der_ton@Posted: Wed Aug 18, 2004 12:12 pm : Oh right, I forgot about that case. The color of these textures is simply added to the background when they are rendered. I think that's what "blend add" does. You don't need an alpha channel in that case. The black areas are totally transparent, and the rest of the colors brighten up the pixels they cover. You are alot more flexible when you have opacity that's controlled by the alpha, but this method is quite easy to handle.
idiom@Posted: Wed Aug 18, 2004 1:18 pm : w007, it works

Without the alphatest thingo too.
S14Y3R@Posted: Sun Feb 19, 2006 4:08 am : idiom wrote:
How do you make textures with variable opacity?
Hi, I don't know all the blends, but transparacy is controlled in the Alpha Channel. So if Black = see through, and White = Opaque, then 50% Grey is translucent(murky). Therefore a Black to White Gradient will "Fade off". Great for blood pools

Mordenkainen@Posted: Sun Feb 19, 2006 4:14 am : Way to go Necro!

Phluxus@Posted: Fri Feb 24, 2006 6:04 pm : ok i'm new at this stuff, so don't laugh.
first off all, i can't see the pictures of this tutorial, but i tried making transparent textures anyway.
i'm trying to make a portal with a alpha channel, so i don't have to do all the stuff with patches to make it work.
however i end up with a ieny mieny tiny mouse hole texture instead of a portal (512x512)
it seems that photoshop doesn't save the alpha channel in the diffuse tga when saving. if i save the tga, i can't mark the alpha channel thingie. perhaps this is the problem.
i use this script for the mtr file:
textures/medevilDaan/castlewallplasterdoor
{
noShadows
nonsolid
noimpact
{
blend diffusemap
map textures/medevilDaan/castlewallplasterdoor_d.tga
alphatest .1
}
qer_editorimage textures/medevilDaan/castlewallplasterdoor_ed.tga
diffusemap textures/medevilDaan/castlewallplasterdoor_d.tga
bumpmap textures/medevilDaan/castlewallplasterdoor_local.tga
}
please help!
Bittoman@Posted: Fri Feb 24, 2006 6:47 pm : The format for this should be:
Code:
textures/medevilDaan/castlewallplasterdoor
{
qer_editorimage textures/medevilDaan/castlewallplasterdoor_d.tga
noShadows
nonsolid
noimpact
{
blend diffusemap
map textures/medevilDaan/castlewallplasterdoor_d.tga
alphatest .5
}
{
blend bumpmap
map textures/medevilDaan/castlewallplasterdoor_local.tga
}
}
You chose a very very low value for seperating black and white so this may be reducing what's being drawn and what's being masked.
Note that alphatest determines where the line is drawn between black and white in a hard edged alpha masking (what you have here), the value of .5 will tell it anything above 50% grey will be treated as full white (drawn) and anything below 50% grey will be treated as full black (masked). Basically it tells it where the center point of the on and off switch is in the mask.
Also note that you tried to map the diffuse texture twice which isn't really necessary and that the normalmap (bumpmap, _local) is mapped in a seperate declaration. This doesn't need to be treated with alpha so the alphatest command isn't necessary.
Last, and this is just my personal preference, you don't really need a separate editor image, you can just use the diffuse texture as the editor image (unless you want to indicate something different or specific about this shader in the editor that might differentiate it from another using the same images). But again this is just my personal preference as it shaves off some bulk from the final pak file.
mikebart@Posted: Mon Feb 27, 2006 10:37 am : In photoshop 7, when I save my *.tga file the alpha channels tick box is grey'ed off so I lose my alpha channel.
Im definitly saving it as a 32-bit image
>~runaway~<@Posted: Mon Feb 27, 2006 11:19 am : The shots are not working but its not that bad.Tutorial is awesome.I was sitting hours by my alpha's.Now i can get it to work propertly.Thanx!
Phluxus@Posted: Mon Feb 27, 2006 1:41 pm : @Bittoman, ok thanx for help on script.
But i also have this problem, or is this not a problem at all?:
mikebart wrote:
In photoshop 7, when I save my *.tga file the alpha channels tick box is grey'ed off so I lose my alpha channel.
Im definitly saving it as a 32-bit image
desmasic@Posted: Mon Feb 27, 2006 5:51 pm : Phluxus wrote:
@Bittoman, ok thanx for help on script.
But i also have this problem, or is this not a problem at all?:
mikebart wrote:
In photoshop 7, when I save my *.tga file the alpha channels tick box is grey'ed off so I lose my alpha channel.
Im definitly saving it as a 32-bit image
Flatten layers. Since I am using CS, with greyed off he means not selected? Then it's not a problem (select RGB layer or alpha), just flatten image and save as 32-bit tga.
mikebart@Posted: Wed Mar 01, 2006 6:15 am : just did a google search about it, you need to download this plugin, I dont think its the same as the CS version, it makes thinks look a bit weird actually, but it seems to work ok
http://www.adobegolive.com/support/down ... ileID=1478
zigzulquit@Posted: Sun Jul 23, 2006 6:35 am : I'm using photoshop 4.0 I dont see a >create new channel button< next to the >layers tab< anywhere to make an Alpha 1 channel, what do I do then?
aphexjh@Posted: Mon May 18, 2009 2:04 am : der_ton wrote:
idiom wrote:
Maybe you'll find some specific blendmode, like "blend gl_src_alpha, gl_one" (just one example of many possibilities). I'm not going to explain that here, there must be something about this stuff on this board or on the web. If you search and find something, please post a link.

this makes me annoyed.
rich_is_bored@Posted: Mon May 18, 2009 4:23 am :