Page 1 of 3

Age of Wulin models

Posted: Mon Dec 19, 2011 8:24 pm
by finale00
The contents of this post was deleted because of possible forum rules violation.

Re: Age of Wushu XMOD models

Posted: Tue Dec 20, 2011 3:57 pm
by CriticalError
nice one finale, thanks a lot to you and aluigi for unpacker :D

Re: Age of Wushu models

Posted: Mon Jan 02, 2012 6:35 pm
by finale00
There are different mesh types and different vertex types.

The first four bytes are the idstring XVAM.
Then the 5th byte might be a 1 or a 2. The mesh follows a different struct depending on the value.
So far I think 1 means unskinned while 2 is skinned.

After each mesh name, there's an integer, and then another 4 bytes. This seems to determine the size of the vertex (32 bytes, 36 bytes, or 56 bytes).

I don't have all of the files with me so I'm not sure if there's more values to look at it, but so far I've managed to parse geometry from files that only have one mesh.

Bones are there in the XMOD, but I can't seem to find any bone transforms.
And I don't have the entire game with me so maybe I might have left that those somewhere else...

Image

Re: Age of Wulin XMOD models

Posted: Tue Jan 03, 2012 8:54 am
by finale00
So I've found 7 vertex types so far: 24, 32, 36, 40, 44, 56, 64 bytes.
There is some flag that determines whether the model has bones/weights or not.
There is some flag that determines what kinds of textures the model uses (diffuse, specular, and/or normal)

Depending on some flags, the material section will have varying amount of floats (I guess these are related to the material, depending on what is actually used)

The real problem is what each value means, and which combination results in what.
Looking at a single value is not enough to determine things like vertSize.

The format is something like

Code: Select all

Header
Model information including 4 special bytes

numMesh {
   Mesh information { (with 4 special bytes)
       vertices
       indices
       weights (maybe)
       bones (maybe)
       Material
   }
}
This is a portion of the table that I put together while searching for patterns amongst those "special bytes"
vb1 to vb4 are the bytes in the model header. mb1 to mb4 are the bytes in each mesh. Note that vb and mb values are in hex, while vertSize is in decimal (cause I typed that one)

Image

The flag I called "mb2" takes on values 0x4, 0x14, 0x54, 0x74, and 0x94. And 0x15 for some reason.
0x4 means there are no textures.
0x14 means there is a diffuse texturemap.
0x54 means there is a diffuse and also specular texturemaps
0x74 means there is diffuse, specular, and normal texturemaps.
0x94 has diffuse and specular, but then followed by two integer 0's.



Certain combinations of bytes guarantee certain pieces of information, so the parser code is basically full of conditional statements checking a bunch of these combinations that I've come across. And I've only looked at the outfits! Haven't even touched the items and weapons and decorations.

But ok, at the very least the models aren't faceless anymore...

Image

Re: Age of Wulin XMOD models

Posted: Thu Jan 05, 2012 9:34 am
by finale00
Well, this is quite fortunate.
I was looking through the gm2 files and found some text files that the devs probably left behind. Although there are only 5 and in the same folder (among the hundreds of folders).

It is a pretty simple file, but it makes some things quite clear (although even if I know what the data represents, I still don't know what it actually does lol)

Example:

objects' numbers: 4
{
object0's name: Huotan0903
object1's name: Huotan0900
object2's name: Huotan0901
object3's name: Huotan0902
}
textures' numbers: 4
{
texture0's name: gybaitan001gh.dds
texture1's name: sst001_dqg.dds
texture2's name: jyhuotanhww005.dds
texture3's name: jyhuotanhww004.dds
}
materials' numbers: 4
triangles' numbers: 2630, vertices' numbers: 2563
2-sided triangles' numbers: 325
bbox_size: 4.820763,3.562109,3.108685, radius: 3.285993
traverses/vertex: 101.595947, max depth: 69

Code: Select all

#Age of Wulin GM2 model outline

#A single model may contain multiple meshes.

#Each mesh defines the number of vertices and faces that make up the mesh.

#The index and vertex buffers follow afterwards, for all of the meshes
#(so you need to store the individual numbers somewhere when you parse it)

#You need to know the total number of faces and vertices.

#The size of the vertex is determined by vertSectionSize / totalVertex, where the section size is given to you
#before you start parsing the vertices

Basic idea of the format

Header
Material/Mesh names

Material 1
Material 2
...

Mesh 1
Mesh 2
...

All indices
All vertices

==========================================================

struct Header {
	char[4] idstring "60.1"
	dword
	dword matSectionSize
	dword numNames
	dword numMat
	dword numMesh
	dword
	dword
	dword
	dword total Faces
	dword
}

struct unkStruct {
	dword[2]
	float[3]
	dword[6]
	dword[3]
}

struct Vertex {
	// standard vertex info.
	// Varies depending on the size of the vertex
}

struct Mesh {
	
	dword[3]
	float[4]
	dword
	dword numFaces
	dword
	dword numVerts
	byte[64] just_skip_it
}

struct File {
	Header
	float_3 bboxMin
	float_3 bboxMax // or maybe the other way around
	float radius
	
	numName {
		string_0 name // null-terminated strings
		// usually matName, texName, ?, meshName but sometimes different...
	}
	
        dword 
	############
	dword[??] integers // see below
	############
	
	numMesh unkStruct // I don't know
	numMesh Mesh 
	
	word[TotalFaces * 3] indices
	dword ???
	dword vertSectionSize
	totalVerts Vertex
}
For the ############# section, I just wrote this

Code: Select all

if numMesh == numMat
   dword[4*numMesh]
else
   dword[3*numMat]
Still not perfect with some files, but at least it renders most of them properly.
Now to figure out how the names (mats, tex, meshes) work...

Here's a temple

Image

The entire map can be built just by loading up all of the models into one scene (although it will take some time...)

Re: Age of Wulin models

Posted: Fri Apr 27, 2012 6:10 am
by lkw019
flip model ?

Image

Image

Re: Age of Wulin models

Posted: Fri Apr 27, 2012 9:35 am
by finale00
Ya, for some reason all of the models I view are flipped.
For EVERY game I've tried lol

I don't know why.

Re: Age of Wulin models

Posted: Fri Apr 27, 2012 1:06 pm
by howfie
Probably lhs rhs thing.

Re: Age of Wulin models

Posted: Fri Apr 27, 2012 4:39 pm
by finale00
Hmm well I do remember seeing something about some left-hand right-hand coordinate system but don't know how I should be changing how I draw the model lol

Re: Age of Wulin models

Posted: Fri Apr 27, 2012 5:00 pm
by howfie
when parsing, negate one of the x, y, or z coordinates. typically z. noesis is opengl and RHCS. directx is LHCS. depends on the rendering api.

Re: Age of Wulin models

Posted: Wed May 30, 2012 4:32 am
by lkw019
i open gm2 is err, please hlep , thanks

Re: Age of Wulin models

Posted: Wed May 30, 2012 4:38 am
by lkw019
huotan09.gm2 is ok ...

Re: Age of Wulin models

Posted: Wed May 30, 2012 5:01 am
by lkw019
:?:

Re: Age of Wulin models

Posted: Wed May 30, 2012 4:27 pm
by finale00
Fatduck has support for this game in his max importer.

viewtopic.php?f=33&t=7901

Re: Age of Wulin models

Posted: Thu May 31, 2012 11:08 am
by lkw019
finale00 wrote:Fatduck has support for this game in his max importer.

viewtopic.php?f=33&t=7901

where ... :?: