Important information: this site is currently scheduled to go offline indefinitely by end of the year.

Extracting simple models

Read or post any tutorial related to file format analysis for modding purposes.
TGE
veteran
Posts: 109
Joined: Wed Jun 04, 2014 7:48 pm
Location: Netherlands
Has thanked: 20 times
Been thanked: 36 times
Contact:

Re: Extracting simple models

Post by TGE »

shakotay2 wrote:just combine the pieces (23, 24 or 13 vertices for example):
luci_pb_6SMs.JPG
Sadly I'm not interested in these models so I won't waste more time on this.
Thanks for helping me out so far, I appreciate it
Too bad you're not interested in the models :/
Where does the actual vertex data start in the FF 40 01 65 blocks?
Whenever I import an obj ripped through hex2obj I get a vertex coordinate too big error.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

TGE wrote:Where does the actual vertex data start in the FF 40 01 65 blocks?
with an offset of 12 bytes.
Whenever I import an obj ripped through hex2obj I get a vertex coordinate too big error.
have a look into the created test.obj and delete such line
v 2.66814e+024 -0.633696 -0.604305
and all following "vertices"

I made two maxscripts to import the faceshape and the hair mesh.
Luci_2SMs.JPG
You might try to adapt them for other submeshes.
View my thread in the models forum.
You do not have the required permissions to view the files attached to this post.
Last edited by shakotay2 on Thu Aug 21, 2014 5:25 pm, edited 1 time in total.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
aaiki14
ultra-n00b
Posts: 3
Joined: Wed Nov 09, 2011 10:05 am

Re: Extracting simple models

Post by aaiki14 »

i still cant get it, i cant understand the tutorial
how about this model https://drive.google.com/file/d/0B1a-gF ... sp=sharing
would you like to explain it to me?
how do i get the face indices in this file?
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

aaiki14 wrote:i still cant get it, i cant understand the tutorial
it's not a matter of understanding the tutorial for simple models. Sometimes the faceindices are harder to find.
how about this model https://drive.google.com/file/d/0B1a-gF ... sp=sharing
would you like to explain it to me?
how do i get the face indices in this file?
From a quick view this could be a starting point for face indices: 0xF6C4, but not sure.
Also hex2obj can't handle them, you'd need a script.

Did you try to get a point cloud?
wsx-PointClouds.JPG
This model format exceeds my 15 min per model "border line".
It's a rather big file. Don't you have a smaller one?
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
lucasestevescosta
ultra-n00b
Posts: 3
Joined: Tue Sep 02, 2014 2:40 pm

Re: Extracting simple models

Post by lucasestevescosta »

Nice job man
SomeTemp
ultra-n00b
Posts: 3
Joined: Wed Aug 27, 2014 11:49 am
Has thanked: 1 time

Re: Extracting simple models

Post by SomeTemp »

Hi, pls i would like to knw what format it surports
I'm a idiot, but please help me XD
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

hex2obj doesn't have a "list of supported formats".
It's a helper tool to display simple models after you analyzed the format you're interested in.

"Analysing" means you'll have to find out the start addresses of the face indices and the vertices.
(For more information: read the tutorial.)


thread list:
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
zdsmdbh
n00b
Posts: 19
Joined: Wed Nov 13, 2013 3:03 am
Has thanked: 43 times
Been thanked: 3 times

Re: Extracting simple models

Post by zdsmdbh »

Hi,shakotay
I am confused about "UV pos" in hex2obj
What's that?

viewtopic.php?f=16&t=10960
For this thread
0x29C is vertices start address,vertex block is 40
so 0x29C~0x2C4 is a vertex block.
In these 40 bytes,first 12 bytes are verices coordinate
Others,I just can't figure it out.

What will be included in a vertex block?
Vertex coordinate
Vertex normal
UV
That's all?
Even thought they are all float,and UV have 3 coordinate,they are only 4*9=36 bytes
Why this vertex size is 40?
Is there anything else inside vertex block?
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

Hi,
"UV pos" is the starting position of the uv data in the vertex (stride) block.
The bytes 0 to 11 are used by 3 floats (first vertex),
the bytes 12 to 15 are two half floats for tx, ty, the uv data.
arcadia_mdl-uv.jpg
You can expect to find a second texture set in the vertex block.
As you can see there's another 3E 16 37 66 following.
Also weights/boneIDs might be found in a vertex block (did not check this here).

