Loading 3DS Models, or OBJ Models in C#

Started by
10 comments, last by Thorgrim 17 years, 9 months ago
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
Advertisement
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?
Is there any reason you don't want to use .X? Then you can just use standard D3DX functions to load your models.
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]

Oops, I saw "C#" and assumed you were working with MDX. Sorry [wink].
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?
Hi,

I know the problem and feeling. I am also working in OpenGl on C#.NET. I searched for ages to find a topic or opensource project that could load 3DS or OBJ files. Nobody could help me though, and everybody told me to move to C++ instead. So what I did was creating my own file system: I call it B3D.

I wrote a converter for *.X3D files. X3D is an plaintext fileformat. So it's relatively easy to understand. Loading 3DS files would have been better of course. But 3DS is a bit more complicated. X3D however is also pretty popular though. There are exporters for all popular 3D modeling software (3D Studio Max, Maya, Blender, ...) During development of this X3D to B3D converter I concentrated on Blender though (since that's the only good free program)

My converter works pretty good now. It makes part of a bigger project (A 3D Engine for an ant strategy game) You can follow the progress on http://antwars.blogspot.com

Like I told earlier ... 3DS is more complicated. I found a website with good discriptions though! http://www.xbdev.net/3dformats/3ds/3ds.php Try this website it explains everything in a 6-steps tutorial. I didn't read it completely, but it takes a lot of bit-operations it seems.

Hey, if you get this working I would really appreciate it if you let me something know. :) If you want you can also borrow my B3D DLL's it works pretty good, allthough I am still modifying some parts every day.

bvandenbon
(--AT--)
gmail
(--DOT--)
com
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.
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
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]

This topic is closed to new replies.

Advertisement