PDA

View Full Version : Why TGA not BMP?



Questions Burner
11-08-2001, 05:16 AM
Why most people use TGA for textures not BMP.

Bob
11-08-2001, 05:22 AM
Not sure, but maybe because TGA's are slightly easier to load.

Keermalec
11-08-2001, 05:45 AM
Because TGA's can have a 4th colour channel (called an alpha channel) used for variable transparency with a single pass

ByteZero
11-08-2001, 06:39 AM
Here look at
http://cyberintel.multimania.com/1content/index.html

and go to gllesson4 they are loading and explain why they loading tga files

FoxDie
11-08-2001, 11:34 AM
BMP format has much not important varialbles
in the header.Also hasn't alpha channel.
It is very bad format.That is my opinion.

Questions Burner
11-08-2001, 06:54 PM
The alpha channel? Is it useful

Shag
11-08-2001, 07:59 PM
Alpha channels are used primarily for blending (transparant) polygons ... check out nehe.gamedev.net for some good tutorials

[This message has been edited by Shag (edited 11-08-2001).]

dmdrummond
11-09-2001, 02:28 AM
BMP's are a microsoft format. Not every graphics program on every OS support them, so the targa (TGA) format which is generally universal is used instead. This makes cross-platform-ing easier. A really nice file format is PNG. It contains alpha channels and compression. The spec is also pretty open, and you can download some of the design docs.

Bob
11-09-2001, 04:42 AM
>>BMP's are a microsoft format

If I remember correct, BMP's originally came from IBM, so they are not "some Microsoft stuff".

>>Not every graphics program on every OS support them

... nor does every graphics program on every OS support TGA or PNG. No format is supported by every program on every OS.

>>This makes cross-platform-ing easier

Generally you develop on a "main platform". If this is Windows, you create you images on this Windows machine. If you also support another OS, you use the same files, cause nothing stops you from loading your BMP's under Linux, MacOS(X), Solaris, and so on. So BMP's are as "cross-platform" as any other file format.

An by the way, even though BMP's does not directly support an alpha channel, it has support for 32-bit BGRA images, where the alpha channel is ignored ( = waste of space). This "waste-of-space alpha channel" can be used, by the user, to store an alpha channel, and still being able to view the image in most/all programs (that supports BMP's of course).

Spiral Man
11-09-2001, 07:34 AM
ok, first, you are confusing bitmaps and *.bmp files. a "bitmap" is a file that has an uncompressed map of all the bits in an image, but it is not a specific file format (more like a type of file format). a file that ends in *.bmp IS a microsoft proprietary format. maybe they didnt create it, but they have changed it many times.

unfortunately, microsoft isnt very good about documenting their formats, and if you want to be able to load it cross-platform, you have to write your own functions to load it (instead of the microsoft ones, which only work with windows). this would be fine, except it isnt well documented, there are several versions, and there doesnt seem to be anything in the header that tells you WHICH version of the file format the image is using. in the end its a pain to use.

as for a "waste of space alpha channel" if no programs use it, it is a waste of space, unless this person wants to write their own image editing software that lets you use the alpha channel.

for the lazy programmer, i would suggest using one of the image file libraries (libpng, libjpeg, etc). i, personally, like png, but thats just a personal preference. there does happen to be a library that will load a png directly into an openGL texture. you can find it here:
http://www.wyatt100.freeserve.co.uk/download.htm

im sure others exist for other file formats, but i happen to know about this one...

ET3D
11-10-2001, 02:35 AM
I think that most people use neither TGA nor BMP. Most people use some compressed format, unless they are careless (like NVIDIA with their demos) about wasting your bandwidth and disk space.

Questions Burner
11-10-2001, 07:01 AM
No, 3D Studio Max, OpenGL demos, 3D games all use TGA as texture images.

mikael_aronsson
11-10-2001, 11:31 AM
Both TGA and BMP can be compressed...

Bob
11-10-2001, 11:40 AM
>>No, 3D Studio Max, OpenGL demos, 3D games all use TGA as texture images.

Please explain what you mean by that. 3D Studio MAX can use more than just TGA's as textures. 3D games/demos can use any image format they like, whether they use OpenGL or not makes no difference.

ET3D
11-10-2001, 03:14 PM
Originally posted by mikael_aronsson:
Both TGA and BMP can be compressed...

But not nearly as efficiently as using JPEG or something like that. Sorry, it just bugs me because some 50MB demos could be under 10MB with minimal image quality loss.

Shag
11-10-2001, 05:01 PM
JPEG compression is ****!

why do ppl think that certain compression routines are better or worse than others? And as for stating that a demo could be reduced from 50 to 10 megs ..! erm excuse me while i laugh ...

V-man
11-10-2001, 07:37 PM
>>>JPEG compression is ****!<<<<

Im guessing you think that jpeg has a bad compression?

For 24 bpp or 32 bpp, it's quite good, maybe the best. You lose some quality however.

Bottom line, use what you want. TGA have nothing magical about them.

V-man

dorbie
11-11-2001, 01:07 AM
Everyone relax take a deep breath. When I last tried it was quite tricky to parse a BMP, I've writted a bmp loader, but made certain assumptions about the format being 24 bit, that made it easy, but BMPs are complex because they have gone through several revisions, so to support loading BMPs you need to support a slew of pixel depths and header stuff. On top of this I was on Windows and it was impossible even with MSDN to find any documentation on it.

Developers like something simple and quick to support, documented and hopefully with some code they can 'borrow', TGA probably fits that bill.

Compression is not always lossy, you can run length encode, or use something like LZ library, it's not that hard, the trouble is it makes reading the file more tricky and for some developers that's a negative. With compression it's essential to have a library to load the format unless it's REALLY simple like RLE, otherwise few people will bother. JPEG and PNG have source code available. JPEG can be very bad if you request high compression ratios but it's the creator's choice, you can get acceptable results by increasing the file size. Let's not have a jihad over compression algorithms.


[This message has been edited by dorbie (edited 11-11-2001).]

ET3D
11-11-2001, 02:24 PM
I didn't have problems with BMP. When you control the generation of BMP files, you don't get into problems with colour depths and such.

Regarding reducing demos from 50MB to 10MB, I'm being charitable here. Download a NVIDIA technology demo, compress the sound from WAV to MP3 and the textures from TGA to JPEG and you'll get something that's about 10th the size and should be hard to distinguish from the full size demo.

dorbie
11-11-2001, 09:19 PM
We're agreeing on the BMP issues. The reason I could assume that I had a 24 bit image was that I had control of it's creation.

marcus256
11-12-2001, 11:57 PM
There seems to many opinions about image formats, parsing and compression algorithms. I'm designing a new file format (O NO! NOT ANOTHER ONE! http://www.opengl.org/discussion_boards/ubb/wink.gif ), which tries to remedy alot of what has come up in this discussion. If you like to add your comments to it, go to the "Compressed Texture Format" thread under "Coding:Advanced". Note that the first few posts refer to a texture compression format (CTX), while the rest of the disucssion deals with an extended MEDIA archive format (MAR).

About compression... JPEG is lossy - but does a good job. Sometimes lossless compression is required/desired. RLE basically sucks. GIF uses a simple LZ compression method, it's better than RLE. PNG takes it a step further by doing some "data preparataion" (i.e. lazy-man high-pass filtering), which improves compression a bit. My proposed MAR file format does even better filtering, and uses the BZ2 compression library instead of PNG's ZLIB, which results in excellent compresison ratios.

dorbie
11-13-2001, 03:07 AM
Oh no!

one minor nit pick,
Gif uses LZW, not LZ.