Skip to main content
GameDev.net gamedev.net
🔒 Locked

Loading 3DS Models, or OBJ Models in C#

Started by ArchG Jul 7, 2006 at 6:35 PM 10 replies 25.6k views
Original Post
ArchG
ArchG
Hello, I've just started learning OpenGL using C# and the Tao.OpenGL framework. Just wondering if anyone has wrote some code to load up some models in either .obj files or .3ds files? Through my extensive research 10 minutes of [google] searching I couldn't seem to find anyone who has done this in c#... I saw the threads posted in the FAQ of this forum, but they were all for C/Cpp...I would rather not write my own loader if I don't have to. Also let me know if this question would be a better post for the .NET forum. Thanks, ArchG
supercat1
supercat1
i have a fairly decent model loader written in c++ for the .3ds file format. i used spacesimulator.net as a reference and it turned out pretty well. if you would like to see it i can post it here, or send you a copy.

ps: anyone know how i can get in touch with the guy in charge of spacesimulator.net?
yaroslavd
yaroslavd
Is there any reason you don't want to use .X? Then you can just use standard D3DX functions to load your models.
_the_phantom_
_the_phantom_
Quote:
Original post by yaroslavd
Is there any reason you don't want to use .X? Then you can just use standard D3DX functions to load your models.


*points out we are in OpenGL land so no D3DX* [grin]

yaroslavd
yaroslavd
Oops, I saw "C#" and assumed you were working with MDX. Sorry [wink].
supercat1
supercat1
yeah, he is in c# so why not use directx? isn't that what c# was originally meant to use since they are both ms products?
abnormal
abnormal
There are a couple of 3ds libraries and sample code around, mostly in c++. It is not hard porting them over to c# and implementing them in your engine if you really want to use 3ds files (I strongly suggest against them, the format is just way to old and unflexible, you will not be able to implement any new features that easily).
Microsoft DirectX MVP. My Blog: abi.exdream.com
Arild Fines
Arild Fines
Quote:
Original post by Anonymous Poster
Quote:
Original post by supercat1
yeah, he is in c# so why not use directx? isn't that what c# was originally meant to use since they are both ms products?


Because ManagedDirectX is slower and because it is not available crossplatform. Also it is my personal believe that OpenGl is more open to the industry.

By the way, C# is not a microsoft product. Microsoft just happened to make the best IDE for it. In fact Microsoft did it so perfect that everybody thinks they have invented it, and that other operating systems are denying C#...
==> In fact Macintosh has denied C++ for a long time just the same way, because it was an "evil Microsoft invention". But C++ is no less or more a Microsoft invention than C# is.
==> And for Sun, they want to go through with Java at all costs of course. This while C# is made to be an improvement of Java in every way... and it really is.

Well I'm not a Microsoft lover, but having programmed on all 3 platforms and in several languages this is just an honest opinion. And of course this oppinion is only on programming not on operating systems.

What have you been smoking?
--AnkhSVN - A Visual Studio .NET Addin for the Subversion version control system.[Project site] [IRC channel] [Blog]
ArchG
ArchG
Well first off, thank you everyone for your replies.

I guess it seems like a couple of people do not like the 3DS format.. (complicated, old)

No one really mentioned anything obout the OBJ format.. I'm wondering what format is kind of the 'standard', and what is recommended to be used?

Thorgrim
Thorgrim
There really is no "Standard" for OpenGL aps, however if you are just starting out, I would recommend OBJ, or SMD. Neither OBJ or 3DS can do animation, so SMD is a great option. Both SMD and OBJ are also text based, which is a lot easier if you are just starting out (Can easily debug etc).

Here is a great site for file formats:

http://www.wotsit.org/search.asp?page=2&s=3d

SMD:

http://developer.valvesoftware.com/wiki/SMD_file_format

I recently made a tool that can load / save OBJ, SMD and MD3 files. With the above documentation it really isn't too hard. Especially if you are doing it in C# :)

BTW, just FYI, Managed DirectX in C# is not going to be much, if at all slower than OpenGL. But I'm not saying you should swap to MDX... I'm having to using it at the moment, and I must say I prefer some things about OpenGL. Also, OpenGL is the standard outside of the games industry, due to it being cross platform and all. If you plan to do other stuff besides games, OpenGL is probably the best way to go (if you want to get a job).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.