Important information: this site is currently scheduled to go offline indefinitely by end of the year.

How to convert Indexed TIM2 to Full Color

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

How to convert Indexed TIM2 to Full Color

Post by fatduck »

I try to convert indexed TIM2 to full Color bitmap image with alpha channel.
I 1st create a full color table array(RGBA) by looking at the end of the color table. Then get the index and write to full color pixel eg: colorArray[index].

But the result are not correct? What did I doing wrong?

Image
Image
You do not have the required permissions to view the files attached to this post.
jasmine
VIP member
VIP member
Posts: 77
Joined: Tue May 10, 2005 6:07 am
Been thanked: 1 time

Post by jasmine »

I'm glad to see someone trying to correct the mistakes that I had with that program. I really would like to see some apps come out for the game and graphics format. This information should tell you all that you need to know about the tim2 file format. Look in the tim2.h for the header specs.
You do not have the required permissions to view the files attached to this post.
PaK
ultra-n00b
Posts: 9
Joined: Tue May 29, 2007 12:43 pm
Been thanked: 1 time

Post by PaK »

I think that bmp has no standart support for 32bits bitmaps, only if you make your own version of bmp supporting it. I suposse that u know that converting 8bit image indexed with 32bit RGBA palette to 32bit RGBA image without palette, size will become four times greater, lossing the advantatge that image only use 256 colors.

If you only want visualice it well interlaced you can use XnView, Game Grafics Studio or Optix Image Studio for example, and export to the format you want to edit. Also there are batch converters for tim2.

But if you want to draw the texture in your own aplicattion you have to interlace the palette before calculate colorArray[index], this way:

divide the palette in blocks of 8 RGBA colors, and for every 4 blocks swap it

1 3
2 4

or what is the same, for every 32 RGBA colors swap

0, 1, 2, 3, 4, 5, 6, 7, 16, 17, 18, 19, 20, 21, 22, 23,
8, 9, 10, 11, 12, 13, 14, 15, 24, 25, 26, 27, 28, 29, 30, 31
PmData
beginner
Posts: 33
Joined: Mon Oct 30, 2006 6:56 pm
Location: France
Been thanked: 2 times
Contact:

Post by PmData »

Isn't your problem related to the fact that your TIM2 files have several palettes? Each palette being to be applied on a specific part of the texture. This is already the case for TIM files. You then use palette #0 for the left part, and palette #1 for the right part.
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Post by fatduck »

PmData, the files are 8bits RGBA indexed with only have 1 palette, the correct images above are from photoshop, it works for standard TIM2 but can't export!

And for the interlace stuff, I am really confused!
Is it like this:
for 8bits RGBA of 256 color palette, 256/8=32, so each block have 32 RGBA color?
for the palette samples here (start at 10040).

block[0,0]=color 01 01 01 80, block[0,1]=color 17 05 02 80
block[1,0]=color 05 08 0E 80, block[1,1]=color 1A 04 01 80

block[0,2]=color 04 0C 17 80, block[0,3]=color 29 00 10 80
block[1,2]=color 22 03 01 80, block[1,3]=color 10 10 11 80

block[0,4]=color 3B 04 04 80, block[0,5]=color 10 17 21 80
block[1,4]=color 10 16 1E 80, block[1,5]=color 3C 04 0E 80
..

now lookup:
colorAry[4] = block[0,4] = color 3B 04 04 80
colorAry[33] = block[1,2] = color 22 03 01 80

Am I correct?
You do not have the required permissions to view the files attached to this post.
PaK
ultra-n00b
Posts: 9
Joined: Tue May 29, 2007 12:43 pm
Been thanked: 1 time

Post by PaK »

Excuse my bad english xD

each block has 8 RGBA colors, then you have 32 blocks for the 256 color palette. Swap block 2 with 3, 6 with 7, and so..

then apply colorArray[index], and thats all. I think it will help you ; )
You do not have the required permissions to view the files attached to this post.
User avatar
Evin
ultra-veteran
ultra-veteran
Posts: 348
Joined: Sat Aug 05, 2006 2:04 pm
Location: Hungary
Has thanked: 2 times
Been thanked: 160 times
Contact:

Post by Evin »

So, it's somehow possible the dmc3-tm2 textures editing?
I want the modified textures put into the game.
I try 2 Photoshop plugin out, but not the best. (Tim2Format.8bi, tm2xFormat.8bi)
fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 94 times

Post by fatduck »

I don't think there is a ready-made tool out yets! That's what I start my own! It's not hard to convert indexed color to full color(I finally managed), but the other way round is difficult for a beginner like me!

And what's the different between tim2 and tim2x plugin!
User avatar
Evin
ultra-veteran
ultra-veteran
Posts: 348
Joined: Sat Aug 05, 2006 2:04 pm
Location: Hungary
Has thanked: 2 times
Been thanked: 160 times
Contact:

Post by Evin »

fatduck wrote:I don't think there is a ready-made tool out yets! That's what I start my own! It's not hard to convert indexed color to full color(I finally managed), but the other way round is difficult for a beginner like me!

And what's the different between tim2 and tim2x plugin!
Tim2 - Jasmine's plugin, cant' correct handle the alpha channel(if i modify the tim2 image, that is modify the alpha channel)
tim2x - this can not handle the alpha channel, but i can choose many settings by saving (mipmap, 4-32bit format, swizzle and more coding format) I think this is an official plugin, because in the setting window, i see a "Sony" text. But this plugin is created in 2001.
You do not have the required permissions to view the files attached to this post.
ChrisSquareFan
advanced
Posts: 59
Joined: Tue Aug 10, 2010 2:09 pm
Been thanked: 1 time

Re: How to convert Indexed TIM2 to Full Color

Post by ChrisSquareFan »

can anyone help me? i used this swapping trick but i still get errors like so:
texture5.png
You do not have the required permissions to view the files attached to this post.
shadowmoy
veteran
Posts: 153
Joined: Sat Feb 21, 2009 2:29 pm
Has thanked: 19 times
Been thanked: 43 times

Re: How to convert Indexed TIM2 to Full Color

Post by shadowmoy »

this may be a premultiplied rgb+a texture , first you need to extract the alpha chanel and rebuild the rgb colors then get the alpha mash to get a valid one...
_-=<(¯`·._.·[ CodeMan ]·._.·´¯)>=-_
ChrisSquareFan
advanced
Posts: 59
Joined: Tue Aug 10, 2010 2:09 pm
Been thanked: 1 time

Re: How to convert Indexed TIM2 to Full Color

Post by ChrisSquareFan »

can you explain in a little more detail please?
Post Reply