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.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

mariokart64n is one of the best 3D experts, especially for scripts, I know.
So this should be a very good start (didn't check the videos , though).
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?"
dibe91
mega-veteran
mega-veteran
Posts: 223
Joined: Tue Jul 29, 2014 9:06 am
Has thanked: 3 times
Been thanked: 14 times

Re: Extracting simple models

Post by dibe91 »

shakotay2 wrote:mariokart64n is one of the best 3D experts, especially for scripts, I know.
So this should be a very good start (didn't check the videos , though).
while I was watching his channel on youtube, I realized that moreover, also created the tutotial on importing models of gmod of Facepunch!
ajspeed11
n00b
Posts: 11
Joined: Sat May 07, 2011 10:22 pm
Has thanked: 3 times

Re: Extracting simple models

Post by ajspeed11 »

Hey shakotay2,

I was wondering if you could help.

I'm trying to get the track an car models from destruction derby.

I know the car model and tracks are contained in the same file called Level001.001.
I know this because the textures of both the cars and track are contained in the file Level001.000.

I have found several blocks of letters, I think these are part of the face indices,
but I'm not 100%.

They start at 00007522.

http://www.mediafire.com/download/idadx ... VEL001.001

Any help would be much appreciated.

Excellent tool by the way!
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

ajspeed11 wrote:I have found several blocks of letters, I think these are part of the face indices,
but I'm not 100%.

They start at 00007522.
as word indices it gives this:
80 69 100
87 1 1802
11265 225 604

So it's very unlikely that it's FIs.

Divide the file up into sections with similar data, search for patterns, structures.
Since it's name is "LEVEl" there's a chance that it contains map data, at these offsets for example:

6B80 .. 8C00
9470 .. AED0
B378 .. C6C8

Nice riddle (I'm a little bit tired of nice riddles :D ).

You could search for point clouds, also:
LEVEL001.JPG
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?"
ajspeed11
n00b
Posts: 11
Joined: Sat May 07, 2011 10:22 pm
Has thanked: 3 times

Re: Extracting simple models

Post by ajspeed11 »

Thanks for your reply.

I haven't got a clue what I'm doing but I'm trying :)

Thanks for the help. the track is oval so the point cloud image you've uploaded looks promising.

I'll try this out later.
Thanks again
ajspeed11
n00b
Posts: 11
Joined: Sat May 07, 2011 10:22 pm
Has thanked: 3 times

Re: Extracting simple models

Post by ajspeed11 »

I've been playing around with numbers and this is the best I can do atm.

any suggestions where I maybe going wrong?

Thanks
You do not have the required permissions to view the files attached to this post.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

First of all: start with 200 vertices that obviously form a part of a mesh.

2ndly: look at the face indices - you need to understand that those are very unlikely to build faces
f 5 1 10461
f 1 166 1

Without having an understanding how 3D meshes are built you will fail.

Start any 3D app, blender for example, it's free.
Create a cube, export it as wavefront obj (cube1.obj). In the obj file delete one face line (f a b c).
Reimport the obj file, see which face is missing.

In Edit mode, there's Vertex, Edge and Face selection modes.
In Face select mode delete another face, export the mesh to obj (cube2.obj).

Compare cube2.obj to cube1.obj.
Understand what happened.

Then you could try to find suiting face indices for the 200 vertices mentioned above.
Looks as if they were hard to find.

So before you start a blind search you really should try to give the file a structure.
The sequence 05 04 00 28 for example is contained 626 times. (Dunno whether it's some kind of start or end marker.)
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?"
devmode
beginner
Posts: 27
Joined: Mon Jun 06, 2016 7:51 pm
Has thanked: 6 times
Been thanked: 5 times

Re: Extracting simple models

Post by devmode »

shakotay2 ,

Just in theory - it's possible to re-create H2O on 3ds Max as Script? :)
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

possibly. But who would and why?
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?"
ajspeed11
n00b
Posts: 11
Joined: Sat May 07, 2011 10:22 pm
Has thanked: 3 times

Re: Extracting simple models

Post by ajspeed11 »

I've looked over everything you suggested. searched the 05 04 00 28 pattern and found another pattern. they both can be found in the other level files. but still cant find anything that looks like it would create a face.

Thanks for your help this far shakotay2.
but i haven't got a clue what to do now.
Acewell
VIP member
VIP member
Posts: 1330
Joined: Wed Nov 05, 2008 12:16 pm
Has thanked: 2710 times
Been thanked: 884 times

Re: Extracting simple models

Post by Acewell »

i like how Hex2obj calculates the vertex count after pressing go1 so i tried to
duplicate this behavior in python :D

Code: Select all

   indiceslength = bs.readInt()
	faceCount = indiceslength // 2          #2 for word, 4 for dword
	list = []
	for i in range(faceCount):
		blah = bs.readUShort()            #UShort for word, UInt for dword
		list.append(blah)
	vertexCount = max(list) + 1
	vertexStride = vertexblocklength // vertexCount

this comes in handy when you only know the vertex and face indices block length
and you need to know the number of vertices and vertex stride when it changes
from model to model :D

i think i can work this into the marvel script to detect the change in stride so the
user doesn't have to go into the script and change it by hand :D


also i have a couple feature requests
can you add the ability to autofill the step 3 "count" after pressing "go1"
and can you add the currently opened file name to the title bar
:D
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

AceWell wrote:

Code: Select all

	vertexCount = max(list) + 1
seems you're on a good way becoming a programmer now :D
can you add the ability to autofill the step 3 "count" after pressing "go1"
yeah, I was thinking of this from the beginning but I didn't do it for "educational" reasons.
(There's no understanding when things are done automatically.)

Second and excluding reason is this: imagine the face indices count is chosen wrong, i.e. too big (very likely for noobs)
then the assumed vertex count is probably wrong and the displayed mesh will be a mess or, even worse, the meshviewer crashes.

I could think of an options menu point but the hex2obj code uses an ancient way of creating its controls (such as buttons and edit boxes) via CreateWindow() to keep it simple (no subwindows for example).
Best would be to place an extra small unnamed button for a "manual autofill" :D if that helps.
and can you add the currently opened file name to the title bar :D
was thinking about it; it's on my todolist now :)
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?"
kbr0n
ultra-n00b
Posts: 3
Joined: Sat Sep 10, 2016 9:34 am
Has thanked: 1 time

Re: Extracting simple models

Post by kbr0n »

hello shakotay2

I´m very much a n00b but I like challenges so I've been trying to understand how hex2obj works for the past few days. No success until now hehe

I have some doubts concerning the tutorial, maybe you can help me understand them better!

1. How can we tell if a certain value is v, vn or vt? Is there a certain range of values that make sense for one but not for other?
I saw your previous post where you say to create a cube on blender, then export it as obj and analyze the values. Would this approach help?


2. When calculating the "FVF SIZE", if i see something like:

f 1 2 3
f 4 5 6
f 4 7 5
f 8 6 5

how can I know where the block ends to figure out how many 4 bytes are in the block?

3. How can I identify if the faces are WORD or DWORD type?

4. How can we check if it's Little Endian or Big Endian? (I know "1000 dec is stored as E8 03 (as opposed to 03 E8 in big endian" but how can I test this?)

5. What is a "half float" and why it's important to know it uses 2 bytes only?? How can we know when it's a "half float"

6. To find the "START ADDRESS OF NORMALS" you used 0x2B2E (WHERE DID THIS VALUE CAME FROM???) - 0x156C (SIZE OF NORMALLS LIST) = 0x15C2

7. "This would be the size of the uv list:
8 x 457= 3656 = 0xE48 (8: 2 floats with 4 bytes for uv data)"

Could you explain why did you use 8? Where can we see these 2 floats?

8. Should the results of GO1 always start with f 1 2 3?

9. what are those 3 mysterious checkboxes with no labels?

10. How exactly can we search for Cloud Points? Which parameters should be tempered with to get it?


I made some notes to get things a bit easier, could you take a look to see if I got this right?

[face index count] = [face index table size] / [size of the face indices ]

[amount of face indices] = ([end address] - [start address])/2

[start of vertices] = [start of face index table] + ([face Index Count] * 2)

[ SIZE OF UV LIST ] => (# of floats x 4 bytes) x vertex count

UV START ADDRESS = (START ADDRESS -xC) - (SIZE OF UV LIST)

SIZE OF NORMALS LIST = 12 X face index count

START ADDRESS OF NORMALS = (UVS START ADDRESS ???)- SIZE OF NORMALS LIST (this is the one that I could not follow from the tutorial)

VERTICES START ADDRESS => [SIZE OF NORMALS LIST] - [START ADDRESS OF NORMALS]


thank you, and keep up the good job!
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 4288
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 1149 times
Been thanked: 2243 times

Re: Extracting simple models

Post by shakotay2 »

kbr0n wrote:hello shakotay2
hello, kbr0n,
1. How can we tell if a certain value is v, vn or vt? Is there a certain range of values that make sense for one but not for other?
for vn the sum of square components is 1.0
For v, vt we generally can't say much, especially when half floats are used. It's a mix of trial and error and experience.
2. When calculating the "FVF SIZE", if i see something like:

f 1 2 3
f 4 5 6
f 4 7 5
f 8 6 5

how can I know where the block ends to figure out how many 4 bytes are in the block?
I don't see a relationship between FVF size and face indices, so don't know what you mean.
3. How can I identify if the faces are WORD or DWORD type?
in most cases words are used;
when you see something like 00 00 00 00 01 00 00 00 02 00 00 00 then it's DWORDs because 0 0 1 0 2 0 as face indices would not make much sense.
4. How can we check if it's Little Endian or Big Endian? (I know "1000 dec is stored as E8 03 (as opposed to 03 E8 in big endian" but how can I test this?)
you can't - simply toggle the 'litE' button to find it out. Consoles like PS3 use big endian.
When floats are used look at the start of vertices block: if it's like 3F 12 34 99 the it's big endian.
5. What is a "half float"
google helps; half precision floating point that needs 16 bits only
and why it's important to know it uses 2 bytes only??
it*s important to know for every binary format how many bytes it uses. But in fact, it's not important for you because hex2obj cares for it - you only need to chose float, HFloat, etc.
How can we know when it's a "half float"
we can't - just try it out. In case hex2obj displays unusual values in the lower left listbox then your choice was probably wrong.

"How can we know whether the values are unusual?" It's a matter of experience.
6. To find the "START ADDRESS OF NORMALS" you used 0x2B2E (WHERE DID THIS VALUE CAME FROM???) - 0x156C (SIZE OF NORMALLS LIST) = 0x15C2
I've have answered this already: viewtopic.php?f=29&t=14695&p=121012&hilit=2B2E#p121012
7. "This would be the size of the uv list:
8 x 457= 3656 = 0xE48 (8: 2 floats with 4 bytes for uv data)"

Could you explain why did you use 8? Where can we see these 2 floats?
uvs have two components: tx, ty
You'll know it from experience some day that it's floats. Or read the tut again; I explained how to recognize floats.
8. Should the results of GO1 always start with f 1 2 3?
nope
9. what are those 3 mysterious checkboxes with no labels?
click them - most of them should tell you what they're good for (it's for more experienced users only)
10. How exactly can we search for Cloud Points? Which parameters should be tempered with to get it?
there is no recipe. It's trial and error and experience. And it's a matter of giving files a structure.
There's dozens of examples where I showed point clouds. Look at the sample files in a hexeditor
at the vertices start address I used.

I made some notes to get things a bit easier, could you take a look to see if I got this right?
(the ones I didn't comment look ok to me.)

[amount of face indices] = ([end address] - [start address])/size of FIs
[start of vertices] = [start of face index table] + ([face Index Count] * size of FIs)
maybe -
but most samples I checked start with vertices, then FIs to follow (or UVs, then FIs).
UV START ADDRESS = (START ADDRESS -xC) - (SIZE OF UV LIST)
can't remember such a format; would require the uv's block to be located before the vertex block.

SIZE OF NORMALS LIST = 12 X max face index count; if floats are used
START ADDRESS OF NORMALS = (UVS START ADDRESS ???)- SIZE OF NORMALS LIST (this is the one that I could not follow from the tutorial)
ignore it - try out some of the dozens of samples I've extracted so far.
(hex2obj doesn't care for normals, btw.)
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?"
kbr0n
ultra-n00b
Posts: 3
Joined: Sat Sep 10, 2016 9:34 am
Has thanked: 1 time

Re: Extracting simple models

Post by kbr0n »

thank you so much for your attention
really appreciated!
"I don't see a relationship between FVF size and face indices, so don't know what you mean."
I´ll try to explain better!

after pressing GO1, we can check if it's sequential or blocked. I thought analyzing face indexes
we could determine that. Am I wrong??

So, if I see this:

f 1 2 3
f 4 5 6
f 4 7 5
f 8 6 5


wouldnt it be of blocked type?

in that case, how can I know where the block ends?
Post Reply