How to create specular textures

You may come across some specular textures in games using the Quake3 engine. Here's an example in OpenArena 0.8.1:

It may look like an ordinary texture, but when you open it up in GIMP it looks nothing like ordinary. It may seem that it has just some lines, and the other parts are fully transparent, but it's not the case. If you click around with the color picker tool you will find out that the transparent parts have different colors.

So the specular textures are 100% covered textures, but how do you make them?

You start with the original texture which you want create the specular map to.

Duplicate the layer and make the duplicated layer greyscale (Colors -> Desaturate).

Now you may want to adjust the greyscale image so the bright parts have more highlight and the dark colors get closer to black. Do this by Colors -> Levels. On the upper bar pull the black and white triangles closer to each other and the grey triangle closer to the white (so it gets darker).

Create a Layer mask on the original (colored) layer (right click on it's preview image in the layer window) and make it Black (Full transparency).

Now go back to the greyscale layer, Select -> All, press Ctrl+C to copy the image. Now click on the black layer mask we created before and hit Ctrl+V to paste the image to the layer mask. Click outside the rectangle to fix the inserted layer. Finally you should make the greyscale layer invisible so you can see your final specular texture.

Don't forget to save it to TGA. The ioquake3 engine supports PNG too, but it requires more processing.

The texture may be fully functional, but with a shader file we can enhance it relying on it's alpha channel. Actually that's the reason we started the whole process. So here's a basic shader which can be applied to any specular textures:

First we take the lightmap which is applied to the texture. The rgbGen identity is compulsary with $lightmap. Than we multiply the destination colors (the pixels of the lightmap) with the alpha channel of the source (our specular texture).