3ds max 9 CMP Exporter (Help Request)
-
Hello folks.
For the last couple of weeks I’ve been messing around with the archived_hcl_cmpsrc_01, found in the DL section of the SP forum. I believe it was created by Mario HCI Brito, if I’m wrong sorry.
Well i eventually got it to export a working CMP.
http://i352.photobucket.com/albums/r330/SilentAssassin82/FirstExport.jpg
Now the reason why I am asking for help, is because i really don’t know the first thing about programming and i really have run into a few things i can’t find solutions for.
The first problems came because 3ds max is a pure Win32 app and really dosn’t allow the use of MFC so it took me ages to work around this. I am left with one problem here, for some reason i can’t get the dialog to recognise the file you choose to save the CMP as through 3ds max. So the only way i could find to save a file to test the UTF was valid was to code in a default save name.
Other than that everything else has went ok. The CMP is valid, it does recognise the material names you are using in 3ds. It also exports HPs the same way the Milkshape version does.
I’m pretty sure I’ve not got the UVs right, maybe the normals aswell.
So this is my plea for help, if there is anyone willing to give this a look i would really be thankfull. There is alot it still dosn’t do like export multi part CMPs and i don’t know how to do it.
But i will say again though just incase anyone can help, the code might be messy. It really was guess work and stubbornness that got me this far.
Anyway here’s the source.
-
Ok, this is where i am on this now. I noticed that when the model was being exported, the material names where wrong. It’s because of in 3ds it uses Multi/Sub object material and at first it was using the Multi/Sub object material name. I’ve fixed that now so it uses the actual material the face is using.
Now i have a problem i can’t fix at all. The original source uses this to count the meshes in the scene.
list <mesh *="">* meshList; meshList = new list<mesh *="">; int cDlgOptions::num_meshes() { // iterate mesh list, calculate number of meshes int nMesh = 0; list<mesh *="">::iterator i; for (i = meshList->begin(); i != meshList->end(); i ++) { MESH * m = *i; if ( _strnicmp(m->nname, "Hp", 2) ) nMesh ++; } return nMesh; }</mesh></mesh></mesh>
But the problem here is, it’s not splitting the meshes up into the material groups. All it’s doing is counting the number of actual meshes.
I’ve went through the max SDK and the method it says you should use in that dosn’t work. I’m pretty sure it’s because the original source is overiding it.
Does anyone have any suggestions?
Here’s the updated source anyway just incase.
-
Sorry I can’t give you any help, my knowledge in this area is 5% in my estimate!
I think this is a very worthwhile project, MilkShape is so limited.
Pleas keep it going, and hopefully someone who is capable will come in to help you.
Anyone?
-
To be honest, this would be a great tool if it got working, will also reduce further the need for milkshape when doing models etc, and make like alot more easier for doing modding work for freelancer on a general note.
since my coding knowledge is about as great as a husky trying to learn how to cook curry, apart from bumping this thread i unfortunately wont really but of much use
-
Is the last download link the source of the latest version or did you develop it further?
I’d like to have a look at it because the smoothing problems with the Milkshape cmp exporter(s) are driving me nuts, and since we dont have the source for them….
/err seems like the last download link is down… anybody got the latest source for this?
-
Yeah basically that’s as far as I got with it. Here’s the link to the DL file
http://www.filefront.com/15941947/maxCMPExport.rar/
If you have any questions about it feal free to PM me through the forums or skype if you use it. I dunno how much I could help though. Most of what I done was just trolling through the 3dsmax API changing the calls and stuff to what I thought they should be.
There’s a problem with saving also. For some reason I couldn’t stop the old milkshape save dialog popping up, so you had to save twice to get it to work.
-
Glad to hear, I was afraid it would be too much of a mess to do anything with it.
-
Just a follow-up why the normals/uvs werent working right:
3ds max only saves one vertice even if it has 3 different normals because of 3 different faces referencing this vertice. Thats why you cannot simply take the vertices out of the vertex array and calculate the normals, you have to actually do some crazy operations and duplicate vertices when they are not in the same smoothing group OR if they do not share the same texture uv coordinates.
Long story short, I think I will save myself the trouble and simply create [3*faces] vertices so every face has its own vertices. It may not be ideal for performance and file sizes, but if later someone wants to have a look at it and sort out the mess, be my guest.
/oh actually I just got a rather simple idea of how to tackle this prob… simply creating the 3*faces vertices list and then merge any vertices that are identical
-
Well, I got something. The attached plugin cannot do much, but it can generate working .cmps. It only exports one root node though, so no components whatsoever.
I’ll put the project on the forge as soon as I got the component functionality working (thats likely as far as I’ll develop this exporter for now).
Any suggestions? Would be cool if someone could try it out to spot any obvious errors on the base implementation.
-
Excellent work W0dk4! I will check it out as soon as I can get some free time, thank you!
-
That’s well cool. I’ll give it a shot and see how it goes. You never know maybe this will be enough to spark some interest in a 3ds max exporter. Biggest thing I can think of for functionality is the ability to export more than 18 mesh groups. That was my main aim when I started converting this for use in 3ds max. Fact being that’s what I see as the biggest draw back of the milkshape version. I dunno if it’s a milkshape thing or what ever the reason for that is. I just know that thing’s would be much simpler if we could export more than the current mesh limit.
-
Yes, that’s also what Im thinking.
I’d like to make it possible so that every 3ds max object (so every “mesh”) is exported as a component.
Ideally, there should only be one exporter that exports all, a .sur, a complete .cmp and .mat. Maybe we can extend the max exporter to provide all of that functionality one day but for now, my aim is to make it export unlimited components, correct smoothing (the milkshape exporter or milkshape itself sucked at doing that) and finally optional tangent information for normal mapping.
The latter two are already done, just need to add the component functionality and then Im pretty much done on it, leaving it to other motivated devs -
I gave it a try, I’m guessing it’s not compiled for 3ds max 9 though? Because it wouldn’t load in my version.
None the less it never worked for me. What version is it for? It’s no big deal, I imagine it could be recompiled to work in most versions, 3ds is funny that way.
-
Yeah, the version of 3ds and the sdk I have are for 3ds max 9. No worries, I can recompile it myself when the source becomes available.
EDIT: And no, the only way to make 3ds plugins backwards compatible is if you compile it with the relevant sdk.
The only plugins I’ve seen work on more than one version is I think 2009 or 2008 and 3ds max 9 because the sdks are simular.
I dunno what the new versions of 3ds are like though.
-
Mine is version 2008.
Hope someone can recompile it for mine at some point please?
-
Yes but when you say things like this, kosacid, you have to explain it, because people who don’t know much about this subject will still not know after reading this thread, and the search facility on this forum is next to rubbish. And the EOA site is down so I can’t link to that either.
So here goes…
Havoc Tools for 3DS Max includes Convex Hull, which makes convex shrouds around each of the mesh groups. You can do this then export them as a model in Lightwave or Wavefront format, or now cmp, and then import that into MilkShape.
Then from MilkShape you can export the sur using Sur Exporter v1.1, either as a complete sur or as individual parts and then splice them using Sur Splicer. Remember if you want to use Sur Splicer you should add “_lod1” to the end of each group name and then export them one at a time.
When you want to use Sur Splicer, by keeping this name format you will remember the naming, which will be correct, (the first part will be named Root, and just remove the “.sur” file extension from the remaining parts when making the sur input file) and then you don’t need to import the cons_fix.dat file into the cmp file, because all it does is fix the part names which were corrupted by the author’s method of naming them “zomgbayxx” and adding additional surplus dummy groups in MilkShape. This method uses ship part cmp group names, which is what Freelancer does. In some cases you may need to add a few additional dummy cmp parts but I advise against this, split your ship into more groups instead so that you have a sur part covering and having the same name as each ship group.
-
PhysX also has a tool that works better in some cases, Havok sometimes dosn’t create a convex shape, you can check this using 3dsmax’s built in convex shape checker thing. Usually when this happens PhysX will do the job and vice versa.
Also one allows you to go over 64 faces, think that’s Physx aswell.