Hex2obj will be kept simpel (so I never handle normals, for example, which can be easily autogenerated in most 3D tools)
When analyzing I restrict myself to the data I'm interested in.
You'll never find me doing a 100% reversing of a format.
So you'll need to find out for yourself what the unhandled 20 bytes are good for. :D
zdsmdbh wrote:Why this vertex size is 40?
depends on the decision of the developers.
What data they chose to be contained and the formats they use.
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
zdsmdbh
n00b
Posts: 19
Joined: Wed Nov 13, 2013 3:03 am
Has thanked: 43 times
Been thanked: 3 times

Re: Extracting simple models

Post by zdsmdbh »

shakotay2 wrote:Hi,
"UV pos" is the starting position of the uv data in the vertex (stride) block.
Thanks!That really help me.

How did you judge vertex block size?

0x2A8~0x2AB: 3E 16 37 4A 0x2AC~0x2AF: 3E 16 37 4A
0x2D0~0x2D3: 3E 12 37 65 0x2D4~0x2D7: 3E 12 37 65
0x2F8~0x2FB: 3E 16 37 66 0x2FC~0x2FF: 3E 16 37 66

Repeat every 40 bytes
So you judge vertex block size on that or you have others method?
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

yep, on repeating patterns or using the knowledge that it's generally a multiple of 4 (in some rare cases it's multiple of 2, iirc 18 for example)

