Users browsing this thread: 1 Guest(s)
Switch BNTX research
#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:


Messages In This Thread
Switch BNTX research - by gdkchan - 07-21-2017, 09:59 PM
RE: Switch BNTX research - by Random Talking Bush - 07-22-2017, 09:41 AM
RE: Switch BNTX research - by gdkchan - 07-22-2017, 08:28 PM
RE: Switch BNTX research - by Random Talking Bush - 07-23-2017, 09:06 AM
RE: Switch BNTX research - by gdkchan - 07-23-2017, 11:57 PM
RE: Switch BNTX research - by aboood40091 - 08-18-2017, 12:23 PM
RE: Switch BNTX research - by gdkchan - 08-19-2017, 02:09 PM
RE: Switch BNTX research - by aboood40091 - 09-21-2017, 09:03 PM
RE: Switch BNTX research - by gdkchan - 07-24-2017, 10:22 PM
RE: Switch BNTX research - by KillzXGaming - 07-26-2017, 11:15 AM
RE: Switch BNTX research - by Random Talking Bush - 07-26-2017, 11:39 AM
RE: Switch BNTX research - by KillzXGaming - 07-26-2017, 12:15 PM
RE: Switch BNTX research - by gdkchan - 07-26-2017, 01:10 PM
RE: Switch BNTX research - by gdkchan - 07-27-2017, 10:50 AM
RE: Switch BNTX research - by aboood40091 - 07-26-2017, 03:23 PM
RE: Switch BNTX research - by gdkchan - 07-26-2017, 10:37 PM
RE: Switch BNTX research - by Random Talking Bush - 08-05-2017, 01:48 AM
RE: Switch BNTX research - by gdkchan - 08-05-2017, 08:20 AM
RE: Switch BNTX research - by Rich - 09-19-2017, 09:33 AM

Forum Jump: