ZenHAX

Free Game Research Forum | Official QuickBMS support | twitter @zenhax | SSL HTTPS://zenhax.com
It is currently Mon Jul 23, 2018 4:03 am

All times are UTC




Post new topic  Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sun Mar 18, 2018 1:06 am 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
Due to my recent frustrations with extracting textures from PhyreEngine-based games that use stock PhyreEngine asset format I've decided to make a Noesis script that parses the structure (at least important parts of it) and allows for viewing/extracting 2D textures.
Frustrations may get worse, as PhyreEngine got to the Switch.

Doesn't work with cubemaps and 3D textures but it may be possible to.
Based on ToCS II Acewell's script and it's pretty much done.

So far I've checked it work with:
[PC] SAO: Hollow Realization
[PC] Secret Ponchos
[PC] Trails of Cold Steel I/II (double checked with this)
[PC] Tokyo Xanadu eX+
[PC] Final Fantasy X HD - has PTextureCubeMap
[PC] Final Fantasy XII: The Zodiac Age - has PTextureCubeMap (in RGBA16F, no less!)
[PC] SAO: Re: Hollow Fragment - has PTexture3D
[PC] Secret of Mana Remake - has "atlas maps"
[PS3] OreImo Happy enD - one sample; these samples might be from the same game
[PS3] Super Heroine Chronicle - one sample
[PS3] Unnamed title from this thread
[PSVita] Labyrinth of Refrain: Coven of Dusk - one sample
[PS4] Final Fantasy XII: The Zodiac Age
[PS4] Tokyo Xanadu eX+ (and this)
[PS4] 英雄伝説 閃の軌跡III (Trails of Cold Steel III)

Feedback and samples to work out kinks are appreciated.


Attachments:
File comment: 0.3 - Added GXM (PSVita) support via importing a complete GXT image present in Phyre structure.
tex_PhyreEngine_phyre.zip [3.4 KiB]
Downloaded 86 times


Last edited by TheUkrainianBard on Sun Jun 17, 2018 8:54 pm, edited 36 times in total.
Top
   
PostPosted: Sun Mar 18, 2018 12:16 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
Changelog:
Code:
0.3 - Added GXM (PSVita) support via importing a complete GXT image present in Phyre structure.
0.2.3+cubemaps - Added DXT/BC experimental cubemap support. Unlikely to keep it - too much effort to support.
0.2.3 - Added some comments and code cleanup.
0.2.2 - Additional checks/safeguards against models and shaders, code cleanup.
0.2.1 - Fixed *everything* (hopefully) GNM (PS4) by using GNF image header data inside Phyre structure.
0.2 - Dirty support for GNM (PS4) DXT1/3/5/ARGB8 textures via faking a GNF image header and importing.
0.1.5 - Dropped ".dds."/".png."/".bmp." file name requirement. Now it's just ".phyre" extension (SAO: Re: Hollow Fragment PC textures have no extension at all for ex).
0.1.4 - Added BC7 support (used in SAO: Re: Hollow Fragment PC for ex).
0.1.3 - Added Phyre structure read support for GNM (PS4) textures (cannot show them properly yet).
0.1.2 - Added BC5 (used in FFXII Zodiac Age normals for ex) and A8 support and a safeguard against cubemaps.
0.1.1 - Code cleanup.
0.1 - Initial release.


Attachments:
File comment: Archive: 0.2.3+cubemaps - Added DXT/BC experimental cubemap support; unlikely to keep it - too much effort to support.
tex_PhyreEngine_phyre_cubemaps.zip [3.77 KiB]
Downloaded 55 times


Last edited by TheUkrainianBard on Tue May 01, 2018 12:21 pm, edited 19 times in total.
Top
   
PostPosted: Sun Mar 25, 2018 5:31 pm 

Joined: Wed Nov 15, 2017 1:54 pm
Posts: 21
SAO has lots of textures in BC7 format, so you might want to add support for that. I don't know if noesis can decode bc7 though.

Also if your script works with SAO, it should also work with the Secret of Mana remake on pc. You can add that to the list.


Top
   
PostPosted: Sun Mar 25, 2018 6:24 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
Thank you.
Noesis can decode BC7:
Code:
output = rapi.imageDecodeDXT(input, Width, Height, noesis.FOURCC_BC7)

Could you confirm it working with those SAO:HR BC7 textures and Secret of Mana remake?

The list is non-exhaustive but what I've personally confirmed working. Ideally this script should work with all PhyreEngine texture assets (at least on PC and PS3 for now).


Top
   
PostPosted: Sun Mar 25, 2018 6:45 pm 

