LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Get your graphics formats figures out here! Got details for others? Post here!
Post Reply
User avatar
Miles2345
advanced
Posts: 40
Joined: Sun Sep 07, 2014 10:24 pm
Has thanked: 6 times
Been thanked: 4 times

LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Miles2345 » Sun Apr 15, 2018 7:49 pm

Hey, been doing some work on a tool for LBP games and I ran into a brick wall when I looked into the format for its textures. Seems that the console games used variants of DDS (LBP 1 straight up using DDS files compressed with zlib) while LBP 2 and LBP 3 have DDS files without the headers, which are manually loaded in via the header of the compressed file (see below).. Both are easy to figure out, simple DXT1 and DXT5 dds textures which my tool can read no problem.

However, I'm personally unfamiliar with PS Vita texture files, but I believe they're stored as such:
http://www.vitadevwiki.com/index.php?title=GXT

Here's a few samples.

http://puu.sh/A3OUU.tex - doodle_lbp1tree.tex (Would be DXT5 if it were a DDS, 128x128)
http://puu.sh/A3P8h.tex - susan_icon.tex (Equivalent to DXT5, 128x128)
http://puu.sh/A3P2N.tex - tree_bark_diffuse.tex (Equivalent to DXT1, 256x256)
http://puu.sh/A3P57.tex - velvet_cushion_diffuse.tex (Equivalent to DXT1, 256x256)

Here's where I determined the above information..
Image
The format here in the compressed data is exactly the same as LBP 2/3, aside from the magic number, which differs by 1 byte. The above information can be used to extract the raw dds file data (same structure as a dds but without a header), however here it is swizzled when viewed in a program like TextureFinder, which leads me to believe it's some form of GXT.
The compressed data is kept in chunks up to 32KiB each when decompressed, and put in sequential order, labeled by the count of zlib chunks. If there is more than one chunk, it's indexed with repeated entries of the green+yellow labeled bytes in that image.

Adding a GXT header to the raw, uncompressed data (http://puu.sh/A3PC1.gxt) and converting it with this tool: https://github.com/xdanieldzd/GXTConvert results in something like this...
Image

Also, in some of these files, there's extra added information in the header and I have no idea what it is. Files with the extra data have a magic number of "GXTS" rather than "GXTs."
Image
Seems the 10 is referring to the number of bytes that come after that 0x10000000, but I don't think it's relevant to actually extracting the texture (unsure)

Can anyone with maybe a little knowledge of Vita file texture formats help me out with some information on this file format, or GXT stuff in general? I haven't entered the Vita scene beyond this game.
"O for a Muse of fire, that would ascend the brightest heaven of invention"

User avatar
Acewell
VIP member
VIP member
Posts: 1240
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2387 times
Been thanked: 717 times

Re: LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Acewell » Mon Apr 16, 2018 1:53 am

i'm not entirely sure what your questions is because you seem to have this thing figured out. :D
here is susan_icon.tex with a gxt header prepended to the image based on your findings and links
susan_icon.png
i decompressed the data with offzip and used this header then opened with Noesis :D

Code: Select all

47 58 54 00 03 00 00 10 01 00 00 00 40 00 00 00
80 55 00 00 00 00 00 00 00 00 00 00 00 00 00 00
40 00 00 00 80 55 00 00 FF FF FF FF 00 00 00 00 
00 00 00 00 00 00 00 87 80 00 80 00 01 00 00 00
You do not have the required permissions to view the files attached to this post.

User avatar
Miles2345
advanced
Posts: 40
Joined: Sun Sep 07, 2014 10:24 pm
Has thanked: 6 times
Been thanked: 4 times

Re: LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Miles2345 » Mon Apr 16, 2018 2:52 am

My main issue was figuring out the correct GXT header setup for these textures, as I'm unfamiliar with the format. Thank you!

What about the DXT1 equivalents?

ALSO, for the hell of it is there any way to convert back to GXT, perhaps from DDS? Not a huge priority but it's something I'd like to add to my tool down the line if possible.
"O for a Muse of fire, that would ascend the brightest heaven of invention"

User avatar
Acewell
VIP member
VIP member
Posts: 1240
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2387 times
Been thanked: 717 times

Re: LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Acewell » Mon Apr 16, 2018 3:13 am

tree_bark_diffuse.tex :D
tree_bark_diffuse.png
header used

Code: Select all

47 58 54 00 03 00 00 10 01 00 00 00 40 00 00 00 
00 AB 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
40 00 00 00 00 AB 00 00 FF FF FF FF 00 00 00 00
00 00 00 00 00 00 00 85 00 01 00 01 01 00 00 00
could probably make a bms script to decompress the chunks and build a gxt header for these easily. :D
You do not have the required permissions to view the files attached to this post.

User avatar
Acewell
VIP member
VIP member
Posts: 1240
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2387 times
Been thanked: 717 times

Re: LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Acewell » Wed Apr 18, 2018 3:32 pm

here is Noesis python script to open your 4 tex samples :D
tex_LittleBigPlanet_PSVita_tex.zip
supports dxt1 and dxt5
the script will decompress the chunks on the fly and build a gxt header.
You do not have the required permissions to view the files attached to this post.

User avatar
Miles2345
advanced
Posts: 40
Joined: Sun Sep 07, 2014 10:24 pm
Has thanked: 6 times
Been thanked: 4 times

Re: LittleBigPlanet PlayStation Vita .tex (GXT, PVR?)

Post by Miles2345 » Wed Apr 18, 2018 6:43 pm

Oh I wasn't expecting that at all - thank you so much! I'm trying to learn a bit about writing noesis plugins so this helps me out a ton.
"O for a Muse of fire, that would ascend the brightest heaven of invention"

Post Reply