PDA

View Full Version : Dungeon Keeper 2 - Convert KMF Meshes to OBJ



simonschreibt
May 27th, 2013, 19:51
Hi Friends.

Currently i try to write a small article for my blog (simonschreibt.blogspot.de) about DK2 but i'm stuck with my investigations.

You can extract the mesh files (.KMF) of Dungeon Keeper 2 with a mod tool but I need an importer for 3Ds Max or Blender or a converter which can convert KMF to OBJ. I already searched the web and found nothing. The only piece of code i got was this:

https://bitbucket.org/trass3r/gametools/commits/d8e318ea78f4

I'm not sure what it is doing exactly but i hope it can convert KMF to OBJ. I tried to contact Trass3r who wrote the code but didn't get any response. So if you know something, have tools, understand the code, are a DK2 developer or just feel inspirited to investigate the KMF files - feel free to help me. :)

Hapuga
May 28th, 2013, 09:40
The biggest problem is getting the files back into the game. Nobody figurd that out yet.

simonschreibt
May 28th, 2013, 10:50
No problem for me. I just want to investigat the geometry. So, do you know how to convert KMF into a readable format like OBJ?

Hapuga
May 28th, 2013, 15:09
No idea.

Trass3r
June 1st, 2013, 21:49
It's a complex format.

local int i;

struct {
char magic[4];
int size; // size of file incl. header
int version; // = 17
} KMSH;

struct {
char Signatur[4];
int size;
int Format; // 1 = Mesh, 2 = Anim (?)
int uk; // = 1
} HEAD;

struct Texture {
string name;
};

struct MAT2 {
char Signatur[4];
int size;
string uk; // internal name?
int NumTextures;
Texture Texturenames[NumTextures]<optimize=false>;
int uk1;
int uk2;
int uk3;
string uk4;
};

struct {
char Signatur[4];
int size;
int NumMat;
MAT2 Materials[NumMat]<optimize=false>;
} MATL;

struct Mesh {
char MeshSig[4];
int size; // inkl. Signatur
struct {
char head[4];
int size;
string meshname;
int NumGroups; // number of groups in SPRS
int NumVerts; // total number of vertices defined in GEOM
float uk1; // bounding area?
float uk2;
float uk3;
float uk4;
int NumLOD; // number of total LOD entries
} Header;
struct Ctrl { // NumCTRL only non-zero in ANIM files
char Signatur[4];
int size;
int NumCTRL;
int uk[NumCTRL*2];
} ctrl;

typedef struct { // only used in ANIM files
char Signatur[4];
int size;
float x,y,z;
} POLY;

typedef struct {
short index; // index of the vertex in GEOM
int uk; // flag?
float nX; // the vertex normal
float nY;
float nZ;
} VertEx; // Extra vertex data with normals

struct Model {
char Signatur[4];
int size;
for (i=0; i<Header.NumGroups; i++)
{
struct {
char Signatur[4];
int size;
int LODEntries[Header.NumLOD]; // one entry for each LOD
int NumVertsEx; // number of entries in the extended vertex list
int uk;
} SPHD;
}

for (i=0; i<Header.NumGroups; i++)
{
struct
{
char Signatur[4];
int size;
int uk;
local int j;
for (j=0; j<Header.NumLOD; j++)
{
struct {
struct {
ubyte x,y,z; // indices for the extended vertex list
} LODVertIndices[SPHD[i].LODEntries[j]];
} LODEntries;
}

VertEx VertsEx[SPHD[i].NumVertsEx]; // extended vertex list
} Groups;
}
} model;

typedef struct { // a vertex definition
float x;
float y;
float z;
} Vec3f;

struct GEOM {
char Signatur[4];
int size;
Vec3f vertices[Header.NumVerts];
} geom;
} mesh;

simonschreibt
June 5th, 2013, 23:46
Thx Trass3r. I finally got it and here's the resulting article:

http://simonschreibt.blogspot.de/2013/06/dungeon-keeper-2-walls.html

Keeper Decagon
June 7th, 2013, 07:50
Do you know where I could download the WAD tool from? On keeper.lubie it only says to search the internet, and so far I haven't found anything useful, only dead links.

simonschreibt
June 7th, 2013, 17:11
Here (http://en.file-upload.net/download-7689737/DK2WADTool.zip.html) you go. But please check the EXE with virustotal.com or something other before you execute it.

Keeper Decagon
June 7th, 2013, 19:41
Thanks for the link. :)