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

The Last of Us Model/Animation Tools (PS4)

Post questions about game models here, or help out others!
Post Reply
akderebur
double-veteran
double-veteran
Posts: 640
Joined: Fri Jul 08, 2011 10:36 am
Has thanked: 65 times
Been thanked: 898 times

The Last of Us Model/Animation Tools (PS4)

Post by akderebur »

A set of tools for loading and exporting models/animations from The Last of Us Remastered. It has great model support now, including automatic texture mapping and map tool. Animation support is not perfect but improved a lot.

Animation Tool

Image

Models
I am releasing a new version of the model tool. It has material support like the map tool, and also lot of bug fixes.

Image

How to use

Load
  • PAK: Loads models (skinned) in selected PAK file.
  • Textures will be applied automatically if they are in the same folder. For exporting textures use TLOU Texture Editor
  • If the skeleton is found inside the pak file it will be loaded. If not, another file selection will appear for choosing the skeleton PAK file. (optional)
  • You can load multiple models. Everything will stay until you clear the scene.
Export
  • NUX: Exports the model in custom binary format (.nux), intended to be loaded by Noesis. Noesis script for this format : NUX Script
  • Models will the grouped by their original PAK file. So separate NUX for every PAK.
  • Like with the tool, the textures need to be in the same folder as NUX, for Noesis to load them.
  • Note : Models will be exported into the folder Export.
Download : https://www.mediafire.com/file/znv85uml ... 3.rar/file

Map Tool
viewtopic.php?p=161587#p161587

Animations
Animation support works much better than before, but it still has problems that I am aware of. Don't bother reporting broken animations.

Image

How to use

Load
  • NUX: Loads models in selected NUX file. This is the exported model that you get from TLOUViewer.
  • Textures will be applied automatically if they are in the same folder. Only diffuse texture as this is just for preview purposes. (optional)
  • You can't load multiple models.
  • Animation (PAK/STM):Loads animations inside the selected PAK or STM files.
  • You can cycle through animations using left/right arrow keys.
  • Note : If you are not seeing any animations being played after selecting the PAK file, there may be two reasons. You have selected a wrong animation file, meaning the animations doesn't match with the model loaded (most likely reason). Or none of the animations in that file are supported (less likely).
Export
  • NUX: Exports the animation in custom binary format (.nux), intended to be loaded by Noesis. Noesis script for this format : NUX Script
  • Note : Animations will be exported into the folder Export.
Download : https://www.mediafire.com/file/n0eoa7qr ... 1.rar/file

Textures
If you are also interested in getting the textures, check out my texture tool : TLOU Texture Editor

Credits
daemon1 - for figuring out all of the model data and explaining it really well with videos
luxox18 - for finding out data manually, so that I can use them as a reference
Last edited by akderebur on Sun Apr 04, 2021 10:16 pm, edited 15 times in total.
amzerof6
advanced
Posts: 57
Joined: Sat Oct 23, 2010 3:50 pm
Has thanked: 2 times
Been thanked: 2 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by amzerof6 »

wow ,this is realy awsome!!
justshopatkmart43
advanced
Posts: 49
Joined: Tue Nov 06, 2012 7:57 am
Has thanked: 10 times
Been thanked: 15 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by justshopatkmart43 »

Will this work on uncharted 4?
akderebur
double-veteran
double-veteran
Posts: 640
Joined: Fri Jul 08, 2011 10:36 am
Has thanked: 65 times
Been thanked: 898 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by akderebur »

Jaydenthetank wrote:Will this work on uncharted 4?
I don't know, it might work if the file structure is identical with the last of us. I don't have the uncharted files, so didn't have the chance to test them.
justshopatkmart43
advanced
Posts: 49
Joined: Tue Nov 06, 2012 7:57 am
Has thanked: 10 times
Been thanked: 15 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by justshopatkmart43 »

Just curious because I don't think anyone has ripped ps4 models before
Darko
double-veteran
double-veteran
Posts: 723
Joined: Mon Jul 13, 2009 6:16 pm
Has thanked: 72 times
Been thanked: 138 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by Darko »

Jaydenthetank wrote:Just curious because I don't think anyone has ripped ps4 models before
https://www.youtube.com/watch?v=-Y1bigdq-6o&t
Image
volfin
ultra-veteran
ultra-veteran
Posts: 452
Joined: Sun Jul 06, 2014 6:30 am
Has thanked: 110 times
Been thanked: 326 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by volfin »

akderebur wrote:
Jaydenthetank wrote:Will this work on uncharted 4?
I don't know, it might work if the file structure is identical with the last of us. I don't have the uncharted files, so didn't have the chance to test them.
Uncharted 4 is something I started looking into. But the whole game is just one single pak file, so I suspect it's not similar at all. EDIT: I found out it's because PS4 games are encrypted, and still nobody knows how to unencrypt them (which begs the question how you unencrypted this game?)

I am curious if you can release the source code or futher explain the findings, as I'm sure it would help with my own investigations, the more we can pool information, the farther we can go.
akderebur
double-veteran
double-veteran
Posts: 640
Joined: Fri Jul 08, 2011 10:36 am
Has thanked: 65 times
Been thanked: 898 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by akderebur »

