Users browsing this thread: 2 Guest(s)
Switch BNTX research
#16
(08-05-2017, 01:48 AM)Random Talking Bush Wrote: Found another unknown format in Splatoon 2, 0x3106, which seems to be ASTC-based. I sent it to you to check out at your own leisure.

It's ASTC 6x6 with SRGB color space. (ASTC 6x6 SRGB for short)

(07-23-2017, 11:57 PM)gdkchan Wrote: Thanks for the files. I managed to fix some stuff and discover what some of the unknowns means with them. Extraction of non power of 2 textures is still hit or miss unfortunately, I still didn't totally figured out how the swizzle works, but its better at least. Tomorrow I plan to work to fix the remaining swizzling issues.

About the unknown formats you sent me, I took a look on the last one, and it's using ASTC compression. Heres one of them decoded (tc_MiiSuit_39^w):
[Image: WL38pDz.png]

This compressed format is still not supported on my tool (and i'm not on the mood to write a ASTC decompressor :I but I will end up doing it sooner or later anyway).

It's always flipped for me:
[Image: qNvebxm.png]

Lastly, I want to report that your swizzle algorithm works with XTX files, the Switch's equivalent of the Wii U's GTX, as well! Good job!
Reply
Thanked by:
#17
(08-18-2017, 12:23 PM)aboood40091 Wrote: It's always flipped for me:
[Image: qNvebxm.png]

Lastly, I want to report that your swizzle algorithm works with XTX files, the Switch's equivalent of the Wii U's GTX, as well! Good job!

Yea, tgas are loaded upside-down because by default, TGA images are stored upside down (so first line is bottom, and last line is top). A bit on the TGA header controls this, when the bit is 1, the image is read normally (top to bottom), when its 0 it is read from bottom to top. The ARM ASTC tool seems to always write 0 to this bit, so its always loaded upside down. This value is located at position 0x11 on the TGA file, and the bit that controls this is the bit 5, so you can change the value from 0x00 to 0x20 to make it load properly.

To fix that you can change the line with "hdr.descriptor = 0;" in astc_stb_tga.cpp to "hdr.descriptor = TGA_DESCRIPTOR_YFLIP;".

Also just for completness, I found 2 other tools that can decode astc textures:
https://github.com/philiptaylor/oastc
https://github.com/GammaUNC/FasTC/blob/m...ressor.cpp

It's probably worth noting that they only support decoding, while the reference tool supports both encoding and decoding.

Also nice to know that it works with xtx (althrough this was expected since swizzling is a GPU access optimization, so all textures needs to use it, or not since I belive that linear addressing is also supported somehow). I don't know any game that uses this format tho, just out of curiosity which game uses it?
Reply
Thanked by:
#18
Hi gdkchan, good job at trying to unravel this tile addressing on your own!

I came across this thread while googling to see if anyone else had managed to make a BNTX loader yet, and I thought you might like to know that this is a well-documented tiling method called Block Linear tiling, or "BlockLinearGOB" as exposed in the latest release of Noesis. A complete description can be found in the Tegra X1 TRM, which is floating around online and freely accessible on nvidia's developer site. Each GoB (group of bytes) is 512 bytes, and from the looks of it, what your code is doing is effectively trying to compensate for different block heights.

The key bit for BNTX is that you need to respect the texture info's mip0 block height field (it is not always 4/16, some BNTX files explicitly use 0 to force a block height of 1), then you need to mimic the expected GPU behavior of fitting the block height to each mip above mip0. Noesis also has a BNTX loader in its latest release, which mimics the algorithm described in the TRM. So far it seems to load every BNTX I've been able to throw at it, but let me know if you come across anything that fails.

I just made this account here and will probably forget to check back, but feel free to message me if you have any questions!
Reply
#19
(08-19-2017, 02:09 PM)gdkchan Wrote: I don't know any game that uses this format tho, just out of curiosity which game uses it?
Ah, I don't know any either tbh. I just found some flying in the SDK and wanted to make an extractor for them.
Reply
Thanked by:


Forum Jump: