On 2016-06-09 16:29, Kuo Lu wrote:
> Hi Mr. Schafer,
>
> Here is the update: since last time I decided to parse .obj files, I
> studied this tutorial
> <http://www.opengl-tutorial.org/beginners-tutorials/tutorial-7-model-loading/>
>  to

I'd like to make some comments regarding the information in that 
tutorial about the OBJ format and the things it's omitting by very 
carefully setting the export flags.

'f' directives describe a polygonal face which may have more than 3 
vertices. If it does, they'll be provided as more of the 'v/t/n' tuples 
and it's up to you to figure out how to handle N-gons or if you're going 
to triangulate them somehow.

Also on the 'f' directive, the tuples are not always on the form 
'v/t/n', valid formats are also 'v//n', 'v/t' and 'v'; omitting some of 
the components.

The indices are not always positive integers either. A negative index 
means offsetting from the last element of that kind read thus far. If 
you've got N positions read thus far, 1 would refer to the first one, 
while -1 would refer to the last one thus far.

The final pass done in that tutorial to generate a singly-indexed stream 
of vertices may not be necessary if your code can handle the kind of 
multiple indices that OBJ has, or if you only care about the positions 
and can ignore the texture coordinates and normals.

If you run into trouble reading files you've exported, you may need to 
restrict the options used to export to generate files you can handle, or 
handle the files in a more complete manner. These are the common traps 
I've run into implementing OBJ parsers in the past, I hope some of it is 
of help.

A problem you would have to face is that OBJ can at best represent 
geometry objects made up of one or more polygons. It carries no 
information about what kind of Blender object the geometry is sourced 
from like boxes / spheres / cylinders / whatever. If your task depends 
on approximating the geometry with fundamental forms, you may need to 
figure out how to deduce that from the polysoup you have.

// Lars V. -- amateur 3D graphics dabbler
_______________________________________________
hpx-users mailing list
[email protected]
https://mail.cct.lsu.edu/mailman/listinfo/hpx-users

Reply via email to