Sign in to follow this  

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

This topic is 3146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
#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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
What keeps you from using Assimp? It is designed for loading all kinds of 3D models and scenes. The viewer you have been using is only built on top of it.

Share this post


Link to post
Share on other sites
I can only reiterate the previous advice not to use the 3DS format. It's incredibly old and is missing a number of key features most people would consider vital in game development. There are any number of better formats around. FBX, X, or even OBJ spring to mind. I think AssImp can import all of those too.

Share this post


Link to post
Share on other sites

This topic is 3146 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this