Extracting simple models

Read or post any tutorial related to file format analysis for modding purposes.
User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Sun May 01, 2016 8:48 pm

guess, you mean "block mode" (such as vx,vy,vz, nx,ny,nz, tx,ty) because in hex2obj's "mixed mode" UVpos is 99 per definition
and the uvs are in a separate block

but 'yes', it's a known problem with hex2obj and there's an ugly workaround using the "mixed" instead of "block" mode:
set UVpos to 99, set start UVblock (UVB) to start of vertices - 4 and 'size of UVB' to FVFsize.
In step 3 choose HF_UV.

--------------------------
btw: using a negative UVpos in "block mode" wouldn't solve the problem, because the next vertex address to handle
after having read 3 vertex floats
is calculated by addr += UVpos -12
and after having read the uvs -> addr += bytesToSkip
where bytesToSkip= VBsize-12 ; bytesToSkip -= (UVpos-12 + 4) // 4: size of 2 half floats

Guess, an additional variable vertex position will be required for a proper solution and there are
6 functions to be handled (since it makes no sense to have that feature for float/HFloat only):

VertexBlock(), VertexBlock_UV_HF(), VertexBlock_allHF()
VertexBlock_UVs_Word(), VertexBlock_all_Word(), VertexBlock_VShort_UVs_Word()

This would end up in a more or less complete rewrite of code.
Last edited by shakotay2 on Sun May 01, 2016 9:09 pm, edited 1 time in total.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1814
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 45 times
Been thanked: 1290 times

Re: Extracting simple models

Post by daemon1 » Sun May 01, 2016 9:06 pm

shakotay2 wrote:there's an ugly workaround using the "mixed" instead of "block" mode
Thanks for the reply. How could I not think about it? :)

This workaround is not that ugly actually.

User avatar
OriginOfWaves
beginner
Posts: 37
Joined: Wed Jun 08, 2011 1:58 pm
Location: Nish, Serbia
Has thanked: 25 times
Been thanked: 10 times
Contact:

Re: Extracting simple models

Post by OriginOfWaves » Sun May 01, 2016 10:15 pm

thanks a bunch man, you are a gem. could you explain how you got the FVF size? i would like to know for future reference. i think you're right and that there is just one submesh and those extra Fls are for other LODs. Anyways i found the UVs at pos 52 and HF_UV, they do however need to be flipped and readjusted.

Image Image

so these are the numbers for anyone else trying to extract meshes form Mirror's Edge Catalyst Beta

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Sun May 01, 2016 11:30 pm

OriginOfWaves wrote:could you explain how you got the FVF size?
it's a matter of patterns in most cases - here 3C 02 03 01
for example, which is repeated after 56 bytes
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1814
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 45 times
Been thanked: 1290 times

Re: Extracting simple models

Post by daemon1 » Mon May 02, 2016 4:16 pm

OriginOfWaves wrote:could you explain how you got the FVF size?
After you get faceindices, you have number of vertices. Just divide the full size of vertex/UV block by that, and you get FVF size.

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Mon May 02, 2016 5:03 pm

daemon1 wrote:Just divide the full size of vertex/UV block by that, and you get FVF size.
yep, but in this special case that won't help. Look at 0x2C610 (3246x56) in magrope_skin.chunk and you'll see that you're "at the edge of nowhere".

How should anyone know that this is the "full size"?
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

daemon1
M-M-M-Monster veteran
M-M-M-Monster veteran
Posts: 1814
Joined: Tue Mar 24, 2015 8:12 pm
Has thanked: 45 times
Been thanked: 1290 times

Re: Extracting simple models

Post by daemon1 » Mon May 02, 2016 7:26 pm

shakotay2 wrote:yep, but in this special case that won't help.
Sorry, I didn't look into the file. Really strange. Two vertex blocks one after another. And the second one is not LOD1 model, it has 2666 vertices and 14560 faces, FVFsize 28. Model looks exactly the same, but I can't see any UV's there.

User avatar
OriginOfWaves
beginner
Posts: 37
Joined: Wed Jun 08, 2011 1:58 pm
Location: Nish, Serbia
Has thanked: 25 times
Been thanked: 10 times
Contact:

Re: Extracting simple models

Post by OriginOfWaves » Tue May 03, 2016 9:28 pm

shakotay2 wrote:
daemon1 wrote:Just divide the full size of vertex/UV block by that, and you get FVF size.
yep, but in this special case that won't help. Look at 0x2C610 (3246x56) in magrope_skin.chunk and you'll see that you're "at the edge of nowhere".

How should anyone know that this is the "full size"?
well aren't i lucky to run into files that are special and bend the rules [roll]

anyways, i seem to have come upon a weird issue while digging through a certain file. and while i can find the face indices and vertices and display the mesh easily and quickly for both LOD0 and LOD1 versions of the model, i can only seem to find the UVs for the second (LOD1) lower resolution mesh. no mater what settings i try for the first (LOD0) mesh i can't find the UVs in the block. i even tried the mixed mode by setting the UV pos to 99 changing the UV size and pointing to the start of where i thought the UVs are, but still no luck. i think i read through this file in the HEX Editor so many times that everything blurs back together now :?

