Perfare / AssetStudio

AssetStudio is a tool for exploring, extracting and exporting assets and assetbundles.
MIT License
12.87k stars 2.49k forks source link

Broken PS5 textures #1095

Open yunylz opened 1 year ago

yunylz commented 1 year ago

Hello, in the screenshot, I've tried opening bundles from Just Dance 2023 on PS5. Some song bundles seem to have broken texture format. Is there a solution for this? image cover2x.zip

Nazosan commented 1 year ago

This is a swizzled texture. I think Unity now defaults to swizzling textures for console releases as I see more and more games have it (I'm looking mostly at Switch releases, but I think it's all modern consoles.) Though curiously I see mixed swizzled and unswizzled textures in most releases. (I assume the unswizzled textures are ones the devs manually unclicked a checkbox on or something, but I don't really know otherwise why it's such an eclectic mixture.)

Unfortunately, there doesn't really seem to be a reliable way to unswizzle textures at this time, but the only thing I know of that ever produced usable results is rawtex on raw exported textures which doesn't support many newer texture formats and seems to work with less and less even of the formats it does support (like this) -- I just get almost empty files with a few squares in a corner from most now. You can try your luck with it though. Just make sure to export raw, not a conversion.

Just as a side note, in all the games I've tried so far, they did seem to accept replacing the swizzled textures with unswizzled textures. In theory this may come at a tiny performance cost, but it wasn't any difference I could see in those I tried it on. In some cases there may be a PC version of the same game you can access the same textures from to get unswizzled textures from. If you are only extracting it's best to extract from a PC version from now on probably. If you mean to mod, any games that come in both could potentially have the textures extracted from the PC version, modified as needed, then replaced in the console version.

I really hope someday UnityAssetStudio may support unswizzling textures swizzled for the major consoles.

ds5678 commented 1 year ago

I don't want to step on Perfare's toes too much, but he's been gone for 7 months. If a sufficiently large and diverse set of console game files is collected, I may implement deswizzling into AssetRipper.

Nazosan commented 1 year ago

Do you mean you need a list of games? I can definitely point out a bunch of Switch games with swizzled textures -- many of which have multiple console ports that likely are swizzled on each. However, I think at this point practically any game that comes out using Unity will have swizzled textures on consoles, so just about anything in the past year or so probably. The biggest thing IMO is just to watch out for a variety of texture types. Besides the obvious like DXT1 and 5, there are some like ASTC some games use to reduce size considerably (yeah, I know ASTC sucks, but it works I guess) and textures not necessarily in power of 2 sizes (some are not even even numbers...) I can dig through my games (will have to reextract a few and I'm not sure which is which) for good examples if that is what you're saying you need.

nesrak1 commented 1 year ago

As I've said before, I have working code for switch texture unswizzling which is tested to be working for RGBA, DXT, and ASTC. I can make a PR for it here and in AssetRipper soon when I have time.

As for PS5, we figured out the pattern for unswizzling by hand but don't have any program written for it or really any other samples to test with.