View Single Post
Old 4th July 2007, 04:34 PM   #11
Junior Member
Junior member
Join Date: Jul 2007
Posts: 9
Default Re: Suggestions / TGA Bug / RealFlight G3.x (KEX) support

Ok, it's not that I give up easily. Indeed I found that TGAs provided with RealFlight load ok in AC3D. Then I loaded such a file in PaintShopPro 10 and just saved it again. This file showed the same blueish tint etc. in AC3D while other applications displayed it correctly. I did a hex compare of both file versions then.

The original TGA working with AC3D starts like this:
00 00 02 00 00 00 00 00 00 00 00 00 00 04 00 04 20 08 xx yy zz

The files stored by PaintShopPro 10 start like this:
01 00 02 00 00 00 00 00 00 00 00 00 00 04 00 04 20 08 00 xx yy

There are two differences: the file stored by PSPX starts with a 1 instead of a 0 and it has an additional 0 after this header.

Now I patched my own TGA by changing the first byte to a zero and deleting the zero after the header and voilą: it's displayed correctly in AC3D.

Now I did some research on the TGA header and found this:

typedef struct
byte identsize; // size of ID field that follows 18 byte header (0 usually)
byte colourmaptype; // type of colour map 0=none, 1=has palette
byte imagetype; // type of image 0=none,1=indexed,2=rgb,3=grey,+8=rle packed
short colourmapstart; // first colour map entry in palette
short colourmaplength; // number of colours in palette
byte colourmapbits; // number of bits per palette entry 15,16,24,32
short xstart; // image x origin
short ystart; // image y origin
short width; // image width in pixels
short height; // image height in pixels
byte bits; // image bits per pixel 8,16,24,32
byte descriptor; // image descriptor bits (vh flip bits)
// pixel data follows header


So obviously the TGA files stored with PSPX are correct: they have a 1 byte ident that's 0. And quite obviously my (newest) version of AC3D can't cope with that. It seems to ignore the ID size and use the ID byte as first image byte. Thus alpha channel and color channels get messed.

Last edited by 0xdeadbeef; 4th July 2007 at 04:44 PM.
0xdeadbeef is offline   Reply With Quote