Far Cry Primal models

Post questions about game models here, or help out others!
bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Wed Feb 08, 2017 2:59 pm

volfin wrote:he asked for an exporter. (...) It's assumed he'd do any converting to assets for the editor himself.
lukamas wrote:Hey guys, is anyone making an exporter for far cry 4, I really want to mod this game, and It would be my dream to make a new object or asset for the map editor for far cry 4
:mrgreen:

As for modifying Far Cry 4, this thread's topic is more about (unpacking) Far Cry Primal, and specifically its models. Far Cry 4 is only referenced because the games are so much alike, filesystem-wise.

If you're looking for modding the FC4 editor and game, the forum I linked previously is a good place to start. Fino, Janne and Predaator have some nice mods, adding (Far Cry 3 based) objects to the Far Cry 4 editor. We're pushing the limits of custom maps even further. Perhaps one day we can add models and animations to the game, but for now we're reusing assets from the vanilla game to make sure everyone can play the maps that we're making.

The 'Selected Objects Export/Import' does not export models from the game to 3D software, but merely allows for saving object placement data in maps from one FC editor to another. For example, see Fino's thread and understand that the 'models' used in those screenshots are not newly created/imported models, but instead constructed in the FC4 editor itself by placing many individual other objects together in the map to appear as new object. :)

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1761
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 38 times
Been thanked: 1209 times

Re: Far Cry Primal models

Post by daemon1 » Wed Feb 08, 2017 4:36 pm

bouvrie wrote:
daemon1 wrote:Can anyone confirm oasis tools working? Its time to gather all tools and put them in title post. I need to know if it works.
I tried the oasis tool for Far Cry Primal, and conversion seemed fine for English, German and Czech. Bins converted to XML, and back again. With the string replacement and table copy, as well as the patch.fat patch, it seems to work fine ingame! :)

But, there may be something weird with the FC4 Oasis tool.
I may check that later. But now its time to move all tools to title post. Let me know if I forgot anything. If you have more FCP filenames to add, I will add the link.

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Fri Feb 10, 2017 3:08 pm

daemon1 wrote:Now you can go to current dir, run the tool from somewhere else and specify FAT file somewhere else. So you can place everything in 3 different dirs if you like:

1. dir with the tool
2. dir with fat/dat pair
3. current dir where unpacked files will go (also must have xml files for names)

Recursive xml search was one on purpose, because if more names will be found in files, this is only better.
Just a note: it seems like you can't have 1 master tool dir with both the tool and all filename XMLs: the XML filelist definition files still must be placed in the current dir.

Also, I'm running the tool from C:, on files on my D:. Doing the following will however NOT work:

Code: Select all

D:
CD FarCryPrimal\data_win32
C:
CD FCtools
fcp_unpack.exe D:common.fat
The exe seems to look for D:\common.fat instead of the D:\FarCryPrimal\data_win32\common.dat as expected. So, you'd have to instead call it like:

Code: Select all

C:
CD FCtools
fcp_unpack.exe D:\FarCryPrimal\data_win32\common.fat
This has the added benefit of using the XML definitions from the FCTools dir, but the downside of unpacking the fat in the tools dir. :P

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1761
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 38 times
Been thanked: 1209 times

Re: Far Cry Primal models

Post by daemon1 » Fri Feb 10, 2017 4:15 pm

bouvrie wrote:but the downside of unpacking the fat in the tools dir. :P
No, you don't have to unpack the fat in the tools dir. There's no such a thing as two current dirs (for each drive), current dir is only ONE dir.

Code: Select all

C:\fctools\fcp_unpack.exe D:\FarCryPrimal\data_win32\common.fat
This is what you need. Is it?

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Fri Feb 10, 2017 6:20 pm

daemon1 wrote:

Code: Select all

C:\fctools\fcp_unpack.exe D:\FarCryPrimal\data_win32\common.fat
This is what you need. Is it?
Ideally, yes, the statement you suggest is the one I would want (and I bet the way you intended it). However, it does not seem to use C:\fctools\*.xml for the XML's detailing the file names, so you end up needing to copy those in the current dir for the actual filenames to be decoded. If it would check alongside the .exe for the XML files, the tool would be perfect!

Re: the working dir: the command prompt should remember a "current dir" per drive letter, and a single "current working dir". Your tool doesn't seem to be aware of the prior. I.e. see how this command prompt snippet works:

Code: Select all

C:\Windows>dir D:
 Directory of D:\
10/02/2016  11:30    <DIR>          FarCry4
10/02/2017  14:54    <DIR>          FarCryPrimal
            2 Dir(s)

