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

R2 Online models

Post questions about game models here, or help out others!
pixellegolas
ultra-veteran
ultra-veteran
Posts: 423
Joined: Mon Aug 11, 2008 11:30 pm
Has thanked: 27 times
Been thanked: 15 times

R2 Online models

Post by pixellegolas »

Hi!

In another thread we found tools to open the protected archives for this game. Now I want to know if someone could take a look at the file structure for models to see if we can convert to something useful. Thanks in advance

Here is the thread:

viewtopic.php?f=10&t=3255
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Only had a small time to look at it but this is what I got so far using the same file from the thread posted above:

Code: Select all

file name: c00001.rmb (assuming rmb = model and rab = animation)
DWORD unknown1[6]; // sample file had the first 24 bytes set to 0
DWORD textureCount; // (?) value was 1 - total count for all model/objects in file?
DWORD modelCount; // (?) value was 1 - total count for all model/objects in file?
DWORD boneCount; // value was 9 and matches the number of "Bone##" entries in the .rab file. also position 0x1C had the value of 9 in the .rab file so I'm assuming this is correct. 
DWORD dataOffset; // this should be correct as well.
char textureFilename[260]; // file name is 0 terminated and then padded to fit at least 260 bytes (which is the maximum length for a path in Windows)
DWORD unknown2[2]; // no idea what this means, could be file padding, file had the following values: 0x00000000 and 0xFFFFFFFF

// file position: 0x130, contains the word "Box03", will get back to this later since I'm currently at work
char objName[64]; // name/reference or something, 64 bytes long, mainly filled with 0's
char name[64]; // same as above, has the name 'root' but that appears multiple times up to the dataOffset value
DWORD unknown3[2]; // (?) could be the modelCount/textureCount like above for this model/object?
DWORD vertexCount; // should be correct as well
DWORD indexCount; // should be correct

// position 0x1C0 to 0x670 is filled with zeros (no idea why or what this means)
DWORD indexCouint; // again the value is here...

// next 396 bytes are all 0 as well...
DWORD vertexCount; // again the value is here...

// 400 bytes later we get to a value of 0xFFFFFFFF
// now at position 0x998
DWORD count; // no idea. file had the value of 4
DWORD values[count]; // assuming the previous 'count' value means the number of values in some kind of DWORD array. file contained the following values: 1, 2, 5, 8

// 64 bytes later...
// file position 0x9EC
// Bone information!
struct Bone[boneCount] {
    char name[64]; // name of bone
    char parent[64]; // name of parent
    float4x4 matrixInfo[3]; // 3 4x4 matrix structures (pos, scale, rot?)
    DWORD childCount; // ?, possible... or index
    DWORD childrenIndex[]; // something like this
} // this structure is still a bit confusing to me, but I do see some patterns


As mentioned, I'm at work and will get back to this later. I will skip this part though, for now, and start at the data offset position.
Last edited by Theran on Wed Feb 11, 2009 8:17 am, edited 2 times in total.
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Opps..think I got the vertex/index count switched...have a meeting will fix later
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Ok, fixed the order for the vertex/index count. I've been looking over the data for the vertex data and, although they are floats, the values don't make much sense to me. I haven't found an order for position, uv coords or anything like that yet. The size is 56 bytes in length which consists of 14 float values; based on the data I saw.

Code: Select all

struct vertex {
    float data[14]; // I don't know the exact structure. yet...
} 

vertex vertices[vertexCount]; 


Immediately following the vertex data is what I believe is the bone weight list. Seems to be a group of 4 floats for each vertex. In the sample file, there were 140 vertex. 140 * 4 * 4 = 2240 bytes, which works out well for this file.

Code: Select all

struct boneWeights {
    float weights[4]; // bone weights? only saw 3 values: 0, 1, 0.5
}

boneWeights weights[vertexCount];
After this seems to be another list of data for each vertex. It's either a list of 2 DWORD values or 4 WORD values. I do not know what this represents.

This brings us to the last 1032 bytes of the file, which represent the index values. Which fits nicely since this file had a value of 516 for indexCount, which gives us 516 WORD pair values totaling 1032 bytes.

Code: Select all

WORD indices[indexCount]; 
pixellegolas
ultra-veteran
ultra-veteran
Posts: 423
Joined: Mon Aug 11, 2008 11:30 pm
Has thanked: 27 times
Been thanked: 15 times

Re: R2 Online models

Post by pixellegolas »

hm, I am very glad that you started to look at these files. I can in no way help you out when it comes to hexing this so I just hold my thumbs. I looked at the archives and there is no other file format then the ones i provided.

I wish you good luck and hope to see some results

Thanks
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Ya, I'll take a look at it this weekend now that I have more files to look at.
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Re: R2 Online models

Post by Mr.Mouse »

Nice going, Theran! :D
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

So I had a thought earlier today while looking at a different file from R2. I'm thinking the vertex data section is in itself in sections. Meaning that the first section is all the position elements (vertexCount * 3 * 4), then follows normals (vertexCount * 3 * 4), uv coords, etc...

I'm still taking a look at them but having it in this way makes a bit more sense with the values. Now I could be wrong on the order since I haven't had a chance to put any of the values into a simple 3d application.

Will need to test this out a bit more, but this layout makes some sense.
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Ok, does seem to be in a format like I mentioned. Vertex positional data is first, but after that I don't know. It could be normals, followed by the uv's, but I need to get the texture for it so that'll be something I'll do tonight.

I'm attaching some images for what I got so far. The first image is using what I believe to be the normal values. The second image is using computed normals.
Images rendered with OpenGL

Edit: Seems I can only do one attached file at a time, so next post will have the second image.
You do not have the required permissions to view the files attached to this post.
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

And here's the second:
You do not have the required permissions to view the files attached to this post.
chrrox
Moderator
Posts: 2602
Joined: Sun May 18, 2008 3:01 pm
Has thanked: 57 times
Been thanked: 1422 times

Re: R2 Online models

Post by chrrox »

Wow that is great news you are so close to having a model viewer.
Thanks for all your hard work on this project.
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

It's definitely a good start, but there's still a lot of info in there that we still don't know yet but we'll get there.
pixellegolas
ultra-veteran
ultra-veteran
Posts: 423
Joined: Mon Aug 11, 2008 11:30 pm
Has thanked: 27 times
Been thanked: 15 times

Re: R2 Online models

Post by pixellegolas »

Yeah definitly cool! I saw that objects in game have another format. .r3m

I wonder if a model + texture of a static object would make things easier?

I provide the easist i can see:

R_danger_Alpha.r3m 2kb
R_danger_Alpha.dds 1kb
You do not have the required permissions to view the files attached to this post.
Theran
beginner
Posts: 37
Joined: Wed Jun 11, 2008 6:49 pm
Been thanked: 4 times

Re: R2 Online models

Post by Theran »

Ya, I saw some of those as well. I will check tomorrow since I'm getting attacked by my allergies today and heading home.
Mr.Mouse
Site Admin
Posts: 4073
Joined: Wed Jan 15, 2003 6:45 pm
Location: Dungeons of Doom
Has thanked: 450 times
Been thanked: 682 times
Contact:

Re: R2 Online models

Post by Mr.Mouse »

Offtopic: Your allergies? What up? I've got all kinds, though, basically allergic to all kinds of stuff, what are yours?
Post Reply