convert 3d model to ms3d and load via OpenGL in C.

Hello all,

First I’d like to say that I really tried to find the answer to my question in the forums search but did not find what I was looking for.
If I did not look good enough and you got a thread that you could point me at, in addition to your answers - that would be great!!

Now I’ll describe what I’m up to and ask the question -

I am using a code that is based on a lesson from nehe -
It is about loading a ms3d model.
In addition to that I have implemented some basic mouse and cursor movements to move around the loaded 3d model.

I got it working with a small 3d city model that I have. This model includes a ms3d file with a few texture bmp files.
I must say that I got this ms3d model from the web “as-it-is” and I have no clue how is it built/created.

Here is my problem -

What I need is a 3d model of a city that is larger and more complex than the one that I have.

I got no experience in building such models in any kind of 3D studio editors.
So I’ve been googling for it but the models that I find (free for download) are not ms3d type.

Can I convert any 3D model to ms3d so that I can load it via the code sample from nehe Lesson?
If not - what are the limitations that I need to overcome and how-to do so?
Can any 3D model type be converted to ms3d?
Are there any free converters that you know of?

Do you know of any easy-to-use 3D model editor that comes with some useful (for my intentions) 3D samples that could be worth a “trial period” use?

Thanks in advance, and remember that I am as much newbie as a newbie gets. So please keep the answers simple :slight_smile:


I think that if you would like to create your own 3d models, Blender would be an excellent choice (see here). It may take some getting used to for modelling, though, so you can read this wikibook if you want.

I’ve always found Blender to be very useful, although I’m still learning some of the more advanced modelling techniques. In fact, Blender has an import script for MS3D, so you can load in your MS3D file and alter it; unfortunately, it doesn’t have an MS3D exporter. So you might want to consider writing a loader for another format, or finding some sort of converter. Actually, I could write an MS3D export script in Blender if you like, since it’s not a very difficult format and I’m bored :slight_smile: Alternatively, I’ve written a simple OBJ loader in C++, so I could give you that if you want, because Blender can export to OBJ.

Thanks for the quick reply maedhros777!!!

Thanks for the offer. This sounds like a great way to go…
I cant’ use an OBJ loader in C++ since this task is a project in a graphics course that I am taking and we must work with ms3d files.
I wouldn’t wanna bother any one with writing code for me (though I wouldn’t even know where to begin with writing such converter :slight_smile: ). So do you think that I could find such converter, from whatever the Blender supports to ms3d format, on the net?
Some one somewhere has already stumbled over this problem and must have solved it. Right? :slight_smile:

Also, can I assume that the code sample that I have referred to from “nehe” will handle the resulting ms3d? Or are there any complications that I might run in to?

Thanks in advance!!

I actually found an MS3D exporter for Blender online here. I looked at the code, and it seems like it should be good enough as long as you’re not doing anything complicated (like animation). To install it, it depends if you’re using Linux or Windows or some other OS. First install Blender (if you haven’t already), then put the script in .blender/scripts/blender (not .blender/scripts, as the site says). If you’re running Linux, .blender will be in your home directory – I don’t know about where it would be on Windows, since I use Linux.

As for Nehe’s code – well, it looks good enough. It doesn’t support advanced stuff, but neither does the exporter, so that doesn’t really matter :slight_smile: If you do find complications, you can just make a new thread on this forum and ask for help, but that shouldn’t happen if you’re not doing too much with the MS3D format. If you get to the point at which you’re doing more advanced stuff like animation, then you might want to alter the export script or write a new one. It’s written in Python – you’d have to learn a bit of that, but it’s not a difficult language. Then you can learn a bit about the Blender Python API. There’s a section in the Blender book I gave you the link to previously that explains the basics of Python and its API. Of course, you could always look online for a better script instead :slight_smile:

Sounds Great!!

Thanks, for the help. It’s been a pleasure :slight_smile: