PDA

View Full Version : TGA and the alpha channel



06-27-2001, 05:42 AM
I need some help. I'm confused about targa files and the alpha channel. I know you can do some effects with them because of the transparency, but if somebody could please explain how these files are used. And if anybody knows any good sites that explain how to make a targa. Thanks.

Deiussum
06-27-2001, 09:45 AM
You can check http://www.wotsit.org to find a good document on the tga image format. Basically an alpha component can be used for things like transparency, as you said. You have to enable blending and use the right blend function (usually glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) works pretty well.) If you are using unsigned bytes for the colors (i.e. 0-255) then 255 means fully opaque, 0 means fully transparent, and anything in between will cause blending to make it look semi-transparent. I know people have posted routines for loading TGA files here in the past so you can do a search for code.

So far as programs that can save TGA files, there are a few. I use the Gimp, which is a Linux program that has a Windows port. You can grab the Windows version here. (http://user.sgic.fi/~tml/gimp/win32/) There are other programs I've heard that can export TGA such as Paint Shop Pro. Photoshop doesn't export TGA files, though.

Frumpy
06-27-2001, 11:40 AM
The official Targa file format is here
ftp://ftp.truevision.com/pub/TGA.File.Format.Spec

Photoshop v5.x can save Targa files in 24 and 32bpp format. Choose File|SaveACopy... and select Targa.

[This message has been edited by Frumpy (edited 06-27-2001).]

TheDD
06-27-2001, 01:37 PM
I don't think Paint Shop Pro can export 32 bpp tga files, only 24... sorry. http://www.opengl.org/discussion_boards/ubb/frown.gif

TheDD

Deiussum
06-28-2001, 05:10 AM
Oops... that's right. Photoshop can export TGA. I was thinking of the PPM and PGM files that I had to use for a graphics class. Photoshop wasn't able to export to those formats, and THAT is what I had gotten the Gimp for. http://www.opengl.org/discussion_boards/ubb/smile.gif

BTW, the Gimp isn't a bad little app for graphics. It's got some interesting things for creating images.

DFrey
06-28-2001, 06:14 AM
Paint Shop Pro most definately can save 32 bit TGA files. That's all I use. It's just a little confusing how it deals with alpha. (You make a mask image for the alpha channel and then save it to the alpha channel of the texture image and then save the file as tga. Why it doesn't use layers for alpha I'll never understand.) http://www.opengl.org/discussion_boards/ubb/biggrin.gif


[This message has been edited by DFrey (edited 06-28-2001).]

Rob The Bloke
06-28-2001, 10:43 AM
Photoshop supports 8,16,24,&32bit tga's
Gimp is NOT a good image package. Having had to use it for three years now on unix, it has some interesting 'features', but I'd call them bugs.....

PhotoShop anyday....

Leyder Dylan
06-28-2001, 12:43 PM
Hi,

On my site, I've a little example who use the alpha chanel with TGA file.
http://ibelgique.ifrance.com/Slug-Production

"Download" section.

Deiussum
06-29-2001, 04:57 AM
Heheh. One of the things I like about the gimp is some of the scripting stuff. I used some of the "terrain" scripts for making a quick and dirty planet texture once. I prefer Photoshop for most things, though.