|
|
|
|
|
|
|
|
| Links |
|
|
|
Authoring a Texture with Transparency/Translucency - By Raeven0 |
|
This tutorial was last updated on Jan 28, 2006.
The user must be familiar with making a material before he can attempt to make a translucent one. Let "translucent" and "transparent" be interchangeable as far as this tutorial is concerned. Both effects are created by the same process.
You'll need a good image editor for this. If you haven't bought Photoshop 7 (CS will work, but no one I know has it, so I can't cover it), get GIMP. It's both good and free.
All that is necessary to create translucency is to save our .TGA image with an alpha channel or alpha mask. This mask is a special layer of the image that controls how translucent the image is at each pixel.
If you're familiar with making alpha masks, then congratulations! You've finished this tutorial. Just save a 32-bit uncompressed TGA with an alpha mask, then compile it as any other texture. In the material's VMT file, make a new between "$basetexture" "some/image" and the closing brace, and enter "$translucent" 1.
For those who aren't so adept, what follows is a basic introduction to alpha-masking with your favorite image editors.
Once you've compiled the VTF from the TGA you create (the process of compilation is laid out here), the VMT must be modified to look like this:
// (contents of image.vmt)
"LightmappedGeneric"
{
"$basetexture" "rae/image"
"$translucent" 1
}
Directory:
Gimp 2
Photoshop 7
Photoshop CS2
GIMP 2
For full transparency on part of the image, let's start with a very simple picture:

We're gonna make all of the white go away, leaving us with a red message floating in space once we load up the texture in Hammer. I will go to the Select menu and choose By Colour because I want all of the white to be gone. I select the white by clicking on it, then I move to one of the other GIMP windows. There, I right-click the current layer and choose to Add Layer Mask. (If you do not have this window, then on the window with all the buttons, go to File, then Dialogues, then Layers.)

Because I selected the white, I can choose Selection in the box that pops up. I also check the Invert Mask box. I click OK and--I've got a whole new image!

This grey checkered area is the fully transparent alpha mask. I can now apply this new mask:

--then I can save (File --> Save As) the image as a TGA.
I compile that TGA as a normal texture and make a proper VMT for it. Thus:

Elation! But what if you want something like glass, i.e., not completely opaque, but not completely invisible either? Or, what if you want to edit the alpha mask to be transparent only in parts?
This time, I won't need to select any part of the image. I'll add an alpha mask without selecting anything. However, I will opt to initialise the layer mask to White, and I will not invert it.
This will cause the following square to appear:

I can select this square and edit it as a normal image. The brightness of the color I use determines the transparency of the mask: pure black (0 0 0) is fully transparent, and pure white is fully opaque.





Photoshop 7
Open your image. Find the window with Layers, Channels, and Paths tabs.
If the following padlock icon (outlined in green) appears, double-click the image (outlined in yellow) and click OK to unlock the layer.

Select your layer and click this icon, then follow the next steps:


You can now use the Brush Tool to paint translucency onto your image. Translucent parts will have a grey checkerboard under them, showing you how translucent they are:

You can also restrict the brush tool to certain areas to avoid painting parts of the image that you don't want to paint. This is done by selecting the area you want to paint (as, for instance, with the Magic Wand Tool) before clicking the Brush Tool Icon.
When you're satisfied with the alpha mask, save (File --> Save As) the image as a Targa with resolution 32 bits/pixel. Compile it as a normal texture and make a proper VMT (see the top of this tutorial) for it. Thus:

Photoshop CS2
BigBangQuint (the one who brought you the toon maps for CS:S: http://www.bigbangquint.com) sent in these images for CS2.
Open up your image. Find the Channels tab, and click this button on the bottom of it:

You will see a new channel named Alpha 1.

This is your alpha channel. Each pixel of this channel determines the translucency of that pixel on the texture. If a given pixel is black in the alpha channel, it will be invisible in-game; a white alpha pixel is fully opaque; and grey is partially transparent.

Having painted on the alpha channel, save your image and compile it.
[If you have Photoshop CS and would like to contribute to this tutorial, you know the drill.]
Still need help? Ask your questions in one of our HELP FORUMS
|
|
|
| Comments |
| Octavian - Jul 7, 2009 |
I have Corel Paint Shop Pro. Could you show me how to do it there?
|
| Th4X3 - Apr 9, 2009 |
Well i have got the same problem as shawn and darth. How does this work?
i thinh the whole tga kinda thing doesn't work......... did you guys figgured it out? help pleas......... |
| Joure - Aug 21, 2008 |
Well, what I do is I create the texture in photoshop, export it to a TGA, then import that into VTFEdit, and it saves allot of hastle.
I didn't get the photoshop plugin to work, so this is whats working for me. |
| Don - Jun 11, 2008 |
I have yet to get this to work, I dont have photoshop I only have Paintshop pro, gimp etc. I still cannot get a transparent texture to work.... All I get in the texture browser is a texture of pink and black checkerboards. I dont get it...
|
| Shawn - Jan 22, 2008 |
| I'm having the same problem as Darth. I have the .VTF plugin for photoshop and I even selected 'Compressed Texture with Alpha' from the drop down box of presets in the tool. Still, I have a white background =/ |
| RawMeat3000@gmail.com - Oct 25, 2007 |
| You don't need to have "$translucent" 1 in the vmf. All you need to do is follow this tutorial to the letter and you're home free. |
[2 extra comments]
|
|
|
|