Metal Gear Solid 5 (MGSV) animations

Skeletons, animations, shaders, texturing, converting, fixing and anything else related to read game models
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

JohnHudeski wrote:Integers/Bits that you convert to floats?

yes
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

id-daemon wrote:
JohnHudeski wrote:Integers/Bits that you convert to floats?

yes

That's what I meant
but how do you figure out what frame a specific Vector belongs to
like what time cos not all bones have the same number of frames

I think this is my last hurdle. I figured out the bone mapping (in my head)
Zuppermati
Posts: 9
Joined: Fri May 05, 2017 1:16 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by Zuppermati »

Hi me again. I had some freetime and I used it to do a quick hack on your tool. Can I ask you why did you force us to use snake's model? Cause all I can see it's used for except for reading a couple of values is to read block 66 which from what i got is the number of bones in the model. By changing the model required into the one needed (eg: for loading lisa's animations i used och0_main0_def.fmdl, for reedus I used pla0_main0_def.fmdl etc) you get the correct animation (for example in lisa's animations there are bones only on his left eye since the right one is "gouged out"). If I used snake's model it would load it like snake (so the bone structure would be much different and giving me incorrect results). So... can I ask you the reason?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

Zuppermati wrote:Can I ask you why did you force us to use snake's model? Cause all I can see it's used for except for reading a couple of values


It read the WHOLE skeleton (all bones with their names, structure and positions) from model file. Skeleton is needed for animations. I used snake's skeleton because I thought all skeletons are the same.
Zuppermati
Posts: 9
Joined: Fri May 05, 2017 1:16 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by Zuppermati »

They're not actually.

https://imgur.com/a/wAs7G

On the left you have lisa's animation unpacked with snake's model and on the right with her model. You can see how the scale is corrected and it has a more coherent bone structure (you can see how she's missing the right eye bones as i told you).
Reedus is pretty much the same as it has a different chest structure for his jacket.
I didn't attach ik to arms and legs to cut some time but anyway till you use them "as is" (without attaching a model on it) they beheave pretty much the same. But if you do attach lisa's model to it blender goes a bit of WTF.

It still won't unpack me the baby and refrigerator's animations even if I do use them (it gives me a strange exception and I'm not good with understanding how reverse engineering animations works) but every animation it could unpack with snake's model can be unpacked with corrected bones if you use the proper models.

If we take off the part about reading the skeleton which I've shown you it can work without snake's model are there any other reasons you used it for?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

Zuppermati wrote:But if you do attach lisa's model to it blender goes a bit of WTF.


Ok, thats right. Since I never had any human models other than Snake, I couldn't check it.
baby and refrigerator (no idea what this is) probably have different RIG, not only different skeleton.

Zuppermati wrote:If we take off the part about reading the skeleton which I've shown you it can work without snake's model are there any other reasons you used it for?


I don't remember. By "take off the part" you mean you will read the skeleton yourself somehow? Because without reading the skeleton animation will not work.
Zuppermati
Posts: 9
Joined: Fri May 05, 2017 1:16 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by Zuppermati »

id-daemon wrote:baby and refrigerator (no idea what this is) probably have different RIG, not only different skeleton.

Well I remember I saw on your youtube channel your work on the fetus so you probably know better than me how does it work :lol: . Exactly what did you do to make the program work with it?

id-daemon wrote:I don't remember. By "take off the part" you mean you will read the skeleton yourself somehow? Because without reading the skeleton animation will not work.

Sorry I used the wrong term. For "take off the part" i meant "excluding using it to read the skeleton (which as I told you even other models can do the job so PT hackers like me won't have to disassemble mgsv just to get a damned fmdl :) ) and block 66, is it used for anything else I didn't see?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

Zuppermati wrote:Sorry I used the wrong term. For "take off the part" i meant "excluding using it to read the skeleton (which as I told you even other models can do the job so PT hackers like me won't have to disassemble mgsv just to get a damned fmdl :) ) and block 66, is it used for anything else I didn't see?


I don't understand. If you don't read the skeleton, you cannot extract animations. And what is block 66 ?
Zuppermati
Posts: 9
Joined: Fri May 05, 2017 1:16 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by Zuppermati »

Again you're misunderstanding what I'm saying let's try again:
"is the filestream used in the program to read snake's model used to do anything else in the program except to read the whole model (which other fmdl can do)?"

id-daemon wrote:And what is block 66 ?


Line 100 of mgs5_gz_human.cs:

Code: Select all

fileStream.Seek(66L, SeekOrigin.Begin);


Reads the byte in position 66 which is the number of bones in the model
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

Zuppermati wrote:is the filestream used in the program to read snake's model used to do anything else in the program


No, its only used to read the skeleton and bone names.
Zuppermati
Posts: 9
Joined: Fri May 05, 2017 1:16 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by Zuppermati »

Oook then I made a fairly dumb human tool hack which easily allows to load both model and fmdl (so if you want to apply, let's say, snake's animations to quiet, it can be done too by using quiet's model and snake's fmdl and it should give better results). Will share once my campus restores internet :'(

Btw which process did you use to attach the bones to a model? Cause simple automatic weighting in blender or skin modifier in 3ds max gives horrible results. Did you weight every single bone manually? That would be crazy
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

Again I have no idea what are you talking about.

1 fmdl IS a model. What do you call a model then?

2 you could easily extract quiet animations with my original tool, just renaming quiet fmdl to snake's fmdl name, and it should work fine, and not "better" as you do by making incorrect combine of different models.

3 of course i was not doing anything manually. Models are weighted already, why do you need redoing this?
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

After 1 year i fully understand this dumb animation format
My only questions is why does the animation file contain more bones than the skeleton?
In your program you hard coded the IK bones
How did you even know those were ik bones?
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

As I said before:

id-daemon wrote:Also important note, in this game animation tracks are NOT per-bone. They are per IK group. And each group has a number of tracks for it, which is not equal to number of bones in it. Some bones may have no tracks at all, some may have many.

I mean, human animation file does NOT contain any bones. It only contains tracks for RIG groups.
This information (about groups) is contained in .FRIG files

On the other hand, simple animations, like rats, and fetus from PT, they are like normal animations, and they contain tracks for bones.
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

Thank you so much.
I found out the FRig later on
It contains mirroring data stuff

Code: Select all

struct FoxRigFile
{
    uint hash;
   
    int typeStrAddr; //start Name
    int endOfStr; //end of Name
   
    int groupCount;
    int a;
    int fileSz;
    int endOfGroupData;
    int startOfGroupData;
   
    int []groupAddr; // new int[groupCount].  points to a 32byte data structure
   
    char Name[20]; //"HumanBody"
  }
 


Hmm i think its like masking weights
Last edited by JohnHudeski on Mon Oct 23, 2017 6:00 pm, edited 1 time in total.
id-daemon
Posts: 1040
Joined: Sun Mar 22, 2015 7:09 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by id-daemon »

JohnHudeski wrote:I found out the FRig later on
It contains mirroring data stuff


I know all that it contains. But I don't want to implement these groups. If you want, go ahead.
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

I wasnt going to fully implement it. I just needed the barest necesities
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

At last! But

So guys I managed to get this thing working except 1 problem
The position values are 16 bits and I naively thought they were to be read as halfFloats (16 bit floats)
Well it doesnt work. I have every thing else working except positioning and it results in the funniest animations ever

please can you share how you converted the 16 bits used for position?
youarebritish
Posts: 1
Joined: Wed Dec 13, 2017 7:22 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by youarebritish »

JohnHudeski wrote:At last! But

So guys I managed to get this thing working except 1 problem
The position values are 16 bits and I naively thought they were to be read as halfFloats (16 bit floats)
Well it doesnt work. I have every thing else working except positioning and it results in the funniest animations ever

please can you share how you converted the 16 bits used for position?

Could you share anything you've done and/or found? I'm working on FoxKit, a general-purpose MGSV modding tool, and anything you've got would be a big help. I don't have support for any of the animation or rigging-related formats yet because there's not much documentation on them.

EDIT: Also, feel free to join the MGSV modding Discord ( https://discordapp.com/invite/3XwAsWV ) to share knowledge. Unfortunately, I don't know the answer to your question, but someone there might.
JohnHudeski
Posts: 40
Joined: Mon Dec 29, 2014 8:49 pm

Re: Metal Gear Solid 5 (MGSV) animations

Post by JohnHudeski »

OMG I havent been here in like 4 months. Most of the code is already paste here. I'll see you on discord