How to export a model then load it in C++ with textures?

Started by
10 comments, last by sybixsus 14 years, 11 months ago
I am looking for some source code to do the following: 1. Use a model editor to make a model with textures. 2. Export that model into 3ds or some other popular format. 3. Load that model and display it using Visual Studio.Net C++ 2008 I just want some simple source code, so no animation is needed. If you know of a model editor/source code combo that works I would appreciate knowing about it.
Advertisement
#1 - you need a modeling package, i assume you know this.

#2 - you need to find or create an exporter for your modelling package that will export to the format you want to use in your game.

#3 - you need to find or create a loader class/library that will load a model of said format and allow you to display it in your game.




what modelling package are you thinking of using? thats the first step, then you determine what format you want to use in your game, and look for/write an exporter, or look at what exporters are available for that modelling package and choose the format out of those.

you then want to write/find a library availible in the language you want to use, and there ya go.


the best free modelling package is Blender, I believe it has plenty of exporters that are freely available.
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
Thank you for the blender idea. I would prefer to use 3ds format.

Now for the hard part. I am hoping someone out there knows of a place where I can just download the C++ code necessary to display a 3ds model with textures. If not, then I guess I would just have to do it myself.

I would think that surely with the popularity of the 3ds format, there would already be some C++ code that loads/displays 3ds models with textures out there. Maybe I am wrong though.

Any ideas where that kind of code would be anyone?
have you tried googling "3ds model loader"?


also although .3ds is a popular model format, it's not really an ideal format to be loading for games, since there's a lot of 3dsmax specific bloat that isn't needed for a game.


if you want a direct route then find a 3ds loader,but if you want to look around, you can find loaders/importers/exporters for formats such as MD2/MD3/MD5/OBJ, which are all more suitable for games.


everything I mentioned can be found via a quick google search, as you will learn, google is your friend, as long as you're not microsoft or yahoo.
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
Hi there.
Good luck with finding stuff on the 3ds format.
I can only find bits on that subject.
The toymaker.com site has stuff on .xfile but that getting old
I looks like I'm almost the only one using it now, but at least there's info on the subject.
Quote:Original post by ankhd
Hi there.
Good luck with finding stuff on the 3ds format.
I can only find bits on that subject.
The toymaker.com site has stuff on .xfile but that getting old
I looks like I'm almost the only one using it now, but at least there's info on the subject.


"Focus on 3D models" is a really good book for this sort of this, shows you the ins and outs of loading and displaying around 10 different formats, including 3DS,MD2,MD3,MDS, and a handful more.
--------------------------------------Not All Martyrs See Divinity, But At Least You Tried
For exporting you need to find export plugins for your desired format and the modeller you are using. The choice of modelling package is a matter of taste (and price). The choice of a suitable file format is harder, but for your requirements of simple static models about every format out there is suitable. 3ds is harder to load than others due to its wealth of (undocumented) transformation chunks, md2/3 is fairly simple, as is .obj. Later on you probably want to have joints and animations in your models, too. That's where you need to switch to a format with joint support - Direct3D .x files, collada .dae or Quake3 .md5 files, for example.

When it comes to loading the exported files I strongly suggest using a third-party library. I personally am involved with the development of Open Asset Import Library which loads all of the formats mentioned above, and a lot more. From my experience with its development I can tell you that programming a model loader is a time consuming task, especially if you want to support all the various exporters for a given format, each with its own set of bugs, incompletions and workarounds. You can roll your own loader if you feel the need to learn its ins and outs, but in the long run you better use a library for that.

bye, thomas
----------
Gonna try that "Indie" stuff I keep hearing about. Let's start with Splatter.
Thank you so much. Truly there is wealth of information you all have provided me with. Not to mention the endless hours of searching. I appreciate all your posts.
Wow. After brutally learning how to use blender(that is a 3 day nightmare in and of itself), and after using http://assimp.sourceforge.net/ to view my exported 3ds model, I sort of got this:

http://www.mrscience101.com/openasset.jpg

Now if I could just get some C++ code that would load it correctly I would be all set.

Anyone know of any good MS Visual studio C++ code to load a 3ds model?


Thanks.
Hello friend,

I'm sure you'll find your hapiness in http://code.google.com/, you can find many sources for absolutly anything, just install an SVN software like Tortoise SVN wich is free and you can start your d/l.

Let me know if you have any problem by pm.

Peace

This topic is closed to new replies.

Advertisement