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

Textures of Beta Diablo 3, ".tex" files converter needed :)

Get your graphics formats figures out here! Got details for others? Post here!
Tabris
n00b
Posts: 18
Joined: Thu Jan 27, 2011 2:56 am

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Tabris »

anhhungmeo1234 wrote:Hey Falo! How to extract D3's mpq and how to open model of diablo 3
to extract it's pretty simple, you just need this :

http://www.zezula.net/en/mpq/download.html

But to convert it into .obj files, I don't know, I'm waiting like you the answer of Falo :)
User avatar
Falo
advanced
Posts: 78
Joined: Fri Oct 23, 2009 1:29 pm
Been thanked: 33 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Falo »

- extract "CoreData.mpq\PhysMesh\*.phm"

use this 010 Editor Script:

Code: Select all

//--------------------------------------
//--- 010 Editor v3.2.1 Binary Template
//
// File: Diablo III *.phm
// Author: Falo
// Revision: 1.0
//--------------------------------------
struct{
    ubyte DEADBEEF[16];
    uint unk1[5];
    int ofsMeshHeader;
    int sizeMeshHeader;

    if(ofsMeshHeader)
    {
        FSeek(ofsMeshHeader + 16);
        struct MESHHEADER meshheader;
    }
}HEADER;

struct MESHHEADER{
    float unk1[18];
    int unk2;
    int numVerts;
    int numFaces;
    int unk3;
    int unk4;
    int unk5;
    int ofsVerts;
    int sizeVerts;
    int ofsFaces;
    int sizeFaces;
    int ofsUnk1;
    int sizeUnk1;
    int ofsUnk2;
    int sizeUnk2;
    int ofsUnk3;
    int sizeUnk3;

    struct{
        FSeek(ofsVerts+16);
        struct FLOAT3 vert[numVerts]<optimize=false>;
    }Vertices;

    struct{
        FSeek(ofsFaces+16);
        struct FACE3 face[numFaces]<optimize=false>;
    }Faces;

    struct{
        FSeek(ofsUnk2+16);
        int test2;
    }Unk2;

    struct{
        FSeek(ofsUnk1+16);
        int test1;
    }Unk1;
};

struct FLOAT3{
    float x;
    float y;
    float z;
    Printf("v %f %f %f\n",x,y,z);
};

struct FACE3{
    int f1;
    int f2;
    int f3;
    int unk1;
    int unk2;
    int unk3;
    int unk4;
    Printf("f %d %d %d\n",f1+1,f2+1,f3+1);
};
Tabris
n00b
Posts: 18
Joined: Thu Jan 27, 2011 2:56 am

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Tabris »

I'm very sorry about that, but I'm a big noob in script and stuff...

I've copied/paste your script into a .bms file, run it in MultiEx commander then choose a .phm file to extract.

And this message appear :

"Multiex 3 could not process, error :18"

Am I doing it in a wrong way ?
Last edited by Tabris on Sat Sep 10, 2011 12:23 pm, edited 1 time in total.
User avatar
Falo
advanced
Posts: 78
Joined: Fri Oct 23, 2009 1:29 pm
Been thanked: 33 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Falo »

Tabris wrote:I'm very sorry about that, but I'm a big noob in script and stuff...
I've copied/paste your script into a .bms file, run it in MultiEx commander then choose a .phm file to extract.
It's not a bms script, it's a 010 Editor Binary Template, you need 010 Editor for it,
it's a quick written c script, anyone can use the infos to make an exporter tool.
SirLoon
advanced
Posts: 45
Joined: Fri Dec 18, 2009 5:26 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by SirLoon »

Falo wrote:
Tabris wrote:I'm very sorry about that, but I'm a big noob in script and stuff...
I've copied/paste your script into a .bms file, run it in MultiEx commander then choose a .phm file to extract.
It's not a bms script, it's a 010 Editor Binary Template, you need 010 Editor for it,
it's a quick written c script, anyone can use the infos to make an exporter tool.
for meshes it works, for scenes dont, but they look like same type with just different header
btw i didnt knew that 010 editor got such interesting features :)
anhhungmeo1234
beginner
Posts: 20
Joined: Sun Aug 15, 2010 9:48 am

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by anhhungmeo1234 »

where are character's model ?
SirLoon
advanced
Posts: 45
Joined: Fri Dec 18, 2009 5:26 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by SirLoon »

anhhungmeo1234 wrote:where are character's model ?
ClientData.mpq Appearance maybe, im not sure with that
SirLoon
advanced
Posts: 45
Joined: Fri Dec 18, 2009 5:26 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by SirLoon »

i found maybe vertices in scenes but im not sure so dont kill me if im wrong :)
Scenes/trOut_Sub80x80_Fields_CaveEntranceC.scn vertices start at 266c h. But i cant find any face definition. can anybody correct me if im wrong?

here is extracted file, but as i said i cant find faces :( i dont know where open it without them
You do not have the required permissions to view the files attached to this post.
BoyC
beginner
Posts: 36
Joined: Wed Jul 05, 2006 9:24 pm
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by BoyC »

Falo wrote:- extract "CoreData.mpq\PhysMesh\*.phm"
Aren't those only the collision meshes for the physics simulation? From what I've seen the interesting stuff is in the .app files.
SirLoon
advanced
Posts: 45
Joined: Fri Dec 18, 2009 5:26 pm
Has thanked: 2 times
Been thanked: 3 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by SirLoon »

BoyC wrote:
Falo wrote:- extract "CoreData.mpq\PhysMesh\*.phm"
Aren't those only the collision meshes for the physics simulation? From what I've seen the interesting stuff is in the .app files.
all mesh, try trDun_StartScreen.phm this one looks great ;)
User avatar
Falo
advanced
Posts: 78
Joined: Fri Oct 23, 2009 1:29 pm
Been thanked: 33 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Falo »

working on it:
Image
BoyC
beginner
Posts: 36
Joined: Wed Jul 05, 2006 9:24 pm
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by BoyC »

Falo wrote:working on it:
Image
Oh I see you export into a format you can read with DE. Nice.
I checked out the 010 editor and man I've been looking for something like that binary template stuff for AGES.
I started working on the .app files as well, could you drop your current script in here for comparison?
User avatar
Falo
advanced
Posts: 78
Joined: Fri Oct 23, 2009 1:29 pm
Been thanked: 33 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Falo »

Image

it's not a finished script:

//edit:
Update to v1.11, uv working, some bugfix

Code: Select all

//--------------------------------------
//--- 010 Editor v3.2.1 Binary Template
//
// File: Diablo III *.app
// Author: Falo
// Revision: 1.11
//--------------------------------------
local int tempface=0, tempgroup=0;

struct{
    ubyte DEADBEEF[16];
    uint unk1[5];
    int numBones;
    int ofsBones;
    int sizeBones;
    int unk2[30];
    int numMats;
    int ofsMaterial;
    int sizeMaterial;

    if(ofsBones)
    {
        struct{
            FSeek(ofsBones + 16);
            struct BONE bone[numBones]<optimize=false>;
        }Bones;
    }

    Printf("mtllib default.mtl\n");
    if(ofsMaterial)
    {
        struct{
            FSeek(ofsMaterial + 16);
            struct MATERIAL material[numMats]<optimize=false>;
        }Mats;
    }
}HEADER;

struct BONE{
    char Name[64];
    int parent_id;
    float unk1[34];
    int unk2[7];
    int unk3;
    //Printf("%d;%s\n",parent_id,Name);
};

struct MATERIAL{
    local int ftemp;
    int unk1;
    int numVerts;
    int ofsVerts;
    int sizeVerts;
    int unk2;
    int ofsNormals;
    int sizeNormals;
    int unk3;
    int numFaces;
    int ofsFaces;
    int sizeFaces;

    int unk5[7];

    char name1[128];
    char name2[128];
    float funk1[11];

    ftemp = FTell(); // save position for later
    
    if(ofsVerts)
    {
        struct{
            FSeek(ofsVerts + 16);
            struct VERTEX vert[numVerts]<optimize=false>;
        }Verts;
    }

    if(ofsNormals)
    {
        struct{
            FSeek(ofsNormals + 16);
            struct NORMAL normal[numVerts]<optimize=false>;
        }Normals;
    }

    Printf("g Mesh%03d_%s\n",tempgroup,name1);
    Printf("usemtl %s\n",name1);
    if(ofsFaces)
    {
        struct{
            FSeek(ofsFaces + 16);
            struct FACE face[numFaces/3]<optimize=false>;
        }Faces;
    }

    tempface += numVerts;
    tempgroup++;
    FSeek(ftemp); // restore position, next mesh
};

struct VERTEX{
    local float tu,tv;
    float x;
    float y;
    float z;
    int unk1;
    int unk2;
    int unk3;
    ushort texu;
    ushort texv;
    int unk3[4];

    tu = texu;
    tv = texv;
    tu -= 32767;
    tv -= 32767;
    tu /= 512;
    tv /= 512;
    tv *= -1;
    tv += 1;
    Printf("v %f %f %f\n",x,y,z);
    Printf("vt %f %f\n",tu,tv);
};

struct NORMAL{
    int unk1;
    float unk2;
    int unk3;
    float unk4;
    int unk5;
    float unk6;
    //Printf("vn %f %f %f\n",unk2,unk4,unk6);
};

struct FACE{
    ushort f1;
    ushort f2;
    ushort f3;
    Printf("f %d/%d/%d %d/%d/%d %d/%d/%d\n",
        tempface+f1+1,tempface+f1+1,tempface+f1+1,
        tempface+f2+1,tempface+f2+1,tempface+f2+1,
        tempface+f3+1,tempface+f3+1,tempface+f3+1);
};
Last edited by Falo on Sun Sep 11, 2011 8:54 pm, edited 2 times in total.
BoyC
beginner
Posts: 36
Joined: Wed Jul 05, 2006 9:24 pm
Been thanked: 2 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by BoyC »

Very nice, that helps a lot in figuring out how to use the script.
What I found is that the constant header seems to be 1576 bytes long with the first of the referenced data beginning right after that at 0x628h. There is a second reference to a material data array at 0x5C4h (3 integers like the others), that points to the first array after the header. I'll post my script once it's at a comparable level to yours.
User avatar
Falo
advanced
Posts: 78
Joined: Fri Oct 23, 2009 1:29 pm
Been thanked: 33 times

Re: Textures of Beta Diablo 3, ".tex" files converter needed

Post by Falo »

after some more work, got uv working, i dumped the textures with 3D Ripper DX,
Image
Post Reply