Jump to content
  • Advertisement
Sign in to follow this  
abolfoooud2

OpenGL what is the best format for 3D models for opengl?

This topic is 4845 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

regards, i am trying to load some 3D models into a simple opengl example using vertices and faces. i used 3DS Max to create my object and generate the .wrl format file. however this format includes the transformation and rotation values of each component of your object, in case it is compund of many objects. that is not practical. what is the format that can give me only vertices and faces, if anything is available?? i hope someone can pick me up of th gap am stuck in :(

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Wavefront OBJ

It's very easy to use and parse, and contains only vertex and face data as long as your models don't contain fancier stuff (like splines/spline-patches/etc).

Share this post


Link to post
Share on other sites
Thnax for the reply.
i tried Obj and it seems promising, except for one thing:
what does a code like the following mean when it comes to defining the faces?

g Box01
s 1
f 1/1/1 2/2/1 3/3/1
f 2/2/1 4/4/1 3/3/1
s 2
f 3/1/2 4/2/2 5/3/2
f 4/2/2 6/4/2 5/3/2
s 1
...

what does the / have to do with the thingy?

Share this post


Link to post
Share on other sites
i would say OBJ's are good except materials are stored in a seperate file, which tends to complicate things. That and materials are specified as a directive instead of an implicit part of a group or face. If you are just using geometry, these work as good as any, but if you want to store your texture maps or matrials with your model I always used Milshapes 3d ASCII format. I think 3D studio has a simular one.
Also, i've had problems with performance with my OBJ loader and high poly count models. Can any one help both of us out and cough up a link to a good OBJ loader that supports materials (more than one) and loads quickly with high poly counts?

Share this post


Link to post
Share on other sites
group: Box01

s: i forget

f: <index of vertex>/<index of vertex>/<index of vertex> X3

your vertex indexes are dependent on the order which they are stored in the file. so

1/2/3 ==

v 1.000 0.00 0.00
v 2.000 0.00 0.00
v 3.000 0.00 0.00

Share this post


Link to post
Share on other sites
tanx anist for your clarifications
unfortunately, Milkshape 3D ASCII replicates the data in the exported file. for instance, if u design a simple cube with 8 vertices, u end up having 20 vertices in the Milkshape 3D ASCII exported file. thats is goinna be too much waste if you have complecated objects.
Obj is good for now. but i thnk i will face problems later when i want to map textures on it.
lets hope somebody will help us :)

Fadi

Share this post


Link to post
Share on other sites
Actually, splitting the vertices is necessary when they don't share the same normal or U/V information. It's as efficient as it can be. If you store separate arrays and separate indices, it'll actually take MORE space for any mesh of real complexity, than storing the single pre-split vertex array. Not to mention that's the way the hardware wants it. Also: the cube is pretty much the worst example, because each vertex splits into three. Most normal, more complex, meshes only get a split ratio of 10-30%.

For more information on vertex array splitting, see here.

Regarding file formats: why not take the .wrl file and post-process it to transform the vertices to whatever format you want? Or maybe use the IGameExporter interface (part of the SDK that comes with Max) and write your own? Or write an XML exporter using MaxScript -- Ogre3D has one you can look at if you want. Or perhaps take something pre-made, such as Cx.

Share this post


Link to post
Share on other sites
hplus0603,

thank u for ur help.
concerning the wrl format, i tried it but it did not work as i wanted. i desinged a simple object that is compound of 4 distinct shapes (boxes with lots of vertices). when i try to draw it, i get defaced final result. the problem that i noticed is that the wrl format defines translation and rotation values for each single shape in ur design. this means that all of the objects are centered and drawn in the same position, then transformed. thats why i couldnt make any use of it.

and concerning the IGameExporter interface , i found it and downloaded it, but didnt know how to use it!!! it is all header and dll files.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!