So if anyone smarter and more focused than me has the time to look at the file i uploaded and let me know what i'm missing, i'd greatly appreciate it. just when i thought i figured these models out, they throw a curve at me :(

anyways here is the file (.mesh and .h2o) http://www.mediafire.com/download/cl3ru ... ample1.zip

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Wed May 04, 2016 4:36 pm

OriginOfWaves wrote:
shakotay2 wrote:, i can only seem to find the UVs for the second (LOD1) lower resolution mesh.
but it's not in the H2O in your zip, is it?

Anyway, creating some kind of address map for that .mesh would help, I guess.
Here's what I found so far:
faith_1.jpg
(maybe it's the uvs you found already, dunno)
OriginOfWaves wrote:well aren't i lucky to run into files that are special and bend the rules [roll]
if you mean the "rules" from the hex2obj tutorial: they were defined for simple model formats, for special ones you'll need experience, as you may know (now :D )
You do not have the required permissions to view the files attached to this post.
Last edited by shakotay2 on Wed May 04, 2016 7:03 pm, edited 1 time in total.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

User avatar
OriginOfWaves
beginner
Posts: 37
Joined: Wed Jun 08, 2011 1:58 pm
Location: Nish, Serbia
Has thanked: 25 times
Been thanked: 10 times
Contact:

Re: Extracting simple models

Post by OriginOfWaves » Wed May 04, 2016 6:59 pm

but it's not in the H2O in your zip, is it?

Anyway, creating some kind of address map for that .mesh would help, I guess.
Here's what I found so far:
faith_1.jpg
(maybe it's the uvs you found already, dunno)
thanks for the help again man.

those are the uvs for the high resolution mesh that you have found, that's what i was missing. looks like i was wrong about the start of the vertices, like by a lot. i really thought that they would be at the beginning of the file because that is the first mesh. if i was wrong about the start of the vertices how was i able to display the mesh correctly? how did you find the start of the vertices anyways? did you use the equation from your tutorial?

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Wed May 04, 2016 7:49 pm

I scanned the file in steps of 4897*24 bytes, at no avail.
Then I went backwards from 0x1D5B40, but from the data I saw that the FVFsize was different.

I can't give general rules for such, it's creativity or something like that based on simple rules.

For files with a size of 2 MB it could help to write down some kind of address mapping, steps of 4897*24 bytes, here, for example.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Sun Jun 12, 2016 5:01 pm

well, 2000 downloads of hex2obj so far (and maybe 5 regular users? :D )

Time for a new feature: autogenerated face indices. You might try it out with the
policeman model from this thread: viewtopic.php?f=16&t=13494&p=114317&hil ... es#p114317
Hex2obj_024d.zip
(exe only - hex2obj_0.24c.zip required!)

Since autocreated face indices don't fit very well in most cases you're free to create your own
FIs.txt file which should look like this:

#comment line, required!
f 1/1 2/2 3/3
f 4/4 5/5 6/6
f 3/3 5/5 7/7
f . . .
Should reside in the model file's folder with Fake selected.

If you need the test.obj only for testing (without uvs) you can reduce FIs.txt like this:

#comment line, required!
f 1 2 3
f 4 5 6
f 3 5 7
f . . .

(Maximum face index may not exceed vertex count!)
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

cmr14
n00b
Posts: 14
Joined: Mon Jun 20, 2016 9:17 pm
Been thanked: 1 time

Re: Extracting simple models

Post by cmr14 » Tue Jun 21, 2016 4:26 pm

shakotay2 wrote:well, 2000 downloads of hex2obj so far (and maybe 5 regular users? :D )
Hi master, I have a problem with a file of Valentino Rossi the game (2016) of milestone.
I tried import myself a file model 3d of a helmet, but it has not worked for me.. I follow the tutorial but something dont work.. (im spanish, my english is very bad)
In vertices count the number is 65281 and the file is 217kb.. something its wrong :(
Can you help me? Here is the file :

http://www.mediafire.com/download/y05fa ... ET_020.BIN

I dont know if someone (or you) can export the model, but I want to learn the metod of edit the file and import in blender for editing.
Please help me, thanks in advance master!

User avatar
shakotay2
MEGAVETERAN
MEGAVETERAN
Posts: 2652
Joined: Fri Apr 20, 2012 9:24 am
Location: Nexus, searching for Jim Kirk
Has thanked: 653 times
Been thanked: 1362 times

Re: Extracting simple models

Post by shakotay2 » Tue Jun 21, 2016 10:14 pm

cmr14 wrote:Hi master,
Just to keep you informed, “There is no Master but the Master,”
and in this forum he's called MrAdults. :D
I tried import myself a file model 3d of a helmet, but it has not worked for me.. I follow the tutorial but something dont work..
the vertices are half floats - those are not so easy to identify for beginners.

I myself didn't get it within the magic 15 minutes, to be honest. (Took me nearly an hour - but I was distracted a little bit watching soccer in tv.)
helmet_020-bin.jpg
You do not have the required permissions to view the files attached to this post.
Bigchillghost, Reverse Engineering a Game Model: viewtopic.php?f=29&t=17889
extracting simple models: viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip
"You quoted the whole thing, what a mess."

cmr14
n00b
Posts: 14
Joined: Mon Jun 20, 2016 9:17 pm
Been thanked: 1 time

Re: Extracting simple models

Post by cmr14 » Wed Jun 22, 2016 12:22 am

shakotay2 wrote:I myself didn't get it within the magic 15 minutes, to be honest. (Took me nearly an hour - but I was distracted a little bit watching soccer in tv.)
Mmm well, finally the error its mine haha
Can you tell me some tips for work on this files? only for this game.
I know this is very difficult, but I really interesting in editing this game.. Can you help me?
Thanks for you reply and thanks for your work!!!

Post Reply