Page 1 of 1

Anno 2070

Posted: Mon Nov 07, 2011 2:08 pm
by aluigi
the following is the QuickBMS script for the rda archives of Anno 2070 (aka anno5):
http://aluigi.org/papers/bms/anno5.bms

Re: Anno 2070

Posted: Sat Jan 17, 2015 11:07 am
by datahaven
Great work! Thanks, aluigi. Thank you for QuickBMS, too - I use it a lot. It helped me get up to speed on this little project very quickly.

How To Rip 3D Models From Anno 2070
-------------------------------------

Run aluigi's script to unpack the data:

Code: Select all

quickbms anno2070.bms "C:\Program Files (x86)\Steam\SteamApps\common\Anno 2070\maindata\Data2.rda"
I recommend you do this in a separate directory from the installation directory.

Now you can open the .rdm files in 010 Editor and interpret them with the template below:

Code: Select all

//------------------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File:     Anno2070_RDM.bt
// Author:   Adrian Dale
// Revision: 1.0
// Purpose:  Unpack Anno 2070 .rdm 3D model files
//------------------------------------------------

typedef struct {
    DWORD strLen;
    DWORD dummy;
    char str[strLen];
} AnnoString;

typedef struct {
    ushort i1;
    ushort i2;
    ushort i3;
} AnnoTriangle;

typedef struct
{
    hfloat x;
    hfloat y;
    hfloat z;
    ushort padding;
    float ntx; // Normal Tangent
    float nty;
    float ntz;
    hfloat u;
    hfloat v;
} AnnoVertexData;

char RDMTag[3];

// Check for header
if( RDMTag != "RDM" )
{
    Warning( "RDM Tag not valid. Template stopped." );
    return -1;
}

char dummy;
DWORD unknown1[8];
DWORD dataLen;
DWORD unknown2[11];
DWORD offsetToStr1;
DWORD offsetToStr2;
DWORD unknown3[16];
AnnoString as1;
AnnoString as2;
DWORD unknown4[34];
AnnoString as3;
DWORD unknown5[46];
DWORD vertexCount;
DWORD vertexDataSize;

AnnoVertexData vertexData[vertexCount];

DWORD indexCount;
DWORD indexDataSize;

AnnoTriangle triangles[indexCount / 3];
If you don't have a copy of 010 Editor, then you could maybe write a Noesis plugin, or roll your own perl/python/whatever script to parse the data. The template ought to be clear enough to specify the format.

Note that this template unfortunately doesn't work on all of the .rdm files. I think some of them have extra data sections that I've not bothered to work out yet. It worked on most of the building files, which was what I wanted to see.

To get the data into a useable format (in this case, .obj) you'll need to write a script something like this:

Code: Select all

//--------------------------------------
//--- 010 Editor v5.0 Script File
//
// File:     RDM_to_OBJ.1sc
// Author:   Adrian Dale
// Revision: 1.0
// Purpose:  Convert Anno 2070 .rdm model
//           to Wavefront .obj format
//--------------------------------------

int ConvertRDMToOBJ(string filename)
{
    int activeFile = FileOpen(filename);
    if (activeFile < 0)
    {
        Warning( "File %s could not be opened\n", filename );
        return -1;
    }

    FileSelect(activeFile);
    RunTemplate("Anno2070_RDM.bt", false);

    char outputFileName[] = FileNameSetExtension(GetFileName(), ".obj");
    int outFile = FileNew("Text", false);

    FileSelect(activeFile);
    int i;
    for( i = 0; i < vertexCount; i++ )
    {
        FPrintf(outFile, "v %f %f %f\n", vertexData[i].x, vertexData[i].y, vertexData[i].z);
    }

    // Normals? - all zero, anyway
    //for( i = 0; i < vertexCount; i++ )
    //{
    //    FPrintf(outFile, "vn %f %f %f\n", vertexData[i].ntx, vertexData[i].nty, vertexData[i].ntz);
    //}

    for( i = 0; i < vertexCount; i++ )
    {
        FPrintf(outFile, "vt %f %f\n", vertexData[i].u, vertexData[i].v);
    }
    for( i = 0; i < indexCount / 3; i++ )
    {
        FPrintf(outFile, "f %d/%d %d/%d %d/%d\n", triangles[i].i1 + 1, triangles[i].i1 + 1,
                                        triangles[i].i2 + 1, triangles[i].i2 + 1,
                                        triangles[i].i3 + 1, triangles[i].i3 + 1);
    }
    
    FileSelect(outFile);
    FileSave(outputFileName);
    FileClose();

    FileSelect(activeFile);
    FileClose();
    return 0;
}

ConvertRDMToOBJ(GetFileName());
This one closes the opened file after converting it - I did that so I could call it in bulk over lots of .rdm files at once. You may want to edit that out if you're only interested in single files.

Textures are in .dds format, so to make sense of the data you'll probably need to flip them upside down in an image editor in order for the uv coordinates to be correct.

Adrian

Re: Anno 2070

Posted: Sat Aug 15, 2015 2:18 am
by Valkorion
Sorry for the noob question, but I don't get how you create the wavefront object file from the 010 template text output.

I am actually new to coding and i have been looking for Anno models for ages, and I just learned about 010 and a potential to extract models today, i don't know if what i am doing is right, but i have made the template and the script, but i don't know next what to do in 010 Editor, how i convert or export it the model. I am stuck here.

Thanks, Valkor.

Re: Anno 2070

Posted: Sat Aug 15, 2015 2:45 am
by Valkorion
Valkorion wrote:Sorry for the noob question, but I don't get how you create the wavefront object file from the 010 template text output.

