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

All times are UTC + 1 hour


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: [Request]COD3 mesh fix and import script
PostPosted: Fri Oct 25, 2013 3:51 am 
Offline
mega-veteran
mega-veteran

Joined: Fri Jul 29, 2011 9:18 pm
Posts: 176
Has thanked: 54 times
Have thanks: 41 times

shakotay2 has found the way for convert the meshes from call of duty 3 to obj with uv, but the face indices are damaged
he say that the models are in half floats

Image

Image

someone knows how to fix this? and... is possible create a importer script?

the eichar.cod contains all data including textures, and the single ps3mesh file is the model:
http://www.mediafire.com/download/m1hvj ... acters.RAR
here other bundles: http://www.mediafire.com/download/1ncp0 ... c/char.rar


thanks

You can make the ads go away by registering



Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Fri Oct 25, 2013 12:23 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2491
Location: Nexus, searching for Jim Kirk
Has thanked: 598 times
Have thanks: 1277 times
The faces are tri stripped:
Image Image

The problem is to replace the FF FF indices. I used the previous index but this does not seem to be correct.

edit: hmm, yes, the solution seems to be to start a new read of f1 and f2 after encountering FF FF.

edit2: weird. Seems FF FF indicates a change of the faces' orientation. Means half of the texture is outside the other half inside.

So I changed the orientation of the newly read f1,f2,f3 but at no avail.
This seems to be above my imagination. :D

_________________
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


Last edited by shakotay2 on Sat Oct 26, 2013 9:20 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Sat Oct 26, 2013 1:25 am 
Offline
double-veteran
double-veteran
User avatar

Joined: Fri Jul 08, 2011 12:06 pm
Posts: 927
Location: Torrance, CA
Has thanked: 9 times
Have thanks: 257 times
if you are using c++ i can give my strip cut index code. u don't change the winding order on every reset, though I've seen a problem like this before (tekken hybrid). rich though i might have been missing a flag or something but i could never find it so i did what only the desperate would do... the vertex normals were good so based on that i flipped the polygons.


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Sat Oct 26, 2013 6:09 am 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2491
Location: Nexus, searching for Jim Kirk
Has thanked: 598 times
Have thanks: 1277 times
howfie wrote:
if you are using c++ i can give my strip cut index code.
Yep - (it's "normal" C but) that would be very nice.
Quote:
rich though i might have been missing a flag or something but
this seems to be my problem, too.

Quote:
i could never find it so i did what only the desperate would do... the vertex normals were good so based on that i flipped the polygons.
Yes, desperate I am... :D
I'm calculating surfcace normals but I have no clue how to decide whether they point into or outside the head.

For example these two having the same direction:
Image

I know "normals point towards the side from which the vertices appear in counterclockwise order"
but seems I'll have to understand back face culling, too?

_________________
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: [Request]COD3 mesh fix and import script
PostPosted: Sat Oct 26, 2013 3:14 pm 
Offline
double-veteran
double-veteran
User avatar

Joined: Fri Jul 08, 2011 12:06 pm
Posts: 927
Location: Torrance, CA
Has thanked: 9 times
Have thanks: 257 times
Pseudo-code to convert tristrips with strip-cut indices to triangle lists.

Code:
struct TriangleList {
boost::shared_array<uint16> data;
uint32 n_indices;
uint32 triangles;
};

bool ConvertStripCutToTriangleList(const uint16* src, uint32 n, TriangleList& dst, uint16 terminal = 0xFFFF)
{
// validate
if(!src || !n) return false;
if(n < 3) return false;

// compute number of triangles
uint32 n_triangles = 0;
uint32 a = 0;
uint32 b = 0;
for(;;)
    {
     // must stop
     if(b == n) {
        if(src[n - 1] != terminal) {
           uint32 distance = b - a;
           if(distance < 3) return false;
           n_triangles += distance - 2;
          }
        break;
       }

     // hit terminal index
     if(src[b] == terminal) {
        uint32 distance = b - a;
        if(distance < 3) return false;
        n_triangles += distance - 2;
        a = b + 1;
        b = a;
       }
     // non-terminal index
     else
        b++;
    }

// initialize destination data
dst.triangles = n_triangles;
dst.n_indices = n_triangles * 3;
dst.data.reset(new uint16[dst.n_indices]);

// initialize second pass data
uint16* ptr = dst.data.get();
uint32 dst_index = 0;
uint32 src_index = 0;

// second pass through source
do {

     // keep track of tristrip index
     uint32 tristrip_index = 0;

     // copy first triangle
     uint16 a = src[src_index++];
     uint16 b = src[src_index++];
     uint16 c = src[src_index++];
     ptr[dst_index++] = a;
     ptr[dst_index++] = b;
     ptr[dst_index++] = c;
     tristrip_index++;
   
     // copy other triangles
     while(src_index < n) {
         a = b;
         b = c;
         c = src[src_index++];
         if(c == terminal) break;
         if(tristrip_index % 2) {
            ptr[dst_index++] = a;
            ptr[dst_index++] = c;
            ptr[dst_index++] = b;
           }
         else {
            ptr[dst_index++] = a;
            ptr[dst_index++] = b;
            ptr[dst_index++] = c;
           }
         tristrip_index++;
        }
    }
while(src_index < n);

return true;
}


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Sat Oct 26, 2013 9:03 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2491
Location: Nexus, searching for Jim Kirk
Has thanked: 598 times
Have thanks: 1277 times
Thank you very much! :)