(Some games which I don't remember atm use model files containing a vertexbuffer "type".)
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
zdsmdbh
n00b
Posts: 19
Joined: Wed Nov 13, 2013 3:03 am
Has thanked: 43 times
Been thanked: 3 times

Re: Extracting simple models

Post by zdsmdbh »

Will you realease a tutorial about how to analysis bones&weights? :D
I can write maxscript to import mesh,but I don't know how bones&weights stored in files.No mention import them. :cry:
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

zdsmdbh wrote:Will you realease a tutorial about how to analysis bones&weights? :D
I don't feel experienced enough with this, so 'no'.

But I'm planning some kind of crash course on "How to build a skeleton from hex data".
It's primary use is to spare me time, as always.

(Could end up in some other "helper tool" some day, but that's a little bit unsure
because it's hard to "keep things simple" here.)

In the meantime you could look up the max scripts of chrrox, TaylorMouse or zaramot for example.
Search for 'weight'.
In general it goes like this (pseudo code):

for j = 1 to vertex_count do (
...
read bone1_id
read bone2_id
read bone3_id
read bone4_id
read weight1
read weight2
read weight3
read weight4
)

Might also be
read bone1_id
read weight1
...

Very easy, isn't it? :)

But other than with hex2obj where you get an immediate feedback
whether your entered parameters are ok or not
when pressing the mesh button
I don't have any idea how to accomplish this for skeletons.

I was checking the source of a model viewer with a "show skeleton" feature
but I lost too much time in understanding (10% :D )/changing it.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
zdsmdbh
n00b
Posts: 19
Joined: Wed Nov 13, 2013 3:03 am
Has thanked: 43 times
Been thanked: 3 times

Re: Extracting simple models

Post by zdsmdbh »

Hi,shakotay
I have been look up some maxscript with bone import
but I have to say I am really confused because there is no comments.

Here's a X format file(text version)
I guess these data are used to create bone.
But I just don't understand how to do it via maxscript.
Frame root_ground {


FrameTransformMatrix {
-0.000000,1.000000,0.000000,0.000000,-0.000000,-0.000000,1.000000,0.000000,1.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,1.000000;;
}

Frame root_hips {


FrameTransformMatrix {
-0.000000,-0.000000,1.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-1.000000,0.000000,-0.000000,0.000000,49.748032,-0.000008,0.000006,1.000000;;
}

Frame pelvis {


FrameTransformMatrix {
-0.051403,-0.223888,0.973259,0.000000,-0.011808,0.974615,0.223577,0.000000,-0.998608,0.000000,-0.052742,0.000000,0.000000,0.000000,0.000000,1.000000;;
}

Frame leg_left_thigh {


FrameTransformMatrix {
0.973258,0.223577,-0.052742,0.000000,-0.223888,0.974615,0.000000,0.000000,0.051403,0.011808,0.998608,0.000000,7.420700,0.832138,-4.649714,1.000000;;
}
I have been write a maxscript to import mesh
Could you edit it to support bone and weights?
Since there is no facing-newbie bone import tutorial,and these files are text files,there are much easier than binary files
I think this is good for me and others newbies to start import bone.
Thanks! :D
http://www.mediafire.com/download/9uuq0 ... format.rar

Code: Select all

fname = getOpenFileName \
caption:"Select a X format file" \
types:"DirectX(.x)|*.x" \
historyCategory:"DirectXObjectPresets"
f = openfile fname

Vert_array = #()
Face_array = #()
Normal_array = #()
UV_array = #()

RDL= readline f

while (RDL != " TextureFilename {") do (RDL = readline f)
texture_name = readvalue f

while (RDL != " Mesh  {") do (RDL = readline f)
mesh_count = readvalue f
for i=1 to mesh_count do
(
	x = readvalue f
	y = readvalue f
	z = readvalue f
	append Vert_array [x,y,z]
	readline f
)

face_count = readvalue f
for i=1 to face_count do
(
	readvalue f
	p1 = readvalue f
	p2 = readvalue f
	p3 = readvalue f
	append Face_array [p1+1,p2+1,p3+1]
	readline f
)

while (RDL != "  MeshNormals  {") do (RDL = readline f)
normal_count = readvalue f
for i=1 to normal_count do
(
	n1 = readvalue f
	n2 = readvalue f
	n3 = readvalue f
	append Normal_array [n1,n2,n3]
	readline f
)

while (RDL != "  MeshTextureCoords  {") do (RDL = readline f)
UV_count = readvalue f
for i=1 to UV_count do
(
	x = readvalue f
	y = readvalue f
	append UV_array [x,1-y,0]
	readline f
)

msh = mesh vertices:Vert_array faces:Face_array
msh.numTVerts = UV_array.count
buildTVFaces msh
for j = 1 to UV_array.count   do setTVert  msh j UV_array[j]
for j = 1 to face_array.count do setTVFace msh j face_array[j]

close f

texture_path = sysInfo.currentdir
if texture_path[texture_path.count] != "\\" do texture_path += "\\"
texture_path += texture_name

new_mat = StandardMaterial()
new_mat.diffuseMap = Bitmaptex()
new_mat.diffuseMap.filename = texture_path
new_mat.showInViewport = True
msh.Material = new_mat
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4283
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1146 times
Been thanked: 2242 times

Re: Extracting simple models

Post by shakotay2 »

zdsmdbh wrote:Hi,shakotay
I have been look up some maxscript with bone import
but I have to say I am really confused because there is no comments.
Hi zdsmdbh,
did you try out "Import Diablo III App.ms" from TaylorMouse to import Adria for example?

Then you could read some MaxScript online help to understand functions like
BoneSys.CreateBone and skinOps.ReplaceVertexWeights for example.

Here's a X format file(text version)
I guess these data are used to create bone.
But I just don't understand how to do it via maxscript.
Well, that's a boring task to write some kind of text parser. (I remember dainazinas using his frostbite maxscript to read textfiles.)
Frame root_hips {


FrameTransformMatrix {
-0.000000,-0.000000,1.000000,0.000000,-0.000000,1.000000,0.000000,0.000000,-1.000000,0.000000,-0.000000,0.000000,49.748032,-0.000008,0.000006,1.000000;;
}
That should be a 4x4 rotation matrix and the position (x,y,z, w=1.0).
I have been write a maxscript to import mesh
Could you edit it to support bone and weights?
Nice script! :) Well, reading the boneNames and SkinWeights from a textfile should not be too hard. I'm sure you can do that by yourself but me? To be honest, I left that kind of workflow long ago.

Getting the bones' hierarchy is a little bit harder - I would suggest to treat the skeleton seperately.

I imported the GuanYinPing.x to assimp then exported as dae and imported to blender.
Sadly I couldn't change to pose mode though the hierarchy was shown correctly.
Something went wrong and I couldn't export the skeleton to smd.
GuanYinPing.JPG
(hmm, I think I will export an SMD (skeleton only) to .x then load it with assimp and export as dae again to see what's going wrong there...)
You do not have the required permissions to view the files attached to this post.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
Post Reply