READ THE RULES: Click here

Follow us on Facebook: https://www.facebook.com/xentax/ :)

Prince of Persia 2008 vertex data

Post questions about game models here, or help out others!
Post Reply
Turfster
veteran
Posts: 92
Joined: Fri Dec 16, 2005 2:12 am
Been thanked: 10 times
Contact:

Prince of Persia 2008 vertex data

Post by Turfster » Tue May 12, 2009 4:34 am

Been staring myself blind on this one for far too long.
I've figured out a few of the other formats (getting somewhere with the character meshes was actually easier), but I can't put my finger on this 28 byte vertex format used for static stuff.
Following the standard "first 12 bytes are 4 32bit floats for x/y/z" the others use gives me way too many NANs to be right.
(The last 8 bytes are probably uvs like for the others tho)

It's probably blindingly obvious, but can someone else take a look at it and shine the light of understanding for me because it's driving me crazy ;)

Anyway, attached 2 example files.

JCT4_OB1_FAKE.415D9568
vertexdata start offset 106 (528 vertices, 14784 bytes)
triangle data start offset 14890 (667 triangles, 4002 bytes)

OB_OBJ_Lamp_04.415D9568
first object
vertexdata start offset 107 (567 vertices, 15876 bytes)
triangle data start offset 16711 (538 triangles, 3348 bytes)
You do not have the required permissions to view the files attached to this post.

fatduck
mega-veteran
mega-veteran
Posts: 315
Joined: Wed Aug 02, 2006 10:07 pm
Has thanked: 10 times
Been thanked: 93 times

Re: Prince of Persia 2008 vertex data

Post by fatduck » Tue May 12, 2009 1:33 pm

Just have a quick look on those files!
The verts position are NOT in float format!
They should be a 16bits signed integer * scale factor
So the first 6 bytes are 3 16bits signed integer XYZ

And the last 8 bytes are definate 2 float UV value.

Right before the UV should be 4 unsigned 8bits color value, which should be Vertex Color!

A interesting value on offset 7-8(the forth 16bits signed integer) are always 3/-3 !?


Hope this help!
No more Fatduck, no more FatImporter, Byebye everyone!

Turfster
veteran
Posts: 92
Joined: Fri Dec 16, 2005 2:12 am
Been thanked: 10 times
Contact:

Re: Prince of Persia 2008 vertex data

Post by Turfster » Wed May 13, 2009 12:01 am

Doh, thanks.
I'd tried with float16s, but they weren't fractional, so I'd abandoned and moved on. -_-
(really weird storage method btw, if the 4th 16 bit value is positive, you need to change the sign of the xyz values)

Post Reply