Just to be sure : I need the boost library to use this?

Hopefully it will solve this prob:
Image

It's the "submesh" before the first FF FF separator ("terminal") where I think the normals marked with a thin white line have the wrong direction.

_________________
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: [Request]COD3 mesh fix and import script
PostPosted: Sun Oct 27, 2013 7:05 am 
Offline
double-veteran
double-veteran
User avatar

Joined: Fri Jul 08, 2011 12:06 pm
Posts: 927
Location: Torrance, CA
Has thanked: 9 times
Have thanks: 257 times
oh, the geometry even before the first terminal is messed up? you dont need boost, just replace it with you own memory management scheme.


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Sun Oct 27, 2013 10:05 pm 
Offline
advanced
User avatar

Joined: Sun Apr 15, 2012 1:08 am
Posts: 69
Has thanked: 26 times
Have thanks: 12 times
luxox18 wrote:
shakotay2 has found the way for convert the meshes from call of duty 3 to obj with uv, but the face indices are damaged
he say that the models are in half floats


Hey, have you checked this blender add-on? it has export-import functions for many COD titles, not entirely sure if COD3 works, but code can help.

https://code.google.com/p/blender-cod/


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Mon Oct 28, 2013 1:01 am 
Offline
mega-veteran
mega-veteran

Joined: Fri Jul 29, 2011 9:18 pm
Posts: 176
Has thanked: 54 times
Have thanks: 41 times
Bastien wrote:
Hey, have you checked this blender add-on? it has export-import functions for many COD titles, not entirely sure if COD3 works, but code can help.

https://code.google.com/p/blender-cod/


This script is for import models to a call of duty format , not for convert the models from COD3 to obj , etc.

Call of duty 3 not use xmodels.


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Mon Oct 28, 2013 3:55 pm 
Offline
M-M-M-Monster veteran
M-M-M-Monster veteran
User avatar

Joined: Fri Apr 20, 2012 9:24 am
Posts: 2491
Location: Nexus, searching for Jim Kirk
Has thanked: 598 times
Have thanks: 1277 times
howfie wrote:
oh, the geometry even before the first terminal is messed up?
it's the first "submesh" only. Don't think it's messed up but the normals directions are, imho.

Finally I managed to use your code but maybe I did something wrong:
Image

edit: yes, I surely did :D :
Image Very fine!

Few normals at ears and mouth pointing inside. But does not seem to affect the texture.
This is how I used your code (in case someone else faces this prob):
Code:
#include <boost/shared_array.hpp>
const WORD* src ;

struct TriangleList {
boost::shared_array<WORD> data;
DWORD n_indices;
DWORD triangles;
} dst ;

//Modification in ConvertStripCutToTriangleList() due to big endian indices:

     WORD aBE = src[src_index++]; WORD a= (aBE % 256) * 256 + aBE/256 ;
     WORD bBE = src[src_index++]; WORD b= (bBE % 256) * 256 + bBE/256 ;
     WORD cBE = src[src_index++]; WORD c= (cBE % 256) * 256 + cBE/256 ;

     ...
     cBE = src[src_index++]; c= (cBE % 256) * 256 + cBE/256 ;

   main() {
         boost::shared_array<WORD> dst.data(new WORD[65535]);
   // loading of model data at lpFBuf, face indices start address= 0xAB30        // 2* 0x5598
    src = (WORD *) lpFBuf ; src += 0x5598 ;
    ConvertStripCutToTriangleList(src, 4417, dst, 0xFFFF) ;   // 4417= face indices count
}
Thx again, sire! :)

_________________
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: [Request]COD3 mesh fix and import script
PostPosted: Mon Oct 28, 2013 11:07 pm 
Offline
mega-veteran
mega-veteran

Joined: Fri Jul 29, 2011 9:18 pm
Posts: 176
Has thanked: 54 times
Have thanks: 41 times
shakotay2 wrote:

edit: yes, I surely did :D :
Image Very fine!


Wow! good news! :)


Top
 Profile  
 
 Post subject: Re: [Request]COD3 mesh fix and import script
PostPosted: Thu Nov 07, 2013 12:40 am 
Offline
mega-veteran
mega-veteran

Joined: Fri Jul 29, 2011 9:18 pm
Posts: 176
Has thanked: 54 times
Have thanks: 41 times
with the HEX2OBJ tool we can convert all models from this game. viewtopic.php?f=29&t=10894

thanks to shakotay2

this is the results

Image



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

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot], Squadalahman and 4 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