PDA

View Full Version : 3d Studio Max importing!?



detzel
01-23-2001, 03:36 AM
I need a straight forward approach to get my 3d studio max images into my open gl program. I've tried converters but I don't know what everything is for and what I need, do I need faces, meterails, ect? Can anyone shine some lite on this subject?

Ace_Man
01-23-2001, 05:22 AM
Export them in .ASE format. This is a text file with all the info you need to recreate your model in opengl. Then just write a text parser for this file to read in and store the info. Simple as that. Search for ASE file format if you don't understand what the file means (or this board)

detzel
01-23-2001, 05:25 AM
I understand that, the problem I am having is how to use all those values in my program. I have all the vertex's and faces, ext...but I don't know how to involve those in my code.

Ace_Man
01-23-2001, 09:16 AM
Here's a simple approach.

1-You have a list of vertices.
2-You also have a list of faces.
(I assume you've already read all this info from the file and stored it in an array or something)


Each face has a list of 3 numbers.
These are the different vertex points to use for "that" individual triangle.

Each face is a triangle composed of 3 points.

If for face 0, you have 7, 8, 1, this means look at your previous list of vertices
and use the values for vertex 7 (some x, y, and z value), vertex 8 (yet another x, y, and z value) and vertex 1 (the third x, y, and z ) value.

Voilla! You now have a triangle drawn from your model. Just loop through all the faces and construct the triangles from the vertex index values provided for each face.

And you have your whole model.

Trivial (not efficient) would be just a loop the cycles through all the face values. You'll read these 3 values in each loop. Then take these valiues and get the corresponding vertex numbers (an x,y,and z coordinate) for each value. Then draw a triangle with these 3 points.

I learned all of this from http://nate.scuzzy.net/docs/ase.html

Hope it's clearer

detzel
01-23-2001, 09:41 AM
Yes that makes it a lot clearer. Another thing is how about the color, how can I keep the same textures and colors I have in my model? Also, like is says on http://nate.scuzzy.net/docs/ase.html do I have to reverse the values when I read them in from say an ASE file, does 3d studio max have a different XYZ plane then openGL?

Ace_Man
01-23-2001, 10:31 AM
Yeah, you can export textures info and the mapping coordinates, normals, etc.. (I'm pretty sure color too) Texture mapping your triangles works nearly the same way as drawing them.

1-You have a list of Texture vertics
2-You also have a list of Texture Faces

Just match them up as before.

Start small though. Get the model in there first..Then try to add loading the texture vertex/Face values...Then normals etc...

When you export the ASE, I think you check the "Generate Mapping Coordinates", "Normals", etc..options. Just check whatever you want and it will appear in the ASE file (look for yourself).


The Y and Z values are switched. I guess it's how you look at it. It's all about what coordinate system you use. 3D Studio Max uses a different system then how I set it up in OpenGL. Your model will still load, It will just look strange.

I found that by switching the Vertex Y and Z, (from your list of vertices) my models would look correct.