Loading Milkshape 3D 1.7.0 models and textures

I’ve been looking around all the forums to see if anybody had written any code that will load a milkshape model and texture into openGL and display it. I found some code and also the upgrade to that code and tried it out. It loads the model but does not load the texture. I read around some more and noticed other people had this same problem a few years ago and it was due to Milkshape changing its file format.

My question is, does anybody know where I can find code that will load the current version of Milkshape models and textures? Or does anybody know how I can go about writing my own loader, first off by how I can go about analyzing the current file format since it is in binary.

any help is appreciated.

I’m not too familiar with Milkshape, but I’d check to see if there is anyway of writing scripts that will allow you to export the models. I generally use Blender, and write Python scripts to export the models into whatever format I want, and then write the corresponding loader in C/C++.

Hi… thanks for your reply.

I know there is a way to read the file format, i just don’t know how to view the file format for the new version of milkshape. I can export it was a text but i’m not sure if that’s the same format as the .ms3d file.

anybody else have any ideas?

Hi! I bought milkshape too and to import my work into GL apps i usually convert it into wavefront .obj format, which is quite easy to read ( it’s ASCII ) and will give you vertex, normal and texture data along with indices to build faces. If you want I can give you some code, but if you’re willing to stick to ms3d format i’m afraid i can’t help you!
Byez =8)!
Ob1

I also use the Wavefront OBJ format. Very easy to parse. Unlike the ms3d formate, it won’t change over time.

ms3d files do not contain textures, they only contain names of textures. You have to load the textures separately.

let me try that .obj format. could you please post your code Ob1??

Herr…
there are a couple of problems about my code :
first - it is HUGE, at least 100 rows i’d say;
second - it has been written directly, which means it has quite odd variable names and has comments in ITALIAN. I don’t think you’ll learn much if I post it here.
I meant to rewrite it and maybe put comments in english but it will take a while. So here are your choices :

  1. If you just need some working code you can download my ( awful written ) files from
    http://utenti.lycos.it/ricominciamo/code/. There’s also a manual on obj file format and a txt usage description. Just add the cpp to your project and include wavefront.h, and it should compile and work just fine with any .obj file.

  2. You can wait for me to write it down again and hopefully better so that you can understand how it’s written.

  3. I can give you some general hints so you write your own code in a way you like.

Hope you find it useful. I’ll be back soon if you need help!
Good Work!
Byez =8)!
Ob1