I am actually new to coding and i have been looking for Anno models for ages, and I just learned about 010 and a potential to extract models today, i don't know if what i am doing is right, but i have made the template and the script, but i don't know next what to do in 010 Editor, how i convert or export it the model. I am stuck here.

Thanks, Valkor.
Ok never mind, i think i have everything under control, i just needed to run the script with the template name and then boom, have the OBJ. file in my directory.

Thanks for the resources, people ;)

Re: Anno 2070

Posted: Fri Jul 29, 2016 1:22 am
by Dkox
datahaven wrote:Great work! Thanks, aluigi. Thank you for QuickBMS, too - I use it a lot. It helped me get up to speed on this little project very quickly.

How To Rip 3D Models From Anno 2070
-------------------------------------

Run aluigi's script to unpack the data:

Code: Select all

quickbms anno2070.bms "C:\Program Files (x86)\Steam\SteamApps\common\Anno 2070\maindata\Data2.rda"
I recommend you do this in a separate directory from the installation directory.

Now you can open the .rdm files in 010 Editor and interpret them with the template below:

Code: Select all

//------------------------------------------------
//--- 010 Editor v5.0 Binary Template
//
// File:     Anno2070_RDM.bt
// Author:   Adrian Dale
// Revision: 1.0
// Purpose:  Unpack Anno 2070 .rdm 3D model files
//------------------------------------------------

typedef struct {
    DWORD strLen;
    DWORD dummy;
    char str[strLen];
} AnnoString;

typedef struct {
    ushort i1;
    ushort i2;
    ushort i3;
} AnnoTriangle;

typedef struct
{
    hfloat x;
    hfloat y;
    hfloat z;
    ushort padding;
    float ntx; // Normal Tangent
    float nty;
    float ntz;
    hfloat u;
    hfloat v;
} AnnoVertexData;

char RDMTag[3];

// Check for header
if( RDMTag != "RDM" )
{
    Warning( "RDM Tag not valid. Template stopped." );
    return -1;
}

char dummy;
DWORD unknown1[8];
DWORD dataLen;
DWORD unknown2[11];
DWORD offsetToStr1;
DWORD offsetToStr2;
DWORD unknown3[16];
AnnoString as1;
AnnoString as2;
DWORD unknown4[34];
AnnoString as3;
DWORD unknown5[46];
DWORD vertexCount;
DWORD vertexDataSize;

AnnoVertexData vertexData[vertexCount];

DWORD indexCount;
DWORD indexDataSize;

AnnoTriangle triangles[indexCount / 3];
If you don't have a copy of 010 Editor, then you could maybe write a Noesis plugin, or roll your own perl/python/whatever script to parse the data. The template ought to be clear enough to specify the format.

Note that this template unfortunately doesn't work on all of the .rdm files. I think some of them have extra data sections that I've not bothered to work out yet. It worked on most of the building files, which was what I wanted to see.

To get the data into a useable format (in this case, .obj) you'll need to write a script something like this:

Code: Select all

//--------------------------------------
//--- 010 Editor v5.0 Script File
//
// File:     RDM_to_OBJ.1sc
// Author:   Adrian Dale
// Revision: 1.0
// Purpose:  Convert Anno 2070 .rdm model
//           to Wavefront .obj format
//--------------------------------------

int ConvertRDMToOBJ(string filename)
{
    int activeFile = FileOpen(filename);
    if (activeFile < 0)
    {
        Warning( "File %s could not be opened\n", filename );
        return -1;
    }

    FileSelect(activeFile);
    RunTemplate("Anno2070_RDM.bt", false);

    char outputFileName[] = FileNameSetExtension(GetFileName(), ".obj");
    int outFile = FileNew("Text", false);

    FileSelect(activeFile);
    int i;
    for( i = 0; i < vertexCount; i++ )
    {
        FPrintf(outFile, "v %f %f %f\n", vertexData[i].x, vertexData[i].y, vertexData[i].z);
    }

    // Normals? - all zero, anyway
    //for( i = 0; i < vertexCount; i++ )
    //{
    //    FPrintf(outFile, "vn %f %f %f\n", vertexData[i].ntx, vertexData[i].nty, vertexData[i].ntz);
    //}

    for( i = 0; i < vertexCount; i++ )
    {
        FPrintf(outFile, "vt %f %f\n", vertexData[i].u, vertexData[i].v);
    }
    for( i = 0; i < indexCount / 3; i++ )
    {
        FPrintf(outFile, "f %d/%d %d/%d %d/%d\n", triangles[i].i1 + 1, triangles[i].i1 + 1,
                                        triangles[i].i2 + 1, triangles[i].i2 + 1,
                                        triangles[i].i3 + 1, triangles[i].i3 + 1);
    }
    
    FileSelect(outFile);
    FileSave(outputFileName);
    FileClose();

    FileSelect(activeFile);
    FileClose();
    return 0;
}

ConvertRDMToOBJ(GetFileName());
This one closes the opened file after converting it - I did that so I could call it in bulk over lots of .rdm files at once. You may want to edit that out if you're only interested in single files.

Textures are in .dds format, so to make sense of the data you'll probably need to flip them upside down in an image editor in order for the uv coordinates to be correct.

Adrian
Hi datahaven can you help with a anno 2205 version ?

Re: Anno 2070

Posted: Fri Jul 29, 2016 1:32 am
by OperateSystemP
Dkox wrote: Hi datahaven can you help with a anno 2205 version ?
Was it really worth bumping a year old thread just for that?
I would assume Anno 2205 would use the same, if not similar compression as Anno 2070.