Twisted Metal Black (PS2) .TEX

Textures, recreate headers, conversions, algorithms and parsing of image files
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Twisted Metal Black (PS2) .TEX

Post by Acewell »

looks like some Allen level PS2 shuffling in these samples. :D
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Twisted Metal Black (PS2) .TEX

Post by episoder »

doesn't look like a lot of shuffling beyond ps2_swizzle and palette thingies, but those are multiple files in it. i dunno how to extract/save all of those at once. if it does it, it could be done in noesis, perhaps. ;)

Image
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Acewell wrote:looks like some Allen level PS2 shuffling in these samples. :D


Noticed that too. Hopefully he can figure this one out.. Been awhile and it is quite a popular format with PS2.

Yeah hopefully it can be done Episoder. I wish i knew more about graphic formats or even writing scripts I would try it myself.
Acewell
Posts: 706
Joined: Fri Aug 08, 2014 1:06 am

Re: Twisted Metal Black (PS2) .TEX

Post by Acewell »

yeah i think its more than just PS2 swizzle though, i can't get some unscrambled in Console Texture Explorer.
there is a mix of formats in the samples, some paletted some not, the bgra data is easily recognizable.
there is 240 bytes of metadata preceeding the 128 byte headers for the lookup table and then another for
the palette if there is a palette.
figuring out all the flags in the headers to parse the contents properly is the biggest hurdle here i think. :shock:
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Are the flags just colors indexes ? And if there is away to decipher where one texture stops and ends that could help? I really cant see graphic formats as well as I can 3D. I have done a few though.
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Twisted Metal Black (PS2) .TEX

Post by episoder »

yep. there's a 240 byte archive header. the surface header (128 bytes) starts with 0x20 0r 0x40 on 16 color palettes. followed by a hex how many kbytes the surface is. plain surface has 0x08 at 0x0E, palettes have 0x88 there. i'm certain the width and height are somehow 'encoded' in the offset 0x10 and 0x1C values of the surface header. if you math this 16 bit minus 6 you get a somewhat usable binary values. for example on the 16 bit palette you get 4 x 4 which represents 16 colors. will looks some more into this.

it's still easily readable, if you wanna have a manual go at it. ;)
Image
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Thanks! I think we can figure this out. Your much closer than I ever got I could never get mine to show anything but swizzle.
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Image

Some more research
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Twisted Metal Black (PS2) .TEX

Post by episoder »

research? you tryna find tools? well it's incomplete but works kinda. no support for rgb or rgba textures. darkpla2.tex has one. no dice. it may or not crash on files that have them and fall apart. some textures like the car shadows look screwed up, but i couldn't find a better solution to fix the aspect ratios or general format bits. i dunno what else is wrong there.

feel free to modify if you figure out how it works. it's not rocket science. :mrgreen:
Allen
Posts: 156
Joined: Tue Sep 01, 2015 9:44 am

Re: Twisted Metal Black (PS2) .TEX

Post by Allen »

..
Last edited by Allen on Sun Jan 24, 2021 6:41 am, edited 2 times in total.
episoder
Posts: 123
Joined: Fri Oct 27, 2017 7:36 pm

Re: Twisted Metal Black (PS2) .TEX

Post by episoder »

questionable. or just your interpretation. the palette flag is not always set. irrelevant due to hunk signature tho. there's no reliable way to compute the size of the chunk either. nor is there an indicator whether or not the index is swizzled. it could be raw index. i don't have that switch either tho. just an assumption it's always swizzled, while the 4 bit index is not. bit of luck the data comes out. but whatever... yeh :D

btw i know that alpha thing. i never correct it tho. i don't mess up raw data. i could loose information this way.
Allen
Posts: 156
Joined: Tue Sep 01, 2015 9:44 am

Re: Twisted Metal Black (PS2) .TEX

Post by Allen »

..
Last edited by Allen on Sun Jan 24, 2021 6:42 am, edited 2 times in total.
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Is this a python file or a script ?
Allen
Posts: 156
Joined: Tue Sep 01, 2015 9:44 am

Re: Twisted Metal Black (PS2) .TEX

Post by Allen »

DJ Normality wrote:Is this a python file or a script ?

Episoder has posted a Noesis script that can extract 8bpp and 4bpp images, most of the images.
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

Ok but i really cant seem to do this on my own based upon this picture which i saved before it was taken off.. Where do you find the Pallet Offsets. And what does the starting point look like for the image.
Image

Just a little more detail and I can figure it out I think. Every Twisted Metal PS1-PS2 uses .TEX so just trying to figure it out. The script dont work with the other versions of the game.
Allen
Posts: 156
Joined: Tue Sep 01, 2015 9:44 am

Re: Twisted Metal Black (PS2) .TEX

Post by Allen »

..
Last edited by Allen on Sun Jan 24, 2021 6:41 am, edited 1 time in total.
DJ Normality
Posts: 647
Joined: Tue Jul 24, 2018 8:52 am

Re: Twisted Metal Black (PS2) .TEX

Post by DJ Normality »

How do i use this to convert a texture ?