Joined: Wed Nov 15, 2017 1:54 pm
Posts: 21
Too lazy to test it on files now, moved some of them to external hdd. I worked on both sao and secret of mana files and their structures are exactly the same. So it will work :D


Top
   
PostPosted: Tue Mar 27, 2018 4:29 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
I wonder if this is some sorta tiling taking place on PS4...
UPD: Well, I have extracted something somehow and those are GNF images


Attachments:
File comment: 3. Correct dimensions and vertical flip
(dxt5)imbg021.png [382.86 KiB]
Not downloaded yet
File comment: 2. Creating a GNF header inside Noesis script and importing it as .gnf
(dxt5)imbg021.dds.gnm.png [406.62 KiB]
Not downloaded yet
File comment: 1. Just using Morton order unswizzling
(dxt5)imbg021.dds.gnm.phyre.png [385.33 KiB]
Not downloaded yet


Last edited by TheUkrainianBard on Wed Apr 18, 2018 7:28 pm, edited 1 time in total.
Top
   
PostPosted: Thu Apr 05, 2018 4:11 pm 

Joined: Thu Apr 05, 2018 4:06 pm
Posts: 3
Thank you! Already solved my problem~


Attachments:
note_help000.dds.phyre.zip [314.06 KiB]
Downloaded 41 times
Top
   
PostPosted: Thu Apr 05, 2018 4:52 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
@klose_rinz
Hm, is that from PS4 re-release of Sen no Kiseki aka Sen no Kiseki Kai ?


Top
   
PostPosted: Fri Apr 06, 2018 3:57 pm 

Joined: Thu Apr 05, 2018 4:06 pm
Posts: 3
TheUkrainianBard wrote:
@klose_rinz
Hm, is that from PS4 re-release of Sen no Kiseki aka Sen no Kiseki Kai ?


It's from Tokyo Xanadu ex+. Sen no kiseki 3 and Sen no kiseki Kai are on 4.70+ version, and we cannot get the files.

Your code works well with the .dds.phyre file from this game.
But there are some problems when opening .png.phyre(ARGB8) files.

I change the code with the following, then I can get the picture, but the colors are not right.
You can view the vis_127 in the attachment. The left above of the picture is dark sky with nearly pure black color. But in the extracted picture, it's two different bandings with green and blue.
So I think the order of the color is not the problem, maybe there are some tricks in the pixels which are different from PS3 swizzling.

Code:
    if Platform == "GNM\x02":
        FakeGNF = FakeGNFHeader + data
        FakeGNF = rapi.loadTexByHandler(FakeGNF, ".gnf")
        FakeGNF.name = "test.gnf"
        data = rapi.imageGetTexRGBA(FakeGNF)
        try:
            if imgFmt == "ARGB8":
               if IsSwizzled == 1:
                  # data = rapi.imageFromMortonOrder(data, imgWidth, imgHeight, 4)
               data = rapi.imageDecodeRaw(data, imgWidth, imgHeight, "b8 g8 r8 a8")
            data = rapi.imageFlipRGBA32(data, imgWidth, imgHeight, 0, 1)
            texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, noesis.NOESISTEX_RGBA32))
        except:
            texList.append(FakeGNF)
    else:
        data = rapi.imageFlipRGBA32(data, imgWidth, imgHeight, 0, 1)
        texList.append(NoeTexture(rapi.getInputName(), imgWidth, imgHeight, data, noesis.NOESISTEX_RGBA32))

    return 1


Also, if I manually change IsSwizzled to 1, the code "data = rapi.imageFromMortonOrder(data, imgWidth, imgHeight, 4)" will get exception.


Attachments:
title.png.pc.png [3.68 MiB]
Not downloaded yet
vis127.pngout.png [3.69 MiB]
Not downloaded yet
title.png.zip [4 MiB]
Downloaded 39 times
Top
   
PostPosted: Fri Apr 06, 2018 6:41 pm 

Joined: Sun May 01, 2016 10:06 pm
Posts: 67
Yeah, that's the problem with having a very limited amount of samples. I didn't realise that phyre structure had all necessary GNF image data (I kinda did realise for GCM, but there was no real need to use them)...
Attached file is what I got after I've actually used that GNF image data.

I've updated the script in the first post.


Attachments:
title.png [3.65 MiB]
Not downloaded yet
Top
   
PostPosted: Sat Apr 07, 2018 6:54 pm 

Joined: Thu Apr 05, 2018 4:06 pm
Posts: 3
TheUkrainianBard wrote:
Yeah, that's the problem with having a very limited amount of samples. I didn't realise that phyre structure had all necessary GNF image data (I kinda did realise for GCM, but there was no real need to use them)...
Attached file is what I got after I've actually used that GNF image data.

I've updated the script in the first post.


Many thanks~


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 11 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited