Metal Gear Solid 5 (MGSV) animations
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Metal Gear Solid 5 (MGSV) animations
Tools for Metal Gear Solid 5 animations. Support for all human animations from Ground Zeroes and Phantom Pain.
Cutscene support for all characters (including dogs, horses, etc). Instructions in the post below.
DDog MTARs support
They have unique and interesting system. I was able to read all position/rotation data for all frames/bones and unpack rotations to proper quaternions. They were packed another weird way I've never seen before. Another strange thing, they actually baked IK data INTO the animation, that is very unusual, most games apply IK AFTER the animation.
This is an example of (200 extracted animations in one non-stop video). As for strange effects in transitions between animations, ignore them, it happens because they're not supposed to work in one go.
https://youtu.be/oUofIF7u1bQ
Also here's an interesting video recorded during quat research. Changing one component sign made snake (and everyone else) walk in a strange way. I also have a video of finding Paz in this way, its pathetic.
https://youtu.be/7pOoO4rhimY
Research thread: https://facepunch.com/showthread.php?t=1534738
Cutscene support for all characters (including dogs, horses, etc). Instructions in the post below.
DDog MTARs support
They have unique and interesting system. I was able to read all position/rotation data for all frames/bones and unpack rotations to proper quaternions. They were packed another weird way I've never seen before. Another strange thing, they actually baked IK data INTO the animation, that is very unusual, most games apply IK AFTER the animation.
This is an example of (200 extracted animations in one non-stop video). As for strange effects in transitions between animations, ignore them, it happens because they're not supposed to work in one go.
https://youtu.be/oUofIF7u1bQ
Also here's an interesting video recorded during quat research. Changing one component sign made snake (and everyone else) walk in a strange way. I also have a video of finding Paz in this way, its pathetic.
https://youtu.be/7pOoO4rhimY
Research thread: https://facepunch.com/showthread.php?t=1534738
Last edited by id-daemon on Sat Mar 17, 2018 5:10 pm, edited 12 times in total.
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
Human MTAR tools. Works on all human (Ground Zero & Phantom Pain) skeletal animations now, but soon I plan to make support for all kinds.
Usage: drop animation file on the tool. Or run with 1 command line parameter (animation filename).
Snake model from Ground Zeroes (sna2_main0_def.fmdl) must be in the same dir. The tool needs it for skeleton initial position and bone names. For Phantom Pain also use the same GZ model, because the skeleton is the same, and it has bone names.
For example, if you use it on TppGzPlayer_layers.mtar package, it will extract all 2405 animations in SMD format files. If you use it on one of snake's .GANI animations, it will unpack it.
After unpacking, load the model and apply it.
Then connect arms to palms and legs to feet with IK constraints.
Example: connect IK_LARM -----> SKL_013_LHAND, and use pole vector IK_POLEARM_L
You will also need to do something with twist bones, this is not done automatically yet.
TPP Cutscene tool.
You will need corresponding .sand and .fsm file for the cutscene, also .fmdl files. SAND (scene animation description) files are all over the FPK packages. FSM files are in "demo" folders.
Usage:
mgs5_pp_cutscene [sand] [n] [fmdl]
[sand] - required .sand file name. If you only use this parameter, will list character cast and not extract anything.
[n] - number or character to extract, according to the cast. In theory, you can extract any character, camera, thing, whatever.
[fmdl] - model file that the animation will be put on. In case of model swap, will produce model swapping results, but it will also work.
For your convenience, this is the description of all cutscene files I have: http://pastebin.com/i81gAGNp
DDog MTAR tools. Supports only Diamond Dogs! Normal dogs have a little different skeleton.
Usage is similar to human MTAR, but no IK actions needed. Model file for it is ddg0_main0_def.fmdl
Usage: drop animation file on the tool. Or run with 1 command line parameter (animation filename).
Snake model from Ground Zeroes (sna2_main0_def.fmdl) must be in the same dir. The tool needs it for skeleton initial position and bone names. For Phantom Pain also use the same GZ model, because the skeleton is the same, and it has bone names.
For example, if you use it on TppGzPlayer_layers.mtar package, it will extract all 2405 animations in SMD format files. If you use it on one of snake's .GANI animations, it will unpack it.
After unpacking, load the model and apply it.
Then connect arms to palms and legs to feet with IK constraints.
Example: connect IK_LARM -----> SKL_013_LHAND, and use pole vector IK_POLEARM_L
You will also need to do something with twist bones, this is not done automatically yet.
TPP Cutscene tool.
You will need corresponding .sand and .fsm file for the cutscene, also .fmdl files. SAND (scene animation description) files are all over the FPK packages. FSM files are in "demo" folders.
Usage:
mgs5_pp_cutscene [sand] [n] [fmdl]
[sand] - required .sand file name. If you only use this parameter, will list character cast and not extract anything.
[n] - number or character to extract, according to the cast. In theory, you can extract any character, camera, thing, whatever.
[fmdl] - model file that the animation will be put on. In case of model swap, will produce model swapping results, but it will also work.
For your convenience, this is the description of all cutscene files I have: http://pastebin.com/i81gAGNp
DDog MTAR tools. Supports only Diamond Dogs! Normal dogs have a little different skeleton.
Usage is similar to human MTAR, but no IK actions needed. Model file for it is ddg0_main0_def.fmdl
Last edited by id-daemon on Tue Aug 29, 2017 5:06 pm, edited 11 times in total.
-
- Posts: 2
- Joined: Sun Oct 02, 2016 8:23 am
Re: Metal Gear Solid 5 (MGSV) animations
@id-daemon
Hi, i want to try your tool, but i cant get rigged GZSnake model. For some unknown reason Cra0 tool never worked for me, well his FMDL to .smd exporter to be presice (.OBJ export works fine). Is there any chance that you can upload GZ Snake in .smd?
Hi, i want to try your tool, but i cant get rigged GZSnake model. For some unknown reason Cra0 tool never worked for me, well his FMDL to .smd exporter to be presice (.OBJ export works fine). Is there any chance that you can upload GZ Snake in .smd?
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
Sure. Also models exported with Cra0 tool were incorrectly weighted, it lead to holes in a model during animations and some distorted parts. I dont recommend using it anymore.
Here's a model in SMD:
http://www38.zippyshare.com/v/Ia9rlzgQ/file.html
This model is made with the new exporter, it will be 106 times bigger than the animation.
Here's a model in SMD:
http://www38.zippyshare.com/v/Ia9rlzgQ/file.html
This model is made with the new exporter, it will be 106 times bigger than the animation.
-
- Posts: 2
- Joined: Sun Oct 02, 2016 8:23 am
Re: Metal Gear Solid 5 (MGSV) animations
Well that was quick, thanks a ton! I gave up on Cra0 tool long ago, so i use ninja ripper and some unfinished maxscript that was on facepunch to get models.
You said this model is from the new exporter... you dont mean there is another exporter besides Cra0's model studio? Anyway i will test your tool tommorow and hope everything will be working for me, thanks again.
You said this model is from the new exporter... you dont mean there is another exporter besides Cra0's model studio? Anyway i will test your tool tommorow and hope everything will be working for me, thanks again.
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
Kabuki wrote:you dont mean there is another exporter besides Cra0's model studio?
Yes, its in develop state. Its not published yet.
-
- Posts: 40
- Joined: Mon Dec 29, 2014 8:49 pm
Re: Metal Gear Solid 5 (MGSV) animations
How did you manage to decompress the actual mtar file?
What kind of compression does it use?
What kind of compression does it use?
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
MTAR file itself is not compressed. Its just all animations put together in one big file. With a list in the beginning.
-
- Posts: 3
- Joined: Thu Oct 27, 2016 6:09 am
Re: Metal Gear Solid 5 (MGSV) animations
When I first searched this on google, I never thought I'd find this thread. As a less than amateur animator, I'm really interested to see how the game was animated.
I wanted to take a look at the animations, but I wasn't able to locate where the .mtar files are. The most I've been able to find are lua files with a few fpk and fpkd in data_02. I tried using the fpk unpack tool on the TppSoldierGzMotion.fpk and fpkd but the fpk tool doesn't seem to extract anything out of them. Could you give some pointers as to where I could find them?
I wanted to take a look at the animations, but I wasn't able to locate where the .mtar files are. The most I've been able to find are lua files with a few fpk and fpkd in data_02. I tried using the fpk unpack tool on the TppSoldierGzMotion.fpk and fpkd but the fpk tool doesn't seem to extract anything out of them. Could you give some pointers as to where I could find them?
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
fpk unpack tool must unpack TppSoldierGzMotion.fpk and this will give you MTAR file.
-
- Posts: 3
- Joined: Thu Oct 27, 2016 6:09 am
Re: Metal Gear Solid 5 (MGSV) animations
id-daemon wrote:fpk unpack tool must unpack TppSoldierGzMotion.fpk and this will give you MTAR file.
I apologize, but it doesn't seem to be working. CMD quickly opens and closes, with no text being written and no folder being output. Is it possible that there's different versions of the FPK tool?
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
Maybe your fpk file is encrypted? I have no idea. I can only say it works for me.
-
- Posts: 3
- Joined: Thu Oct 27, 2016 6:09 am
Re: Metal Gear Solid 5 (MGSV) animations
id-daemon wrote:Maybe your fpk file is encrypted? I have no idea. I can only say it works for me.
Mind if I send the fpk file over to you? I'm at my end at this point.
Otherwise, I'll probably re-run the data files through QAR and try again.
Oddly enough, that seemed to have worked. Thanks for the assistance!
-
- Posts: 40
- Joined: Mon Dec 29, 2014 8:49 pm
Re: Metal Gear Solid 5 (MGSV) animations
id-daemon wrote:MTAR file itself is not compressed. Its just all animations put together in one big file. With a list in the beginning.
The structure makes no sense to me to be honest
Code: Select all
//--------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File:
// Author:
// Revision:
// Purpose:
//--------------------------------------
typedef struct
{
uint sig; //9c a8 ff 0b
uint fileCount; //296 size?
short us0; //bones
short us1; //fps?
uint padd[5];
}MTAR_HDR;
typedef struct
{
//a/b = id or name
int a;
int b;
int addr; //important
int size;
//seek c+224?
//local byte data[]
}MTAR_ENTRY;
struct Mtar
{
MTAR_HDR header;
MTAR_ENTRY entry[header.fileCount];
//Printf("%d ",FTell());
//byte unkn[80];
}mtar;
When we go to the offset in an entry objectand take the size we are left with an even more confusing structure to deal with;
Code: Select all
typedef struct //skip to 224?
{
uint sig0;
uint _20;
uint fileSize; //changes
int64 zero;
uint _1;
byte pad0[8];
uint sig1;
uint ui1;
byte pad1[16];
uint ui2;
byte pad2[20];
char motionStr[16];
int64 sig2;
int one;
int _30;
int unkn__[64];
}MotionHeader;
struct MotionFile//first 32 are fixed
{
MotionHeader hdr;
//skip 20 int fps?
}file;
-
- Posts: 40
- Joined: Mon Dec 29, 2014 8:49 pm
Re: Metal Gear Solid 5 (MGSV) animations
The file format is really all over the place and I cannot believe a company of Konami's experience would make a structureless file format
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
I don't understand what are you trying to say. The structures you posted are almost correct. This is an animation format, it has complex data to store, and it stores it all as needed. What is wrong about it? Did you ever reversed animations before? They all usually have structures like this.
-
- Posts: 40
- Joined: Mon Dec 29, 2014 8:49 pm
Re: Metal Gear Solid 5 (MGSV) animations
id-daemon wrote:I don't understand what are you trying to say. The structures you posted are almost correct. This is an animation format, it has complex data to store, and it stores it all as needed. What is wrong about it? Did you ever reversed animations before? They all usually have structures like this.
Maybe I was just cranky
I have reversed a lot of animations but I have always understood the format 100%
Which means I never do pre-calculated jumps
This is the first time I have doing random jumps/Fseeks and it makes me unsure
Could you kindly tell me the areas I might have gotten wrong?
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
I'm not using 010 editor because I think it can't handle complex formats like this one. Also I don't quite understand what do you mean under "random jumps/Fseeks", but this parts had wrong comments:
and this part does not correspond to what i see in the file:
So you probably got this template based on the file that corresponds to it, but its not correct and the contents will depend on what you have in "motionStr[16]". For example, cutscene animations have audio segments embedded, which have "SND" string here.
Code: Select all
short us0; //bonegroups
short us1; //bones
and this part does not correspond to what i see in the file:
Code: Select all
char motionStr[16];
int64 sig2;
int one;
int _30;
int unkn__[64];
So you probably got this template based on the file that corresponds to it, but its not correct and the contents will depend on what you have in "motionStr[16]". For example, cutscene animations have audio segments embedded, which have "SND" string here.
-
- Posts: 40
- Joined: Mon Dec 29, 2014 8:49 pm
Re: Metal Gear Solid 5 (MGSV) animations
id-daemon wrote:I'm not using 010 editor because I think it can't handle complex formats like this one. Also I don't quite understand what do you mean under "random jumps/Fseeks", but this parts had wrong comments:Code: Select all
short us0; //bonegroups
short us1; //bones
and this part does not correspond to what i see in the file:Code: Select all
char motionStr[16];
int64 sig2;
int one;
int _30;
int unkn__[64];
So you probably got this template based on the file that corresponds to it, but its not correct and the contents will depend on what you have in "motionStr[16]". For example, cutscene animations have audio segments embedded, which have "SND" string here.
In my version it actually says "motion" and padded with "00"s
also it seems the floats are xor'd or encrypted
There is not a single occurrence of the float 1 in the whole thing. That is a flag
-
- Posts: 1040
- Joined: Sun Mar 22, 2015 7:09 pm
Re: Metal Gear Solid 5 (MGSV) animations
JohnHudeski wrote:also it seems the floats are xor'd or encrypted
There is not a single occurrence of the float 1 in the whole thing. That is a flag
Ah, thats what are you talking about! No, nothing is encrypted here.
It seems you only reversed simple animations before. Because no serious animation engine will use plain floats. They use 8/16 or variable-bit integers. Like for one bone it can be 14-bit x,y,z , for next bone it will be 17-bit x,y,z and so on.