3DS loader


Well thats not exactly OpenGL issue, but anyway… I was feeling that
many people have 1 problem with 3D graphics: the data to work with. I
mean 3D graphics is about APIs and so on, but you also need some 3D
stuff to play with. And writing you own 3D modeller is a vast task.

Most people who work in a professional environment have access to
packages like 3D Studio MAX, Maya, Softimage, … which allow you to
export the data to you own format by writing a plugin, which is a matter
of <=2 days.

But many students and people who cannot afford this expensive software
have to use existing public domain data which is available on the
internet. The problem here is that there are many file formats and many
are not that easy to read. OBJ seems to be quite popular among beginners
but only a small part is available in this format.

The most common format is 3ds, but its not officially documented and not
as easy to read as obj files. So what I did was to write a 3ds loader
which abstracts the 3ds file structure and gives the developer direct
access to 3D data, allowing to save in any format. This was a nice
exersise for a weekend. When it was ready I realized that maybe other
people will find it useful and wrote a short docs for it. Its c++ based
and really very easy to use (in contrast with most other 3ds readers
i’ve seen (lib3ds, …)). The source code is under modified BSD lisence
so that anyone may use it for anything. And my another aim was to make
it ready-to-use: no dynamic libs, bo static libs, just 2 files, include
them in your project and it works!

Anyway sorry for too many words, just take a look here if you wish:


Or you can use 3D Explore to export ANY 3D modeling format file to a .cpp file which has all the vertices, texture coords, and normals in 3 big arrays… Thats what I use, also, I think this would create less overhead since you dont need to access the hard drive for the file, its all in the exe file already… just my thoughts

Yeah this may be ok for playing around but actually this sucks big way, because you need to recompile you program if your data have changed and no dynamic data loadign is possible.



I have downloaded your code.

I’m a newbie at opengl & 3d file formats
but I liked your code that converts 3ds
to (what?).

Have you got an example that loads your
format and displays or release the file


I use 3dexploration to convert .3ds into .0bj - still I do plan to be able to import .3ds at sometime and I really hate making file parsers- I get about half-way andfind that there are too many strange problems.

Well there are other ways to get ahold of 3Ds max cough cough.

But there are several other programs out there, free, like milkshape(has conversion t /from 3Ds Max), also cosmoworld is another even though its VRML, it still works nice, not as good as 3Ds MAx though Gotta scrunge the net abit.

But thanks for the code…give it try when I get outa work.

Why would you want to obtain 3DS? It will take too much time to learn how to create models and all, you are a PROGRAMMER after all, not an artist. I suggest using free models off the internet. Or, as in my case, obtain a friend who can do models for you. I know somebody who does all the models for me, he specialises in 3DS, so I dont need to go oput and spend $1000+ on the program and then even more time to learn how to use it.