I have tried to analyze .obj files that are exported from Blender and I have difficulty figuring out what conventions the exporter uses for determining the order in which individual object information is given. For example, if I place a cube, a cone and a cylinder on the screen, I cannot figure out how blender decides the order in which to list those object’s data in the .obj file.
I want to use the data in a C++/OpenGL program but I am not at all sure the most efficient way to do that. I know I need to write code to sort the data into meaningful (animatable) parts such as arms, legs, etc. Even simple models get complicated very quickly if extrusions are used in their making. For example, a simple cube with 8 vertices can become a collection of tens of vertices but will still be called a “cube” in the export file. Is manual determination of relevant vertices the only way to use these data or is there some trick I am missing? Please point me in the right direction to learn how to make this work.
Perhaps .obj files aren’t the way to go. I would be glad to learn that too. Thanks for any advice.
The order of objects is simple whats returned by Blender.Scene.GetCurrent().getChildren()
This will be the order that the objecyts were added. but you probably shouldent count on that. I dont see any reason the objects should be in a set order.
The obj spec is fairly easy to find. google for it.
Im not sure what your getting at about the verts.
Make sure your using the latest obj exporter.
Since OBJ is such a simple format a lot of people ask that it orders the verts in some special way. or that it exports lamps as comments etc.
As far as Im concerned- the OBJ exporter exports valit OBJ files.
if your importer cant read them.
if you want lamps or some other data.
use a different format.
of course feel free to modify the exporter for your needs.
Thanks for the reply. Perhaps my question wasn’t entirely clear.
I am ok with the object spec and I understand all of that. What I do not know is how do people use it with complex models. For example, if you start with a simple shape like a cube, there will be a list of vertices in the obj file. Easy enough. But then lets say you start extruding vertices and adding faces and so on. When you export the more complex model, the vertex list is still labeled ‘cube’ but it consists of far more vertices (and other data). What I do not understand is how do people deal with those vertex lists. Do they go through the data manually and identify the group to which each vertex belongs (i.e. arm, leg, foot, etc.)? Do they do multiple exports then subtract previous vertices from the current list? I am just looking for the most efficient or standard way of dealing with this. Is a different export method superior?
I have been working with Blender for a little over a year but I am just learning to export models for use with OpenGL.