Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Rappelz > Rappelz Private Server
You last visited: Today at 19:36

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Some information about model files (DIFK or KFID, not BTRF or FRTB)

Discussion on Some information about model files (DIFK or KFID, not BTRF or FRTB) within the Rappelz Private Server forum part of the Rappelz category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
Some information about model files (DIFK or KFID, not BTRF or FRTB)

Some months ago, i discovered how to read files that begins with DIFK (rappelz seems to use instead "KFID"), i didn't make a model importer for a 3d modeling app like blender, so if one dev wants to do that, and then create models or change them or whatever, here is the layout:

Code:
Headers:
struct KFILEHEADER {
	char masterid[4] = "DIFK";
	char type[4] = "NIBK";
	int master_version = 1;
	int sub_version = 0;
	int nblocks;
	char reserved[108];
}

struct KFILEBLOCK {
	char blockid[4] = "KLBK";
	int blocksize;
	char reserved[24];
}

block:

enum MagicType {
	CLASSTYPEID_NONE = 0x00,
	CLASSTYPEID_WORD = 0x28,
	CLASSTYPEID_DWORD = 0x29,
	CLASSTYPEID_FLOAT = 0x2A,
	CLASSTYPEID_CHAR = 0x2C,
	CLASSTYPEID_UCHAR = 0x2D,
	CLASSTYPEID_STRING = 0x33,
	CLASSTYPEID_ARRAY = 0x34,
	CLASSTYPEID_TEMPLATE = 0x1F
}

struct GUID {
	char raw[16];
};	//see _GUID structure at msdn

struct Template_Element_t {
	MagicType magic = CLASSTYPEID_TEMPLATE;
	GUID guid;
	int array_elements_number;
	array_element_type elements[array_elements_number];
}

struct UChar_Element_t {
	MagicType magic = CLASSTYPEID_UCHAR;
	unsigned char value;
}

struct Char_Element_t {
	MagicType magic = CLASSTYPEID_CHAR;
	char value;
}

struct Float_Element_t {
	MagicType magic = CLASSTYPEID_FLOAT;
	float value;
}

struct Int_Element_t {
	MagicType magic = CLASSTYPEID_DWORD;
	int value;
}

struct Word_Element_t {
	MagicType magic = CLASSTYPEID_WORD;
	short value;
}

struct String_Element_t {
	MagicType magic = CLASSTYPEID_STRING;
	int string_size;
	char string_data[string_size];
}

struct Array_Element_t {
	MagicType magic = CLASSTYPEID_ARRAY;
	MagicType array_type_magic;
	int array_elements_number;
	String_Element_t size_field_name;	//no magic for this string
	array_element_type elements[array_elements_number];
}

struct TemplateArray_Element_t {
	MagicType magic = CLASSTYPEID_ARRAY;
	MagicType array_type_magic = CLASSTYPEID_TEMPLATE;
	GUID template_guid;
	int array_elements_number;
	String_Element_t size_field_name;	//no magic for this string
	array_element_type elements[array_elements_number];
}
where a file is:
Code:
KFILEHEADER {
	array of KFILEBLOCK {
		elements (one of the structure ending with Element_t, there maybe several elements here, but usually, there is only one template which is a header (like cob_header_v11 for .cob files), see *.tml for template contents)
	}
}
glandu2 is offline  
Thanks
13 Users
Old 10/28/2012, 12:06   #2
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
Here is a zip with anatema model described with text and nx3.tml & nobj.tml to know templates names

naf files seems to contain templates described in nx3.tml (tml files are text files)

all data should be exportable/importable in a known format, as these files contain all data needed to know animation/bones/vertex/normals/texture/...
Attached Files
File Type: zip anatema.zip (459.0 KB, 331 views)
glandu2 is offline  
Thanks
6 Users
Old 07/08/2013, 17:27   #3
 
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
Thanks you a lot for your help glandu
I'm hopefull for make a converter into FBX or OBJ. Make an exporter will be a litlle bit harder but not impossible

Just a litlle sample in OpenGL
gr4ph0s is offline  
Thanks
7 Users
Old 07/08/2013, 22:35   #4
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
and the full model fully textured

