How to import a 3D Studio Max model?

Who can tell me how I can import a 3D model made in 3D Studio Max and import it in OpenGL so I can show it on the screen and walk thru it…
Is there also one for Lightwave? And which one is the best?

Mail me: Gunter_Dhondt@hotmail.com

You need to load the file just like any other except that the format of the file header/info header etc is different. I don’t know the exact format for the 3ds file of the top of my head, but I am sure that wotsit.org will have documentation of the file format for 3ds and lightwave, plus hundreds of others, maybe even some sample code for loading the files.

Basically though, what you are looking at is defining the structure of the header and info header

typedef struct{structure of header}TYPENAME;

typedef struct{structure of info header}TYPEINFONAME;

type data[];

open the file

fopen(filePointer, Filename);

read the file header and info

read the other bits

fread(filePointer, &data); I think :}

close the file

Then you should have an array of data about the file. Maybe. Or I could be entirely wrong. I haven’t had much sleep :stuck_out_tongue:

Hope this helps.

Nate

Originally posted by Gunter_DHondt@hotmail.com:
[b]Who can tell me how I can import a 3D model made in 3D Studio Max and import it in OpenGL so I can show it on the screen and walk thru it…
Is there also one for Lightwave? And which one is the best?

Mail me: Gunter_Dhondt@hotmail.com[/b]

A very common method is to export your scene as an ASE (ASCII) file. It is in plain english and takes no time to understand…

This way you can parse all of the information as text. On the downside, this is very slow if this is the way you want to load up the scene. A good thing to do is to make a converter from ASE to your own format.

-Drak

Nice reply … :slight_smile:
but if i remember right, the question was how to load a 3ds file, he? …
LOL

u might do what they said but you should also try to export it into a file.wrl (VRML). U won’t have problems of orientations and translations.

JC

you can also try to use 3d-exploration… I believe there’s a link to it on the www.opengl.org home page…

Well, if you don’t like the 3ds format, you can also write a plug-in to export the scene to the format you want . Well, it seems to be a little bit heavy just to look at a model, but it is VERY useful to store BSPs and all that stuff

Nate is right, www.wotsit.org has information regarding the 3DS and Lightwave file format. You could take a couple of hours and make your own loader… or search the net for other programs that do what you need.