PDA

View Full Version : Import an object from 3dsmax



dreamer
10-23-2001, 02:42 AM
Hi!

I would like to import an object from 3dsmax to my world in C++/OpenGL. How can I do this? It would really help with sample code.

Thanks...

heiman
10-23-2001, 04:37 AM
My understanding is that you must save the object as a 3DS file. The format of the ,max files is proprietary and changes with each version of 3D Studio.

There are several 3DS file readers on the net. lib3DS (www.sourceforge.com) is frequently used. I prefer the 3DSFTK. You can find a link to the 3DSFTK on my links page (http://members.home.net/scottheiman/links.htm).

Rendering an object is quite simple once you have read the data. A 3DS object is simply a collection of meshes. Each mesh defines a group of triangles that uses a common material and one or more textures.

The primary problem with 3DS files is that you must calculate the normal vectors for each triangle. Some 3DS files do not use a common winding convention that can be used to determine the direction of the normal vector. I have seen files that have 2 adjacent triangles facing opposite directions. I have seen several examples on the net that use lib3DS and the 3DSFTK to read and render 3DS files, but none of them have shown me how to resolve the winding problem.

Regards,
Scott

Morglum
10-23-2001, 05:08 AM
There are also ASE files. They are ASCII, so they are much bigger than 3DS files, resulting in longer loading time, but they are very easy to understand.