With the help of Gr4ph0s

In fact, rappelz use indexes for the faces, that's why we had weird faces before.

glandu2 is offline  
Thanks
10 Users
Old 07/08/2013, 23:53   #5
Moderator


 
ThunderNikk's Avatar
 
elite*gold: 1
Join Date: Dec 2012
Posts: 4,779
Received Thanks: 1,461
This is such a huge step guys.

Great work on the modeling, now I am going to have to brush up on my blender skills.

(Read it as convert my Solidworks and Cad skills to Blender and Meshes)
ThunderNikk is offline  
Old 07/09/2013, 00:23   #6
 
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
We are currently working on a .3ds file. Simply because is supported by many tool and it's support animation.

OBJ is great but can't have animation data :/

just a litlle sneak peek
Attached Files
File Type: zip anatema.zip (128.3 KB, 148 views)
gr4ph0s is offline  
Thanks
3 Users
Old 07/09/2013, 00:30   #7
 
elite*gold: 0
Join Date: Jun 2013
Posts: 45
Received Thanks: 32
Really amazing work, keep going. Maybe this scene won't die with some interesting developments as such.
TealSky is offline  
Thanks
2 Users
Old 07/09/2013, 01:04   #8
 
elite*gold: 0
Join Date: Apr 2010
Posts: 389
Received Thanks: 294
I wish I could help .

galndu , this is one great step in rappelz development as thndr said .
Strange2010 is offline  
Old 07/09/2013, 14:40   #9
 
elite*gold: 0
Join Date: Nov 2011
Posts: 103
Received Thanks: 11
Nice work!
sadkingbilly is offline  
Old 07/09/2013, 17:10   #10
 
wisp66's Avatar
 
elite*gold: 0
Join Date: Mar 2008
Posts: 939
Received Thanks: 516
rappelz dev really never dies it just takes breaks
wisp66 is offline  
Thanks
4 Users
Old 07/10/2013, 19:12   #11
 
elite*gold: 0
Join Date: Aug 2012
Posts: 320
Received Thanks: 264
Working on BTRF file (90% of rappelz 3d model)

Same things than the KFIle I need to find face information

gr4ph0s is offline  
Thanks
1 User
Old 07/13/2013, 23:35   #12
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
I have now discovered how BTRF files are layered, here is an explanation using structures:

Code:
struct Header
{
	int frtb_signature = "BTRF";
	int header_size = 4;
	short major_version = 1;
	short minor_version = 1;
        TemplateTable usedTemplates;
        StringTable usedStrings;
        DataBlocks data;
}

struct TemplateTable
{
	int id_table_size;
	implicit int template_number = id_table_size/18;	//truncated
	_GUID templates_guids[template_number]
	short templates_field_number[template_number];	//used field in template are from 0 to this value

	char padding[] = "12...";
}

struct StringTable
{
	int string_table_size;
	int string_num;
	char strings[];	//strings are separated by \0 and there is string_num strings

	int wstring_num;
	wchar_t wstrings[];	//same as strings, seems never used 

	char padding[] = "12..";   //use string_table_size to know where the next data begin
}

struct DataBlocks {
        int struct_size;
        int number_of_root_blocks;
        RootBlock  rootBlocks[number_of_root_blocks];
}

struct RootBlock {
	char dummy[3];
	block_type field_type;	//should be always 0x9: template
	int block_size;
	short template_id;
	Block data;
}

union Block {
	TemplateBlock tb;
	TemplateArrayBlock tab;
	FieldBlock fb;
	FieldArrayBlock fab;
}

struct TemplateBlock {
	Block sub_blocks[templates_field_number[template_id]];
}

struct TemplateArrayBlock {
	int block_size;
	short template_id;
	int count;
	struct TemplateArrayElement {
		int element_size;
		TemplateBlock template_data;
	}[count];
}

struct FieldBlock {
	void *data;	//normal representation, float = 4 byte, char  = 1 byte,  ...
}

struct FieldArrayBlock {
	int block_size;
	char type;
	<type> data[(block_size-1)/sizeof(<type>)];
}