C:\Windows>CD D:\FarCryPrimal
C:\Windows>dir D:
 Directory of D:\FarCryPrimal

08/01/2017  22:34    <DIR>          .
08/01/2017  22:34    <DIR>          ..
08/01/2017  22:34    <DIR>          bin
07/02/2017  21:23    <DIR>          data_win32
08/01/2017  22:34    <DIR>          Output
08/01/2017  11:40    <DIR>          Support
08/01/2017  22:23            25,189 unins000.dat
08/01/2017  21:54           990,885 unins000.exe
               2 File(s)      1,016,074 bytes
               6 Dir(s)
See how the 2nd "Dir D:" picks the D:\FarCryPrimal dir instead of the D:\? that's what I was referring to. In that command prompt state, D:data_win32\common.fat does resolve to the fat, but somehow your tool doesn't. Perhaps the shell environment needs to be explicitly imported, or it requires an OS system call to expand the parameter to a full path. I haven't encountered this behavior with a console app before, so to me it's odd. But not unworkable. ;)

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1761
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 38 times
Been thanked: 1209 times

Re: Far Cry Primal models

Post by daemon1 » Fri Feb 10, 2017 7:00 pm

bouvrie wrote:Perhaps the shell environment needs to be explicitly imported, or it requires an OS system call
No, it was because I added an extra "\" inside a path. Try this one. Must work with your "Dir D:" now and get XML from tool dir.
You do not have the required permissions to view the files attached to this post.
Last edited by daemon1 on Fri Feb 10, 2017 8:08 pm, edited 1 time in total.

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Fri Feb 10, 2017 7:52 pm

Sweet! Almost there, the unpack now seems to load the XMLs from the tools dir, but there's another backslash messing up this time:

Code: Select all

D:\FCP\common>..\FCTools\fcp_unpack.exe "c:\games\Far Cry Primal\data_win32\common.fat"

Unhandled Exception: System.IO.FileNotFoundException: Could not find file 'c:\games\Far Cry Primal\data_win32common.dat'.
Backslashes can be annoying sometimes eh? ;)

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1761
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 38 times
Been thanked: 1209 times

Re: Far Cry Primal models

Post by daemon1 » Fri Feb 10, 2017 8:07 pm

bouvrie wrote:Sweet! Almost there, the unpack now seems to load the XMLs from the tools dir, but there's another backslash messing up this time
ok this means that "\" was needed. It seems impossible to make it work in both cases. I'm not going to start writing syntax analyzers here. So I should leave it either this, or like it was before.

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Sat Feb 11, 2017 12:41 am

Haha, funny how that is rocket science compared to all the work you've done unpacking the game & handling the models! :D

Published an XML with more FCP filenames to http://steve.farcry.eu/ (direct link).

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Fri Feb 24, 2017 11:45 am

Does anyone have a structure definition for Far Cry (4 / Primal) material.bin files?

User avatar
volfin
ultra-veteran
ultra-veteran
Posts: 417
Joined: Sun Jul 06, 2014 6:30 am
Has thanked: 100 times
Been thanked: 260 times

Re: Far Cry Primal models

Post by volfin » Fri Feb 24, 2017 10:22 pm

I have something you can start from:

Code: Select all

