Free Game Research Forum - Official QuickBMS support - Twitter @zenhax
It is currently Tue Jan 24, 2017 11:27 pm

All times are UTC

Post new topic  Reply to topic  [ 1 post ] 
Author Message
 Post subject: Extracting simple models
PostPosted: Sun Nov 06, 2016 8:57 pm 

Joined: Sun Sep 25, 2016 12:24 am
Posts: 3
Hi! Today i see a good tutorial about how to extract simple models, in the Xentax forum.
Is a program make by shakotay2. He understand much about models, and this forum
dont have tutorials about it.


The original link: http://forum.xentax.com/viewtopic.php?f=29&t=10894

"It should allow u to extract 3D models with simple formats.
Means such games like Mafia2 or SleepingDogs not to be supported.

- preliminary -

Ok, the truth is - there are two things you should understand:

the hexadecimal numeral system (base 16) using the "numbers" 0..9, A..F
So 0x123 is 291 decimal.
(To avoid confusion with other numbering systems the hex numbers are marked with 0x or an 'h'.)

Secondly you should be able to use a hex editor.

If you don't have these two skills leave now, and come back as soon as you gained them.

(If you don't have a clue which hex editor to use: TinyHexer or HexEdit by A.W. Phillips should do the trick.)

As I said you don't need to learn "basics" but you'll have to understand
"the structures" to use hex2obj.

o So here is a short tutorial on it's use.

You don't need to know the technical terms - I just use them habitual.

Simple 3D models consist of vertices and faces.

hex2obj needs the following infos to perform it's task:
the startaddress of the vertices and the one of the faceindices.

(Some experience is required to find them but it's not too hard.)

Secondly we need the vertices count and the faceindices count.

I will explain this with a model example soon but now for the structures -

the two most common are:
a) "sequential"

v x,y,z
v x,y,z
v x,y,z
v x,y,z
vn x,y,z
vn x,y,z
vn x,y,z
vn x,y,z
vt x,y
vt x,y
vt x,y
vt x,y

(v: vertex position, vn: normals, vt: uv)
With a sequential model you only need to provide the above mentioned counts.

b) "blocked"

v  x,y,z
vn x,y,z
vt x,y

v  x,y,z
vn x,y,z
vt x,y

With a blocked model you need to chose the vertex block size (FVF size), for example 32.
(And 'yes': the order might be v, vt, vn for example)

If you don't understand anything you'll have to do a trial 'n error.

Or you calculate the FVF size: each coordinate (x, y or z) consists of 4 bytes.
So the above two blocks have a blocksize of 32 (8x4) each.

It might be a little bit more difficult if there are DWORDs contained in the blocks.
But anyway the most common blocksizes are 32, 40, 52. Sometimes 24, 44, 48 whatever.

o the v,vn,vt patterns to search for

well, to identify what is v, vn or vt is the tricky part. This is for little endian
(for big endian the patterns are in reverse order of course).

v: xx xx xx nn with nn= 42..44 (these are rough values only, can also be 3F, 40)
vn: value of each component 0.0 .. 1.0 (1.0 = 00 00 80 3F)
square sum of components is 1.0 (autocalculated by hex2obj)
vt: value of each component 0.0 .. 1.0

It's important to know that half floats use two bytes only.

o Now lets start analysing our first model
(We don't care for normals because they can be autogenerated in most 3D tools.)
We leave the "LitE" button as it is (little endian data).

The face indices are very easy to find since parts of the indices block look like a scrambled alphabet.

If we scroll through hw_bu_000.bm in a hex editor we'll find this:


To find the correct ending of the list is a very important step.
Here it's rather easy (0x4845) because it's bound by a string size (09 000000)
and the corresponding string.

mapping of the tutorial example:
0x56 ..0x15C1 vertices
0x15C2..0x2B2D normals
0x2B2E length DWord and string "Texture"
0x2B39..0x3980 uvs, length: 0xE48
Rest of the tutorial to be found in the zip. Because you need to start hex2obj.exe
to get full use of the tutorial.

---------- >>> version 0.24c <<< ----------
- uv preview
- allows face indices > 65535 (for non-tristripped meshes)

Having up to 3 or 4 downloads per day atm I feel obliged to tell you guys once again:
hex2obj is NOT a one-click-solver tool - it was designed to help people to help themselves.

If you don't have a basic understanding of 3D model formats you surely will get better results using a 3D ripper (for PC).

With this said I think it's time to make a check list for noobs concerning the analyzing of 3D models:

1) is the data compressed?
Try offzip if your unsure (works for zip compressed data only) or search for a decompressing tool.
(There's also Quickbms scripts for many archive formats.)

2) is it model data, texture data or animation data?
Use TextureFinder for textures.
Some 3D models may contain both: model data and texture(s)

3) Before using hex2obj on a difficult format try out some of the dozens of simple samples on Xentax.

4) Then try out to get a point cloud  from your specific model as a first step.

Look for continuous data sections with a size of 1 kB at least (0x400).

Yeah, what the heck does that mean: "continuous data"?

Hard to explain - in fact you'll need experience for that.
If there's gaps with more than 10 zero bytes for example I'd say it's not continuous data.

While float data is easy to recognize (with some experience) it's
rather hard to find vertex data in short/Word format.

The v0.21 H2O format changed slightly. So you can't use it with elder versions of the hex2obj.
hex2obj (v0.21) can read elder H2O files and will convert them to v0.21 when saving them.

(Be aware that there are various possible combinations of little/big endian, seq/VB, WORD/DW, noStrips/Strips and half floats/or not.
With any new version dozens of functions to be updated so there might be another bug.)

---------- These outdated versions should be used as a fallback only! ------------
v. 0.22

v 0.23b, exe only
Introduces "multi mesh" creation and the table button.

known bugs: v0.1: TriStrips starting on even addresses only
v0.2: wrong HF-uvs displayed in list box; ok with 0.2x
v0.2x: max. address= 0xFFFFFF
v0.22: for rare cases when there is a '.' in a folder name:
........ model names without extension require a .mdl to be added before loading the model
v0.22c: TriStrips, superfluous degenerated faces
v0.23d: MMesh feature accidently disabled
v0.23d-f intermediate versions with bug, don't use!
v0.24a uvs preview (float/VB)

reported bugs:
v0.21: wrong clipping for HF uvs
........ kao issue
v0.24: libgcc_s_dw2-1.dll missing on W7, W8 (due to CodeBlocks/MinGW update)

todo list


Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Hail to the mighty god of hex reversing!

Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 1 post ] 

All times are UTC

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited