XeNTaX Forum Index
Forum MultiEx Commander Tools Tools Home
It is currently Sun Nov 18, 2018 6:54 am

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: Aarklash Legacy - Model research
PostPosted: Wed Dec 18, 2013 11:39 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
Hi guys, been a while, so I got this new game from Steam and looked at the model files (.cef)

I used C# to render it using DirectX but I got this problem :(

Image

and here is the code:

Code:
            CustomMesh cMesh = new CustomMesh();
            using (BinaryReader br = new BinaryReader(new FileStream(fileName, FileMode.Open, FileAccess.Read)))
            {
                char[] cef = br.ReadChars(3);
                br.Seek(99);

                string modelName = br.ReadStringZeroEnded();
                br.ReadBytes(133);

                string position = br.ReadStringZeroEnded();
                br.ReadBytes(35);

                long pos = br.BaseStream.Position;

                string blendWeight = br.ReadStringZeroEnded();

                if (blendWeight == "BLENDWEIGHT")
                    return null; // todo --> followed by BLENDINDICES
                else
                    br.Seek(pos);

                // pos 296 7944 bytes 1986 floats 662 vertices
                int vertSize = br.ReadUInt16();
                br.ReadBytes(16);
                List<Vector3> vertices = new List<Vector3>();
                for (int i = 0; i < vertSize / 12; i++)
                {
                    var x = br.ReadFloat();
                    var y = br.ReadFloat();
                    var z = br.ReadFloat();
                    vertices.Add(new Vector3(x, z, y));
                }
                cMesh.Vertices = vertices;
               
                // pos 8326 3768 bytes 1884 ints 628 faces
                br.ReadBytes(24);
                string indice = br.ReadStringZeroEnded();
                br.ReadBytes(37);
                int indexSize = br.ReadUInt16();
                br.ReadBytes(16);
                int[] indices = new int[indexSize / 2];
                for (int i = 0; i < indices.Length; i++)
                {
                    indices[i] = br.ReadUInt16();
                }
                cMesh.Indices = indices;
                br.Close();
            }
            return cMesh;


any help is more than welcome

T.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Wed Dec 18, 2013 11:41 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
Here is the actual file


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Thu Dec 19, 2013 12:00 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2493
Location: Nexus, searching for Jim Kirk
Has thanked: 599 times
Have thanks: 1277 times
what is the problem? The shape? Or the texturing?

I loaded your sample in hex2obj:
Image

This is the H2O file:
0x2098 1884
VB0
0x0
0x13A 662
0200

(Didn't look for uv data.)

_________________
Bigchillghost, Reverse Engineering a Game Model: http://forum.xentax.com/viewtopic.php?f=29&t=17889
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Thu Dec 19, 2013 12:01 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
Found the problem when I was doing some refactoring..

DirectX doesn't like the indices of the format int[], so it needs to be short[], then it works :)

so in the code you need to change this line:
Code:
int[] indices = new int[indexSize / 2];


with

Code:
short[] indices = new short[indexSize / 2];


and this one:

Code:
indices[i] = br.ReadUInt16();


with:

Code:
indices[i] = br.ReadInt16();


T.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Sat Dec 21, 2013 11:16 am 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
Darn, 2 days and I don't seem to be able to figure out these texture coordinates..

some more help plz ?

T.

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Sat Dec 21, 2013 5:57 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2493
Location: Nexus, searching for Jim Kirk
Has thanked: 599 times
Have thanks: 1277 times
strange -
these were my nearest hits:
Image

How does the texture file look like?

_________________
Bigchillghost, Reverse Engineering a Game Model: http://forum.xentax.com/viewtopic.php?f=29&t=17889
extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
Make_H2O-ForzaHor3-jm9.zip


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Sun Dec 22, 2013 1:28 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
I needed to reduce the size of the texture, normally it is a dds file of 2.7MB

I believe the weapon is unwrapped in the upper right corner, so I think your unwrapping is not correct, yet :p

Don't worry I'm still looking at it as well, no luck either, thanks for the help already

T.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.


_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Fri Jan 17, 2014 8:51 am 
Offline
mega-veteran
mega-veteran

Joined: Thu Dec 07, 2006 11:25 pm
Posts: 302
Has thanked: 6 times
Have thanks: 58 times
TaylorMouse,

I did find the UV datas in the .cef file. See the attached .obj file.


Attachments:


You do not have the required permissions to view the files attached to this post. Register to gain access.



Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Fri Jan 17, 2014 8:59 am 
Offline
mega-veteran
mega-veteran

Joined: Thu Dec 07, 2006 11:25 pm
Posts: 302
Has thanked: 6 times
Have thanks: 58 times
How to get the UV datas?

File offset: $2FEC
Data block: TEXCOORD

- read the 'TEXCOORD'
- skip the next 36 bytes
- UV Vertex Size = Read Long / Vertices
- skip the next 14 bytes

UV vertex size of the your sample file: $28

UV data block:
- 20 bytes unknown
- U: 4 bytes Float
- V: 4 bytes Float


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Fri Jan 17, 2014 9:11 am 
Offline
mega-veteran
mega-veteran

Joined: Thu Dec 07, 2006 11:25 pm
Posts: 302
Has thanked: 6 times
Have thanks: 58 times
I added the .cef loader module to the 3D Object Converter and I will upload it to my web page from my home.

I don't understand why has the .cef file invalid texture file name.
bad: Golem_DFF.tga
valid: golem_dff_3d403ec7.dds


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Tue Jan 21, 2014 9:15 am 
Offline
mega-veteran
mega-veteran

Joined: Thu Dec 07, 2006 11:25 pm
Posts: 302
Has thanked: 6 times
Have thanks: 58 times
I uploaded this (Aarklash Legacy support) version to my web page:
http://3doc.i3dconverter.com/downloads/3doc_v5.307_portable.zip


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Tue Jan 21, 2014 11:16 am 
Offline
mega-veteran
mega-veteran
User avatar

Joined: Sun Jan 18, 2009 1:45 pm
Posts: 217
Location: Sagittarius
Has thanked: 225 times
Have thanks: 12 times
Karpati
it would be nice to see your activity a part of us out here

_________________
ILLUSORY VIDEO GAMES ARE MORE IMPORTANT THAN PRECIOUS INTERNATIONAL FOOTBALLs


Top
 Profile  
 
 Post subject: Re: Aarklash Legacy - Model research
PostPosted: Tue Jan 21, 2014 8:17 pm 
Offline
ultra-veteran
ultra-veteran
User avatar

Joined: Mon Sep 26, 2011 12:51 pm
Posts: 364
Has thanked: 13 times
Have thanks: 122 times
interesting, need to check this at home!!

Thnx
T.

_________________
My Game Dev Blog
My Starcraft II Mod files and scripts


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group