Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Quick Question about 3D model format

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Quick Question about 3D model format
Steve Terry
Member #1,989
March 2002
avatar

My obj loader handles all of those situations and even 3ds files :)

___________________________________
[ My Pictures ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Dario ff
Member #10,065
August 2008
avatar

So since I've been able to work out this mesh-loader thing now I have an scene composed of objects going up to thousands. The thing is, I would like to export an scene of it(after I did my own edits of course), with the right object positioning and all that.

Would OBJ be a good format for that? I need to export an scene with no texture data, uv mapping, skeletons, etc. Just need vertexes, normal, and faces, and multiple objects. Looking over the OBJ information on Wikipedia I've been able to make exports of singular objects, but Max seems to just die on me when trying to import a whole scene of it saying "Invalid Vertex Index". It doesn't show this error if I click on import as single mesh... but I don't want to show it as a single mesh, and it seems to just crash anyway. :-/ I've been googling about info on the OBJ format but I have some doubts.

My questions are:

  • Is this the right way of writing out an OBJ file? (Values are made up, not a real object)

#SelectExpand
1g myobject01 2v 1.0 1.0 1.0 3v 0.0 0.0 0.0 4v 1.0 0.0 1.0 5v 0.0 1.0 0.0 6 7vn 0.333 0.333 0.333 8vn 0.333 -0.333 0.333 9vn -0.333 0.333 0.333 10vn 0.333 0.333 -0.333 11 12f 1 2 3 13f 3 4 1 14 15g anotherobject02 16...similar data like above...

  • What's the right way to write out vertex indexes for the face data? Is 0 a valid index, or does it start from 1?


  • Related to the index question, every time I declare a new object using "g <name>", is the vertex index for the face data supposed to start from 0/1 again, or is it an absolute index of the whole file?


  • I guess faces are supposed to be written in the same way I imported them? (as in groups of three, instead of triangle strips)

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

type568
Member #8,381
March 2007
avatar

Dario ff said:

Another model.

I thought it was the same one with more adjustments to the triangles :P

Dario ff
Member #10,065
August 2008
avatar

type568 said:

I thought it was the same one with more adjustments to the triangles

Oh I got plenty more models now. 8-)
{"name":"605577","src":"http:\/\/static.allegro.cc\/image\/cache\/a\/7\/a725dcb6f67ce6b0133fa48b6706319a.png","w":782,"h":583,"tn":"http:\/\/static.allegro.cc\/image\/cache\/a\/7\/a725dcb6f67ce6b0133fa48b6706319a"}605577

My only problem is that I want to export this but I can't really do it properly. :-/ I've tried exporting every single mesh as an OBJ, but Max just seems to die on them. The total polygon count is about 1 million. :o

So I was wondering if there's a more lightweight and easier to write to format than OBJ. Or some program that won't die on importing all these. :P It's about 3,000 files.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Steve Terry
Member #1,989
March 2002
avatar

well the idea with obj files is to separate all of the components of the scene into separate files that can be loaded all at once or on demand. You would then have to position them appropriately to make up the scene and potentially load them and remove them from rendering as necessary to improve performance. Obj files are also static objects so anything that bends or has skeletal movement doesn't really go well with the obj format.

___________________________________
[ My Pictures ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Dario ff
Member #10,065
August 2008
avatar

It's just static geometry so no problems. The vectors are already multiplied by the transformation matrix to be in the right positions.

I tried exporting every object in a separate obj file and I can load them on their own, but can't find any options to import them into a single scene in blender or max(and blender seems to have changed his "Import OBJ dir" options in the latest releases). However, appending them all to a single obj file like this doesn't seem valid? ???

Blender seems to crash due to memory usage when loading it up. Is the file incorrect? ??? I could probably do just fine with something that imports all OBJ files into a single scene tho.

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

Steve Terry
Member #1,989
March 2002
avatar

The problem is probably the obj format, if you notice your uncompressed data is around 60MB, compressed to 7. Maybe try a binary format such as 3ds?

___________________________________
[ My Pictures ]
Microsoft is not the Borg collective. The Borg collective has got proper networking. - planetspace.de
Bill Gates is in fact Shawn Hargreaves' ßî+çh. - Gideon Weems

Dario ff
Member #10,065
August 2008
avatar

I tried using lib3ds to save it, and while Max just said "Improper file format", blender opened it just fine, even for my 2GB ram. :) I'm just saving vertices and faces, so I wonder what's the problem with max.

I guess it's solved for now. Thanks. :)

TranslatorHack 2010, a human translation chain in a.cc.
My games: [GiftCraft] - [Blocky Rhythm[SH2011]] - [Elven Revolution] - [Dune Smasher!]

 1   2 


Go to: