Page 3 of 5

Re: R2 Online models

Posted: Thu Feb 12, 2009 2:54 am
by Theran
Here's the correct goblin thingy from a few posts back. I had an error with loading the texture that was flipping the image. I noticed it on the in game image of the girl and found that I didin't need to flip it.

Re: R2 Online models

Posted: Thu Feb 12, 2009 3:54 am
by chrrox
That looks much better you are doing a great job and a great speed also :)
If you want any more models i will post some for you and in game screens if needed.

Re: R2 Online models

Posted: Thu Feb 12, 2009 4:12 am
by Theran
chrrox wrote:That looks much better you are doing a great job and a great speed also :)
If you want any more models i will post some for you and in game screens if needed.
Thanks! I always thought these models were really nice looking. But I have all the 'character' models and textures extracted so I can view/test them all easily now; well except at work.

I also got alpha textures working so they'll look a bit nicer now.

Re: R2 Online models

Posted: Thu Feb 12, 2009 7:57 am
by pixellegolas
impressive!

Re: R2 Online models

Posted: Fri Feb 13, 2009 2:39 pm
by pixellegolas
I am updating this thread all the time, waiting for more info. A real cliffhanger :) R2 has very beautiful models. Hope to get models and animations later on to analyze them totally :)

Re: R2 Online models

Posted: Fri Feb 13, 2009 5:16 pm
by Theran
Ya, sorry I haven't been able to update it recently. I did try to play around with what I believe is the bone data for the model. By default, as many 3d models are, the given vertex data is in a standard pose; in the case of R2, they are in a standing with their arms slightly fanned out from the side. However my attempt was not successful and it really messed up the model lol.

So if anyone has any good links to any kind of helpful info please let me know. I will also update the model format for the "rmb" files. I'd say it's about 85% complete with the last 15% in the "I have no idea" or "I think it's formatted like this" category. So expect this sometime this weekend.

I will also release the code I have for viewing the models that I posted. It's built in C# (though it should be easily ported to C++ or other languages) and runs using OpenGL for it's graphics using sample code from NeHe Productions (http://nehe.gamedev.net/ which is a great site).

Hoping to have this by Saturday.

Re: R2 Online models

Posted: Sun Feb 15, 2009 2:07 pm
by zardalu
Excellent, looking forward to it!

Re: R2 Online models

Posted: Sun Feb 15, 2009 9:20 pm
by Theran
Note that this applies to only RMB files.

Code: Select all

DWORD itemFlag;
DWORD unknown[4];
DWORD textureCount;
DWORD meshCount;
DWORD boneCount;
DWORD dataOffset;

struct string {
  char filename[260];
} textures [textureCount];

struct mesh {
  DWORD index; // 0?
  DWORD unknown1; // -1?
  char meshName[64]; / name of mesh
  char parent[64]; // name of parent bone
  DWORD extraFlag;
  DWORD unknown2; // 1?
  DWORD vertexCount; // number of vertices
  DWORD indexCount; // number of indices

  //no idea what the next 2000 bytes are, so just skip it, sure it's relevant somehow...
  byte data[2000];
} meshes[meshCount];

// next area is the bone information which I left I work...though it's still mostly incomplete, will add this in tomorrow
// for now, can skip to the dataOffset location
struct meshData {
  floatx3 pos[meshes[index].vertexCount];
  floatx3 nomral[meshes[index].vertexCount];
  floatx2 uv[meshes[index].vertexCount];
  floatx3 unknown1[meshes[index].vertexCount];
  floatx3 unknown2[meshes[index].vertexCount];
  if (mesh[index].extraFlag == 1) {
    floatx4 boneWeights[meshes[index].vertexCount];
    WORDx4 boneMatrixIndex[meshes[index].vertexCount];
  }
  WORD indices[meshes[index].indexCount];
} meshData[meshCount];

That's basically it...rather messy I know but it's enough to display/render the mesh in it's default pose. When reading the mesh data it's laid out like so:
positional data (3 floats x,y,z)
vertex normal data (3 floats nx,ny,nz)
texture coords (2 floats u,v)
unknown data (3 floats)
unknown data (3 floats)
*It's possible that this could be some kind of translational or rotational values.
if (extraFlag == 1)
bone weight data (4 floats x,y,z,w)
bone matrix data (4 WORD values)
end if


I'm off to do some rock climbing so I will post my source later today.

Re: R2 Online models

Posted: Sun Feb 15, 2009 9:44 pm
by chrrox
Very nice work i look forward to playing around with the source code.

Re: R2 Online models

Posted: Mon Feb 16, 2009 8:49 pm
by Theran
OK! Here's the C# project I've been using to render the loaded meshes. It's fairly simple to use. It runs on OpenGL so make sure you have that which most should. The project is a Visual Visual C# Express 2008 (express editions are free to download from Microsoft's website) project but can/should be easily converted to different languages/versions.

