Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Persona 5 Model and Animation importer v0.8.1 - MaxScript -

Post questions about game models here, or help out others!
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Persona 5 Model and Animation importer v0.8.1 - MaxScript -

Post by TGE »

I'm sharing my mostly complete but still very much a WIP MaxScript (well, set of scripts) to load Persona 5's (and P4D) animations and models.

Progress log:
  • 13/10/2016: Version 0.8 released
    - Initial release
  • 14/10/2016: Version 0.8.1 released
    - Fixed typos, issues with declaration order and other oversights due to Max not clearing its own memory properly
    - Improved consistency between files
Features:
  • Proper loading of meshes and materials (additional info in the listener window)
  • Rigging is applied
  • Weapon, character and level models are supported and..
  • Level textures are converted from their custom format into DDS (this requires you to keep the original folder structure intact)
  • Partial animation support. For now it only loads the first animation in a .GAP file. Sometimes GMD files also contain animations but those will be skipped.
  • Some MaxScript code you might find useful if you're into developing scripts yourself
  • Also loads models from Persona 4 Dancing All Night, but does not yet support loading the faces (p5 doesn't use them)
Current issues:
  • Some models are displaced, and I cannot find the reason as to why. Be sure to check your models thoroughly! If you have any idea, please let me know.
  • Materials load properly but their parsing is mostly brute forced and can possibly break. Figuring these out has proven to be quite difficult. Again help would be appreciated.
  • Some models don't load because of embedded particles (most of the enemies in p5). I don't know how to parse these, so until then models containing these will not load.
  • Rare bug that causes garbage face data to appear, I'm not sure as to why this happens.
  • Due to use of FileIn to seperate code, the script will now no longer work when run in the editor (Evaluate All).
    In fact, it will completely corrupt 3ds Max's MaxScript memory. Thanks Autodesk
Important notes:
This script is developed for 3ds Max 2016. If you have any issues other than the ones listed above, please make sure you're using this version. I do not intend to support older versions of Max as anyone can get a free download of the latest one and quite a few MaxScript features are blatantly broken in them.
Oh yeah, please retain the folder structure, otherwise the script won't work. All files are needed.

Special Thanks
  • Atlus for finally (Winter 2014 *cough*) delivering Persona 5
  • Pan for the preload dump of p5
  • PolarSoda for his P4D script
  • mrdudesworkshop for his findings on the animation structure
Download I hope you enjoy these models as much as I enjoyed (and still do!) working on them.
Eventually I plan on putting custom models into the game, but until then my MaxScript will serve to help me reverse this format.

Cheers.

Image
You do not have the required permissions to view the files attached to this post.
Last edited by TGE on Fri Oct 14, 2016 4:06 pm, edited 2 times in total.
ssringo
veteran
Posts: 98
Joined: Sat Apr 19, 2014 8:02 am
Has thanked: 46 times
Been thanked: 13 times

Re: Persona 5 Model and Animation importer v0.8 - MaxScript

Post by ssringo »

Thanks for the release. I hope I can get this working but for now I'm getting an error in the script listener when I load a model (same for all character models)

GFSFileLoader.Load: Chunk 0x1 ver: 0x1105070 sz: 0x0 at 0x4L
GFSFileLoader.Load: GFS start marker chunk

GFSFileLoader.Load: Chunk 0x100fc ver: 0x1105070 sz: 0xb6c45 at 0x10L
GFSFileLoader.ReadTextureList: Loading 15 textures

GFSFileLoader.ReadTextureList: Texture "c0001_t01_face01b_low.dds" fmt 0x1 sz 0xaa80 off 0x45L
GFSFileLoader.ReadTextureList: Writing to E:\Modeling\Persona 5\JP0005-NPJB00769_00-HDDBOOTPERSONA05_bg_1_0682bac23263ecd6e3416c91188109072b9f503f\NPJB00769\USRDIR\model\character\0001\c0001_t01_face01b_low.dds

"-- Runtime error: Struct member access requires instance: CreateWriteableFileStream"

I just installed Max 2016 (thanks for that heads up btw) so it's possible I goofed something. That long ass folder structure was just me moving the files back into the extracted pkg folder to see if it needed to be there. Same error happened when I had the extracted cpk elsewhere.

Edit: I tried several models and all returned this error. It does load weapons and items but nothing from the character folder.
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by TGE »

Thanks for the report. I hopely have fixed the issues with the new revision. The download link has been updated.
ssringo
veteran
Posts: 98
Joined: Sat Apr 19, 2014 8:02 am
Has thanked: 46 times
Been thanked: 13 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by ssringo »

Yup. Ran several character models through and each seemed to load fine with correct textures, skeleton and weights. Will spend more time over the weekend playing around with stuff. Thanks for the quick update!
ssringo
veteran
Posts: 98
Joined: Sat Apr 19, 2014 8:02 am
Has thanked: 46 times
Been thanked: 13 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by ssringo »

So over the weekend I loaded and at least looked at each model in the character folder. Each character seemed to have one model that wouldn't load which I'm guessing has to do with the issue with embedded particles as you mentioned in the OP. That aside, everything seemed to be fine. Weights looked good (had to reparent a couple leg bones to get a single, working leg bone but that's not a script issue) and textures looked fine as well.

That aside, I do have an issue with something that I'm guessing has more to do with Max16 than your script. Exporting the models to .fbx, which should be a great format, screws up some of the UV maps. They are fine in Max and even exporting to other formats seems to keep the UV mapping correct. It's nothing major requiring massive work to fix manually, just a section or two would get separated from the main UV map and get placed somewhere else. Pretty much every model I exported had a small section on the top of their eyes out of place and a few places on the body/hair. An easy, but irritating fix. Dunno what the issue could be though.

Edit: Forgot to mention. Haven't been able to try out DLC costumes that aren't included in the main game. Haven't been able to get my hands on them.
liuxing
n00b
Posts: 15
Joined: Wed Apr 09, 2014 4:50 am

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by liuxing »

Thanks for the release. I hope I can get this working but for now I'm getting an error in the script listener when I load a model in character\enemy\

GFSFileLoader.ReadNode: Reading node at 0x1ed33eL
GFSFileLoader.ReadNode: Node "rot" hash: 0xe03ec02a attachmentCount: 0

GFSFileLoader.ReadNode: Reading node at 0x1ed37cL
GFSFileLoader.ReadNode: Node "Bip01" hash: 0x76946249 attachmentCount: 0

GFSFileLoader.ReadNode: Reading node at 0x1ed3bcL
GFSFileLoader.ReadNode: Node "Bip01 Footsteps" hash: 0xa714e2ba attachmentCount: 1

GFSFileLoader.ReadNode: Attachment #1 Type: 7
"0x1ed401L"
"-- Runtime error: GFSFileLoader.ReadNode: Can't handle this attachment type
"
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by TGE »

liuxing wrote:Thanks for the release. I hope I can get this working but for now I'm getting an error in the script listener when I load a model in character\enemy\

GFSFileLoader.ReadNode: Reading node at 0x1ed33eL
GFSFileLoader.ReadNode: Node "rot" hash: 0xe03ec02a attachmentCount: 0

GFSFileLoader.ReadNode: Reading node at 0x1ed37cL
GFSFileLoader.ReadNode: Node "Bip01" hash: 0x76946249 attachmentCount: 0

GFSFileLoader.ReadNode: Reading node at 0x1ed3bcL
GFSFileLoader.ReadNode: Node "Bip01 Footsteps" hash: 0xa714e2ba attachmentCount: 1

GFSFileLoader.ReadNode: Attachment #1 Type: 7
"0x1ed401L"
"-- Runtime error: GFSFileLoader.ReadNode: Can't handle this attachment type
"
Attachment type 7 is the type of the embedded particles, as pointed out by the OP those do not import yet.
ssringo wrote:So over the weekend I loaded and at least looked at each model in the character folder. Each character seemed to have one model that wouldn't load which I'm guessing has to do with the issue with embedded particles as you mentioned in the OP. That aside, everything seemed to be fine. Weights looked good (had to reparent a couple leg bones to get a single, working leg bone but that's not a script issue) and textures looked fine as well.

That aside, I do have an issue with something that I'm guessing has more to do with Max16 than your script. Exporting the models to .fbx, which should be a great format, screws up some of the UV maps. They are fine in Max and even exporting to other formats seems to keep the UV mapping correct. It's nothing major requiring massive work to fix manually, just a section or two would get separated from the main UV map and get placed somewhere else. Pretty much every model I exported had a small section on the top of their eyes out of place and a few places on the body/hair. An easy, but irritating fix. Dunno what the issue could be though.

Edit: Forgot to mention. Haven't been able to try out DLC costumes that aren't included in the main game. Haven't been able to get my hands on them.
Might have to do with the presence of multiple uv channels, not sure. I'd have to mess with that.
User avatar
takoyaki111
advanced
Posts: 48
Joined: Mon Oct 21, 2013 7:43 pm
Has thanked: 7 times
Been thanked: 3 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by takoyaki111 »

Seems like P5 models have messed up bone links, any chance for that getting worked on?
User avatar
lionheartuk
double-veteran
double-veteran
Posts: 749
Joined: Tue May 16, 2006 10:55 pm
Location: Everywhere
Has thanked: 34 times
Been thanked: 42 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by lionheartuk »

I still can't get the files extracted from the cpk archives honestly.

I' only get this error after a certain point in the extraction, it doesn't get to characters or environments, and ps3.cpk is just odd, the tool doesn't even notice there anything in it.
Image

PC is set to run things in Japanese if non-unicode, so I'm all out of ideas.

Running windows 10 to be clear.
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by TGE »

Rin wrote:Seems like P5 models have messed up bone links, any chance for that getting worked on?
There's nothing wrong with the bone links. You have to move both the limb and helper bone together to bend the limbs. They just used a weird IK setup.
User avatar
lionheartuk
double-veteran
double-veteran
Posts: 749
Joined: Tue May 16, 2006 10:55 pm
Location: Everywhere
Has thanked: 34 times
Been thanked: 42 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by lionheartuk »

Is anyone able to help with the CPK extraction error at all?
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by TGE »

lionheartuk wrote:Is anyone able to help with the CPK extraction error at all?
It might have to do with your system locale as neither me nor others seem to get the error you're seeing.
ssringo
veteran
Posts: 98
Joined: Sat Apr 19, 2014 8:02 am
Has thanked: 46 times
Been thanked: 13 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by ssringo »

lionheartuk wrote:Is anyone able to help with the CPK extraction error at all?
Did you get the game directly from PSN or did you torrent a modded version? Are you using some fan created/edited tool to extract the cpk files and if so, which one?

I can tell you that using the official files and tools straight from the source have no issues as far as extraction purposes go.

Edit: Don't see why your locale would cause issues. At least during the extraction process. If locale was an issue it should have given an error pretty much immediately. I mean, it's worth changing your locale to English (US) just to see.
User avatar
lionheartuk
double-veteran
double-veteran
Posts: 749
Joined: Tue May 16, 2006 10:55 pm
Location: Everywhere
Has thanked: 34 times
Been thanked: 42 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by lionheartuk »

ssringo wrote:
lionheartuk wrote:Is anyone able to help with the CPK extraction error at all?
Did you get the game directly from PSN or did you torrent a modded version? Are you using some fan created/edited tool to extract the cpk files and if so, which one?

I can tell you that using the official files and tools straight from the source have no issues as far as extraction purposes go.

Edit: Don't see why your locale would cause issues. At least during the extraction process. If locale was an issue it should have given an error pretty much immediately. I mean, it's worth changing your locale to English (US) just to see.
My Locale is already set to Eng US on this machine so its not that.

I'm using the tool TGE linked me in the previous thread.
One thing I AM using though is a .bat file, because for the life of me typing the actual commands mentioned in the document.

Even when I type it exactly as the tool says, it doesn't work.

something I should mention is I deleted the PS3.cpk file, the tool read nothing at all from it anyway, so it'll suck if I find out that the other 2 files use that ps3.cpk file to get some data from and thats why I have this error.
Last edited by lionheartuk on Mon Jul 04, 2022 7:01 am, edited 1 time in total.
ssringo
veteran
Posts: 98
Joined: Sat Apr 19, 2014 8:02 am
Has thanked: 46 times
Been thanked: 13 times

Re: Persona 5 Model and Animation importer v0.8.1 - MaxScrip

Post by ssringo »

Sorry, mispoke about locale. Doing this from my phone do i can't look at the pc settings directly. Meant to say the setting that causes ¥ to display instead of / in the file path (as shown in your screenshot). Something something unicode. Again, don't see why it would be an issue since it didn't error out immediately. Just something that's obviously different.

Dunno what TGE gave you to use but it's likely not what i used to extract the cpk files. If it worked for him it should work for you. I have the tool licensed from criware so it damn sure doesn't have an issue reading and extracting the format :D

The copy of the game i used was downloaded straight from psn to my pc and extracted with pkg extracting tools. Dunno if or why a dump of the game would be different but yeah, it's not what i used.
Post Reply