//------------------------------------------------
//--- 010 Editor v7.0.2 Binary Template
//
//      File: UBisoft Primal Mat.bt
//   Authors: Volfin
//   Version: 0.1
//   Purpose: Template for FarCry Primal material.bin files
//  Category: 
// File Mask: 
//  ID Bytes: 
//   History: 
//------------------------------------------------
struct MATHEADER {
    char head[4];
    unsigned int unk1;
    unsigned int unk2;
    unsigned int unk3;
    unsigned int unk4;
    unsigned int unk5;
    unsigned int unk6;
    unsigned int unk7;
    unsigned int unk8;
    unsigned int unk9;
    unsigned int unk10;
    unsigned short unk11;
    unsigned char name_len;
    char name[name_len];
    unsigned int hash;
    unsigned char name_len2;
    char name2[name_len2];
    byte j1;
    unsigned int f;
    byte j2;
    unsigned int g;
    byte wuh_len;
    char h[wuh_len];
    unsigned int i; // for normal
    //char i[28];
    unsigned char name_len3;
    char name_Specular[name_len3];
    byte o1;
    unsigned int k;
    byte o2;
    unsigned int l;
    byte o3;
    unsigned int m;
    unsigned int n;
    unsigned char name_len4;
    char name_Normal[name_len4];
    byte t1;
    unsigned int p;
    byte t2;
    unsigned int q;
    byte t3;
    unsigned int r;
    unsigned int s;
    unsigned char name_len5;
    char name_Diffuse[name_len5];
    byte y1;
    unsigned int u;
    byte y2;
    unsigned int v;
    byte y3;
    unsigned int w;
    unsigned int x;
    unsigned char name_len6;
    char name6[name_len6];
    byte aa1;
    unsigned int bb;
    byte aa2;
    unsigned int cc;
    byte aa3;
    unsigned int dd;
    unsigned int ee;
    unsigned char name_len7;
    char name7[name_len7];
    byte ff1;
    unsigned int gg;
    byte ff2;
    unsigned int hh;
    byte ff3;
    unsigned int ii;
    unsigned int jj;
    unsigned char name_len8;
    char name8[name_len8];
    byte kk1;
    unsigned int ll;
    byte kk2;
    unsigned int mm;
    byte kk3;
    unsigned int nn;
    unsigned int oo;
    unsigned char name_len9;
    char name9[name_len9];
    byte pp1;
    unsigned int qq;
    byte pp2;
    unsigned int rr;
    byte pp3;
    unsigned int ss;
    unsigned int tt;
    unsigned char name_len10;
    char name10[name_len10];
    byte uu1;
    unsigned int vv;
    byte uu2;
    unsigned int ww;
    byte uu3;
    unsigned int xx;
    unsigned int yy;
    unsigned char name_len11;
    char name11[name_len11];
} header;
I was only interested in getting texture paths out of it for my importer, so I only worked it out that far. It's by no means complete or meaningful in any other way. And Just because I used an Integer for the stuff in between, doesn't mean it is an Integer. I just used that to skip over bytes to get to the next texture. Also even though I stopped at 10 texture records, there's a lot more, usually unused, but not always. It goes on and on for quite a number of records. Since I only wanted Diffuse/Normal/Specular, Searching through the first 10 was usually sufficient to find them.

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Sat Feb 25, 2017 12:18 am

volfin wrote:I have something you can start from:
Thanks, that's what I was looking for. Saves me from doing some work again. :)

Just wondering, does your importer/exporter do anything with the "wuh" string? I'm trying to determine its effects on the game, as it can be one of several options identified.
Would that name possibly impact the rendering, physics, or anything like that? As you're referring to Normal, Diffuse and Specular in a different part of the file, would the wuh influence how these values are interpreted or something?

User avatar
volfin
ultra-veteran
ultra-veteran
Posts: 417
Joined: Sun Jul 06, 2014 6:30 am
Has thanked: 100 times
Been thanked: 260 times

Re: Far Cry Primal models

Post by volfin » Sat Feb 25, 2017 1:19 am

can you give an example? I'm unfamiliar with the 'wuh' string.

bouvrie
advanced
Posts: 52
Joined: Sat Mar 18, 2006 5:29 pm
Has thanked: 13 times
Been thanked: 1 time

Re: Far Cry Primal models

Post by bouvrie » Sat Feb 25, 2017 6:17 pm

Well, the 'wuh' string from that script seems to be any of the following values: Animal_Fur, Animal_Skin, BigLeaf, Blended, Cloth, Cloth_FC3, CloudDome, Decal, Detail, DynamicWater, EffectEmissive, EffectLit, Error, EyeAdvanced, FakeTerrain, Generic, Generic_FC3, Generic_FC3_LQ, Grass, GroundVegetation, Hair, Highlight, Ice, InkAndPaint, Leaf, Metal, Metal_Advanced, Ocean, RealtreeTrunk, Road, ShangrilaOcean, Simple, Skin, Skin_Advanced, Skin_Cinematic, Skin_FC3, SkyDome, StarSphere, Stream, Unlit, Vegetation, Vehicle, VertexColor, Vistas, Water, WaterRiver, or Weapon.

As we're trying to import Far Cry 3 assets into Far Cry 4, I was wondering what these strings related to a Material may affect in the game. I'm not too familiar with modeling/texturing, but I assume a material.bin would influence how light refracts on the object. Or would there be any other 'behavior' attached to a material, like physics-related information for example?

User avatar
volfin
ultra-veteran
ultra-veteran
Posts: 417
Joined: Sun Jul 06, 2014 6:30 am
Has thanked: 100 times
Been thanked: 260 times

Re: Far Cry Primal models

Post by volfin » Sun Feb 26, 2017 12:37 am

I finally figured out you meant the name of one of the variables in my 010 Template. I was a bit lost there for a minute. :keke:

Yeah I was a bit puzzled when I first found those non-ascii text entries. I just skip over them, I have no idea what they do. I recall I named it "wuh" for 'whut the hell" is this lol.

Post Reply