The majority of the code is in the TestGL.cs file and the important methods are:
readRMB (loads the rmb file)
loadImage (loads the dds files and generates the OpenGL textures for them)
loaded (called when the form is done loading, which is after the rmb file is loaded, so that it knows when to load the textures)
OnPaint (does the rendering)

the "readRMB" method has the filename hard coded into it like so:

Code: Select all

        const string path = "C:\\models\\";
        private void readRMB() {
            string meshFile = path + "p070000.rmb";
            ...
        }
This line just points to the location of the extracted rmb files

Code: Select all

const string path = "C:\\models\\";
And it assumes that the extracted textures are located a directory inside this folder and is named "texture"
So the full path to the rmb file would be as such:

Code: Select all

C:\\models\\p070000.rmb
And the texture folder would be:

Code: Select all

C:\\models\\texture\\
Not very elegant but it works. Ideally the code should work smarter but I just kept it like this because I was lazy and it was easy :P

If anyone wishes to expand on what I got and make the animations/skinning work, by all means do so. I have limited knowledge on that subject but I'm gonna research it a bit more and update if necessary.

Re: R2 Online models

Posted: Mon Feb 16, 2009 10:13 pm
by chrrox
Very nice work works great. I will try to implement a drag and drop method for loading the files and if i can figure it out hopefully a way to control the camera with the mouse.

Re: R2 Online models

Posted: Mon Feb 16, 2009 11:19 pm
by pixellegolas
great work! Alot of thumbs up and star ratings for you. Let's hope someone with skills can pick this up and expand

Re: R2 Online models

Posted: Tue Feb 17, 2009 3:13 am
by chrrox
I found a c# tutorial for loading animations from milk shape 3d files which could be applied here as it is just a different file format.
http://www.sichbo.ca/Free_Code/Milkshap ... and_OpenGL

I almost got drag and drop working but it does not load the textures ill figure it out.
edit "doh i think I will get this working soon i am a fool lol"

Re: R2 Online models

Posted: Thu Feb 19, 2009 5:20 pm
by Karpati
Today I released the 3D Object Converter v4.221 update at 17:10.

You can update your installed application (version>=4.0) quickly and easily using the auto-update function (Help/Check for updates).


My program currently supports 8 different uncompressed types of the DirectDraw Surface *.dds texture format. The R2: Reign of Revolution uses the compressed .dds format.

When I wrote and tested my .rmb loader module I used the following procedure to get the texture shaded view (in my program):

- Convert the .dds files into .jpg files using the Irfanview's batch converter module.
- Run the 3D O.C.
- Check out the Options/Import/Default texture file extension (.jpg)
- Turn on the 'Options/Import/Set the default texture file extension in the material table after load'
(This will replace the .dds file extension to .jpg automatically after load your object)

(Or you can use the 'Tools/Set the default texture file extension in the material table after every load if you would like...)

- Save settings.
- Apply settings.
- Load the .rmb file.


http://web.t-online.hu/karpo

Re: R2 Online models

Posted: Fri Feb 20, 2009 5:20 pm
by Theran
Very nice.