volfin wrote:Uncharted 4 is something I started looking into. But the whole game is just one single pak file, so I suspect it's not similar at all. EDIT: I found out it's because PS4 games are encrypted, and still nobody knows how to unencrypt them (which begs the question how you unencrypted this game?)
I did not, luxox is the guy you are looking for :D

He released some character files in this thread : viewtopic.php?f=10&t=15801
User avatar
Wobble
ultra-veteran
ultra-veteran
Posts: 584
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by Wobble »

[out]
Last edited by Wobble on Sat Mar 11, 2017 11:17 am, edited 1 time in total.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by shakotay2 »

[well, I've been told, my guess is wrong for PS4, does apply for PS3 models only]

Guess, it's also a matter of Sony's edge compression:
viewtopic.php?f=16&t=12070&p=99284#p99284

Only tool I know (so far) that can handle it is Noesis:
rapi.rpgCommitTriangles(edgeDecomp, noesis.RPGEODATA_USHORT, indexCount, noesis.RPGEO_TRIANGLE, 1)

But detailed informations are kept secret.
That's sad because more infos could help with Gran Turismo 6 Models, too.

I tend to ignore edge decompression, because it's so boring. I remember fiddling around with Sony's edge SDK (or something like that, not sure).
Just a waste of time and life... :D
Last edited by shakotay2 on Mon Feb 20, 2017 7:28 am, edited 1 time in total.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
daemon1
MEGAVETERAN
MEGAVETERAN
Posts: 2647
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 65 times
Been thanked: 2870 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by daemon1 »

akderebur wrote:I did not, luxox is the guy you are looking for
luxox will not be able to help you. Hes just the guy who delivers decrypted files from the scene. He can't decrypt them.
akderebur
double-veteran
double-veteran
Posts: 640
Joined: Fri Jul 08, 2011 10:36 am
Has thanked: 65 times
Been thanked: 898 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by akderebur »

Wobble wrote:Viewers and characters are nice, but as a coder, we would like to see some discussion on formats, algorithms, or code.
There is no real algorithm that can bring you further, it is just like pattern matching program designed specifically for The Last of Us pak files. Let me explain how the program works and you will see what I mean.

The way I did it was I basically opened bunch of character files in the hex editor and tried to find out recurring patterns in each file. Here is an example for getting vertex/index count and index offset.

There are 4 patterns for this (in hex) :
  • 03 00 00 00 00 00 00 00 00 00 00 00
  • 04 00 00 00 00 00 00 00 00 00 00 00
  • 05 00 00 00 00 00 00 00 00 00 00 00
  • 06 00 00 00 00 00 00 00 00 00 00 00
Also after 44 bytes from the start of the above patterns, there should be this pattern : FFFFFFFF.

So lets say the file contains 10 meshes. The program starts and searches for these patterns in the file and when there is a match it adds the offset to a list. When it is done there are like 3000 (I am making up numbers for this example) records in the list. It then goes through the list, for each offset it advances 44 bytes and checks if there is FFFFFFFF. If it finds out that pattern, it adds that offset (end of FFFFFFFF) – 56 bytes to a new list. The reason for offset - 56 bytes is because the data we are looking for actually starts there, again something that I found out looking at the hex editor. In the end that list has 10 records with correct offsets.

Now we can read the actual data. The program goes through each offset in the new list :
  • binary reader’s position is set to the current offset
  • first integer read = vertex count
  • second integer read = index count
  • advance 28 bytes
  • integer read = index offset
I think at this point you can see that the program is a product of binary search and pattern matching and that it doesn’t use a proper way to find data. It is like a bruteforcer for finding data in tlou files only. I find it hard to believe that anyone can develop it further to let’s say work with uncharted 4 files. If the file structure is identical, it will work. If not you would need new patterns and it would be a whole new program in that case.

The program as it is contains more code for graphics and ui programming than the actual code for reading the pak file and it is a bit messy :D. If you want I can strip the Unity stuff and share the part related to pak files.
shakotay2 wrote:Guess, it's also a matter of Sony's edge compression
Mesh data (index, vertex, uv) is not compressed in the ps4 files. Only the ps3 version has edge compression.
User avatar
Wobble
ultra-veteran
ultra-veteran
Posts: 584
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by Wobble »

[out]
Last edited by Wobble on Sat Mar 11, 2017 11:17 am, edited 1 time in total.
luxox18
mega-veteran
mega-veteran
Posts: 176
Joined: Fri Jul 29, 2011 9:18 pm
Has thanked: 54 times
Been thanked: 46 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by luxox18 »

ps4 developers are not using the edge compression anymore. Instead are using swizzled textures and models with same structure as PC with little endian data. (nothing compressed)

in this game specifically the vertex data and the uv data are separated and all faces start with 00 00 01 00 02.

not all games can be decrypted, for the moment is possible in games with firmware 1.76 (2013 - 2014 games)

oh, and about how to obtain decrypted games.. I just have a contact in the ps4 scene
User avatar
Wobble
ultra-veteran
ultra-veteran
Posts: 584
Joined: Tue Jan 04, 2005 9:47 pm
Has thanked: 43 times
Been thanked: 112 times

Re: Last of Us Model Viewer/Extractor (PS4)

Post by Wobble »

[out]
Last edited by Wobble on Sat Mar 11, 2017 11:17 am, edited 1 time in total.
Post Reply