I hope to expand on these tutorials and use better tools to automate the job and code it completely proper.
for this tutorial you will need a few tools
1. Float 2 text download/file.php?id=1888
2. HxD (free hex editor)
3 excel (2007)
4 Deep exploration (program able to view an obj with just verts
5 some shaiya model files. download/file.php?id=2187
1) Ok so open the model folder after you extract them and open the file demf_boots001.3DC
in the program HxD
2)Now if we know the model format lets see how to break it down
3) a dword is 4 bytes#Provided from Fatduck
dword constant00
dword numBones
struct Bone {
float_16 Matrix4X4
}
dword numVerts
struct Vert {
float_3 CoordXYZ
float Weight
byte BoneID01
byte BoneID02
byte NULL1
byte NULL2
float_3 NormalXYZ
float_2 TexCoordUV
}
dword numFaces
struct Face {
word_3 FaceIndices123
}
a 32 bit float (these are 32 bit floats) is equal to 4 bytes
float_X is the number of floats in a row so float_2 would be 8 bytes
and a byte is 1 byte
a word is 2 bytes
4) So knowing this lets look at the first line
dword constant00
this tells us our first 4 bytes are 00 and if we check this they are
5) The next line is
dword numBones
so the Number of bones is in the next 4 bytes
which shows us 2C 00 00 00 so that converts into 00 00 00 2C
and 2C in decimal is 44
so now we know we have 44 bones
6) The next part is
struct Bone {
float_16 Matrix4X4
}
so this means we have a float which is 4 bytes then the underscore 16 means each bone has 16 floats
so in decimal we do 4 x 16 = 64 then we convert this number to hex which is 0x40
we multiply 0x40 bye the number of bones 2C and we get B00
If you highlight this section you should get a screen looking just like mine
7) The next line is
dword numVerts
this means the next 4 bytes tell us how many verts we will have in our model
so we take AE 01 00 00 and convert it to 00 00 01 AE and that equals 430
so there are 430 vertexes.
8 The next line is the most important for the tutorial
float_3 CoordXYZ
this means we have a float which is 4 bytes and we have 3 in a row representing x , y z coordinates.
so our first set of cordiantes should look like this
X)FE F8 A1 BE
Y)00 00 C8 36
Z)4A CA BF BD
9) The next line
float Weight
means the next 4 bytes are the weighting information
00 00 80 3F
10) the next 4 lines tell us what bones our weighting information has influence on
byte BoneID01
byte BoneID02
byte NULL1
byte NULL2
22 00 00 00
break these apart byte by byte so this vertex is effected bye bone 22 and 00
you can ignore the NULL parts
11)This next line tells us our normal coordinates
float_3 NormalXYZ
it is a float value so its 4 bytes and it is in a series of 3 so its 12 bytes total
X)08 7D 7D BF
Y)E2 5A 0D 3E
Z)AC 99 B1 BC
12) The last line of the vertex definition tells us our UV coordinates.
float_2 TexCoordUV
U)BB DA 08 3F
V)F2 60 7A 3F
so it is again a float of 4 bytes and there are 2 in a row so it is 8 bytes total
13) The next line tells us how many faces we have
dword numFaces
so it is a dword of 4 bytes
98 01 00 00 so convert it to 00 00 01 98 and in decimal that is 408
so we have 408 Faces
14)The next 2 lines tell us the face structure
struct Face {
word_3 FaceIndices123
}
so we have a word 2 bytes and 3 in a row so thats 6 bytes
so 408 / 3 = 158
15) Now to the converting the vertex part
highlight the whole vertex section and copy it into a new hxd file called vertex.dat
start offset B0C
end offset 4E3B
length 4330
16)now we use float2txt on our dat file
float2txt.exe vertex.dat vertex.txt 10
we take the arguments float2txt.exe input file output file number of floats
we choose 10 because there are 10 groups of 4 bytes that make up our vertex structure.
17)now we open excel and it will ask is this a delimited file choose tab and space check boxes and hit import.
you will end up with columns a - j
18)delete columns d - j so you are only left with
a b and c
inert a column before a and fill it with the letter v until you reach the end of your vertex list
(line 430)
19) save the file as a csv file
open the file in hxd
do a replace and replace in hex 2C with 20
and save the file as testobj.txt
20)now open your file in wordpad and paste the following header
Code: Select all
# 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
# File Created: 26.09.2009 19:47:31
mtllib test.mtl
#
# object NET
#
Code: Select all
# 430 vertices
21)Open your file in deep exploration and see the boots