PDA

View Full Version : How can I load a 3dsmax scene?



Alload
03-16-2001, 05:31 AM
I want to load a complete 3DSMax scene in my OpenGL program, do you know a good way?

delnegro
03-16-2001, 06:12 AM
Even 3DSMAX won't load 3DSMAX scenes unless it has all the plugins needed (ex. if the scne uses some non-standard procedural object, you need that plug-in installed to load it). Most objects in MAX are... er... objects. :-) I mean they're not made of vertices like in the old 3DS. That means you'd need to have code to generate them from the parameters on your program (feel like re-programming 3DS MAX? :-). Also, the format may very well be copyrighted.

My suggestion is use .3DS (mesh) files or write a MAX plug-in to export the data in the format you want.

---
Rui del-Negro
delnegro@netcabo.pt

Jorrit
03-16-2001, 06:51 AM
Best way to load a MAX scene is to write a plug-in for MAX (MAXSDK is on the MAX CD's). Then you have full control over how the objects are exported in your own format. There are examples on the CD also, so it shouldn't take much time if all you want is just a mesh and it's texture. Actually you can create your own objects in MAX in the same way. This way you can edit your whole environment in MAX if you wish.

Spark
03-16-2001, 09:35 AM
The Max SDK is the best way to go, but if you don't want to learn it then max script works fine. There is a plugin that allows you to write/read binary data to files from maxscript. I have written an exporter that exports vertexes, faces, lights, cameras, bones, particle systems, keyframes and more using maxscript so it works.

holocaust
03-16-2001, 10:07 AM
You can use Flexporter (http://www.codercorner.com/Flexporter.htm) . It seems that M. Terdiman has done something great :
- 3DS Max 3/4 support
- exported file format doc

tgraupmann
10-20-2002, 09:48 AM
If you've written a max script or a binary importer that can output all the vertexes, faces, lights, cameras, bones, and particle systems, how should the faces be interpreted. I can output all the vertexes as points, but to form solid objects I need to combine the face information. How should the face information be handled? Here's a sample of what it looks like:

Verteces:
>>>>> Found Object vertices chunk id of 4110
Found (110) number of vertices
Vertex nr 0: X: -8.90 Y: -21.55 Z:-20.56
Vertex nr 1: X: -15.20 Y: -30.42 Z:-9.21
Vertex nr 2: X: -9.99 Y: -31.99 Z:-8.85
Vertex nr 3: X: -4.64 Y: -32.29 Z:-9.90

Faces:
>>>>> Found Object faces (1) chunk id of 4120
Found (216) number of faces
Face nr:0, A: 0 B: 2 C:1 , AB:0 BC:1 CA:0
Face nr:1, A: 0 B: 3 C:2 , AB:0 BC:1 CA:0
Face nr:2, A: 0 B: 4 C:3 , AB:0 BC:1 CA:0
Face nr:3, A: 0 B: 5 C:4 , AB:0 BC:1 CA:0

Hazem_vb
10-22-2002, 04:11 PM
You cannot do this but there is another

efficient way it is to make 3dmax export

the scene in a 3ds file and your task is to

load it in your opengl program .

A very well 3ds file loader you will find

on www.gametutorials.com (http://www.gametutorials.com)

I hope that will help

Hazem_vb

Mazy
10-22-2002, 10:16 PM
Originally posted by tgraupmann:
Here's a sample of what it looks like:

Verteces:
>>>>> Found Object vertices chunk id of 4110
Found (110) number of vertices
Vertex nr 0: X: -8.90 Y: -21.55 Z:-20.56
Vertex nr 1: X: -15.20 Y: -30.42 Z:-9.21
Vertex nr 2: X: -9.99 Y: -31.99 Z:-8.85
Vertex nr 3: X: -4.64 Y: -32.29 Z:-9.90

Faces:
>>>>> Found Object faces (1) chunk id of 4120
Found (216) number of faces
Face nr:0, A: 0 B: 2 C:1 , AB:0 BC:1 CA:0
Face nr:1, A: 0 B: 3 C:2 , AB:0 BC:1 CA:0
Face nr:2, A: 0 B: 4 C:3 , AB:0 BC:1 CA:0
Face nr:3, A: 0 B: 5 C:4 , AB:0 BC:1 CA:0

Use vertexarrays and indices
as you can see, the first triangle is built up by vertex 0,2,1 (in that order)
the AB, BC, CA is only for esge visability (you know that you dont actually see all triangles in 3ds, only selected edges, else you would have diagonal lines on each side on a cube)

so if you put all vertices in one array and then use
glDrawElements(GL_TRIANGLES,<number of indices>,GL_UNSIGNED_INT(usually), <pointer to indexarray> );

where the indexarray just is all the faces in a row ,like (0,2,1, 0,3,2, 0,4,3, and so on)



[This message has been edited by Mazy (edited 10-23-2002).]