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
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
Important information: this site is currently scheduled to go offline indefinitely by end of the year.
[Request]COD3 mesh fix and import script
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: [Request]COD3 mesh fix and import script
The faces are tri stripped:
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.
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.
Last edited by shakotay2 on Sat Oct 26, 2013 9:20 pm, edited 1 time in total.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
-
- double-veteran
- Posts: 929
- Joined: Fri Jul 08, 2011 12:06 pm
- Location: Torrance, CA
- Has thanked: 10 times
- Been thanked: 274 times
Re: [Request]COD3 mesh fix and import script
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.
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: [Request]COD3 mesh fix and import script
Yep - (it's "normal" C but) that would be very nice.howfie wrote:if you are using c++ i can give my strip cut index code.
this seems to be my problem, too.rich though i might have been missing a flag or something but
Yes, desperate I am...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.
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:
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?
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
-
- double-veteran
- Posts: 929
- Joined: Fri Jul 08, 2011 12:06 pm
- Location: Torrance, CA
- Has thanked: 10 times
- Been thanked: 274 times
Re: [Request]COD3 mesh fix and import script
Pseudo-code to convert tristrips with strip-cut indices to triangle lists.
Code: Select all
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;
}
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: [Request]COD3 mesh fix and import script
Thank you very much!
Just to be sure : I need the boost library to use this?
Hopefully it will solve this prob:
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.
Just to be sure : I need the boost library to use this?
Hopefully it will solve this prob:
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.
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
-
- double-veteran
- Posts: 929
- Joined: Fri Jul 08, 2011 12:06 pm
- Location: Torrance, CA
- Has thanked: 10 times
- Been thanked: 274 times
Re: [Request]COD3 mesh fix and import script
oh, the geometry even before the first terminal is messed up? you dont need boost, just replace it with you own memory management scheme.
- Bastien
- advanced
- Posts: 70
- Joined: Sun Apr 15, 2012 1:08 am
- Has thanked: 27 times
- Been thanked: 13 times
Re: [Request]COD3 mesh fix and import script
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.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
https://code.google.com/p/blender-cod/
-
- mega-veteran
- Posts: 176
- Joined: Fri Jul 29, 2011 9:18 pm
- Has thanked: 54 times
- Been thanked: 46 times
Re: [Request]COD3 mesh fix and import script
This script is for import models to a call of duty format , not for convert the models from COD3 to obj , etc.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/
Call of duty 3 not use xmodels.
- shakotay2
- MEGAVETERAN
- Posts: 4291
- Joined: Fri Apr 20, 2012 9:24 am
- Location: Nexus, searching for Jim Kirk
- Has thanked: 1151 times
- Been thanked: 2244 times
Re: [Request]COD3 mesh fix and import script
it's the first "submesh" only. Don't think it's messed up but the normals directions are, imho.howfie wrote:oh, the geometry even before the first terminal is messed up?
Finally I managed to use your code but maybe I did something wrong:
edit: yes, I surely did :
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: Select all
#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
}
Tuts: a) Bigchillghost, viewtopic.php?f=29&t=17889
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
b) Extracting simple models: http://forum.xentax.com/viewtopic.php?f=29&t=10894
"Quoting the whole thing. Would u ever stop this nonsense?"
-
- mega-veteran
- Posts: 176
- Joined: Fri Jul 29, 2011 9:18 pm
- Has thanked: 54 times
- Been thanked: 46 times
Re: [Request]COD3 mesh fix and import script
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
thanks to shakotay2
this is the results