//Fixed size arrays are represented as FieldBlock[fixedSize]
In BTRF files, there is a limited amount of types information, so the tml file is needed to be able to read a BTRF file (to know data size or data arrays, ...)

There is also a version 1.0 incompatible with this version (1.1), but I never saw a file using that version. So now all model files format are known

Here is keberoslv3_body.nx3


The BTRF format is also used by intro videos as .jtv and DIFK for some .spr files but I didn't tried to read them.

And there your axe Gr4ph0s It's a new one from the 8.2 epic ? Didn't found it before updating my client to 8.2


(For these file, I had to mirror the texture's Y coord, that was not the case for the DIFK files. The texture in the zip file is already mirrored)
(Also, blender seems to have difficulties to use some dds textures for the realtime rendering, it was not mapping correctly the texture (but the non realtime renderer was performing correctly the texture mapping). To help blender, I converted the dds texture to a tga one and changed the dae file (it's a xml file in fact))
glandu2 is offline  
Thanks
14 Users
Old 07/14/2013, 21:11   #13
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
AS I see, I forgot to add the attachment (forgot to clik on "upload" button ...) so there it is.

I also added butkadah files (naf, cob, nx3 and some dds) and associated text file describing their content.

mechanic_butkadah.nx3.dae should be working (but arms are missing)
Using the text file, it's possible to have a fully working butkadah model with bones and skeletal animations.

The collada file format (.dae) is in fact not so bad as it seems to be a good way to share models with animation with several 3D modeler (including blender as I only have it)
Attached Files
File Type: zip model_data.zip (2.43 MB, 374 views)
glandu2 is offline  
Thanks
2 Users
Old 08/01/2013, 16:01   #14
 
elite*gold: 0
Join Date: Nov 2010
Posts: 16
Received Thanks: 0
bump!!

any script release for blender?
csharpLove is offline  
Old 08/03/2013, 04:17   #15
 
elite*gold: 0
Join Date: Apr 2012
Posts: 463
Received Thanks: 837
No script for blender or any other 3d model software, it's too specific for each software. I use collada format which seems to be the best format to share 3d model with all decent software (3dsmax, Maya, Blender, ...)

But this format is very verbose, and maybe cause some bug when importing in other software than Blender (which is what I use)

Also, I found that newest versions of Blender don't import correctly the collada file (.dae) And texture are missing. The version 2.64 works fine (available here: )

So here is the model file exporter, it's a console application.

In cmd, type "BTRFReader" without parameter to show the help screen.
Parameters in "[" and "]" are optional.
You must have nx3.tml and nobj.tml in the current directory to be able to read .cob, .nx3 and .naf files. (they are provided with the BTRFReader)

Virus Total:
Attached Files
File Type: zip BTRFReader.zip (237.9 KB, 301 views)
glandu2 is offline  
Thanks
12 Users
Reply


Similar Threads Similar Threads
about the 2012 new pets model files and the weapon model files!
09/19/2012 - SRO Private Server - 2 Replies
who can tell me how to add the new pets in silkroad?and who can tell me how te add the new weapons silkroad? who can share 2012 new pets model files?THANKS!!!
BTRF programm
05/25/2012 - Rappelz Private Server - 0 Replies
Do you have a programm to depcryp the btrf file encrypt thx :handsdown:
Model files
05/08/2012 - Shaiya Private Server - 2 Replies
How to open 3do file 3ds max7 or 12? Pls link plugin or tutorial! Sorry form my bad english! I am hungarian.
Character Model files and textures
01/10/2012 - Grand Chase - 4 Replies
Where are they. More specifically wheres the texture for Seekers Grandark. if there is a guide or tut for finding and extracting specific model files and texture feel free to link plz.
Opening the Shaiya model files
11/14/2011 - Shaiya - 14 Replies
I have ZS's Shaiya Data Extractor. Looks like Shaiya models are in .3DC format. Is there a plugin for 3Ds Max 2009 (32 bit) that will open those? 3D Object Converter 4.411 opens them, but I don't have the $80 (wtf) to register it and so can't save to wavefront .obj format (my usual format).



All times are GMT +2. The time now is 19:36.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.