I know how to read a data when "f " record contains more than 3 group of indices. For processing a data I use following algorithm:

* If that set of indices has not been seen before:
** Add the vertex attributes referenced by that index to the attribute arrays.
** Add the index of the new vertex to the index buffer.
** Store the fact that this particular set of indices has been seen before, and which index you used in the index buffer with it.
* If that set of indices has been seen before:
** Retrieve the index for the index buffer that was stored for this set of indices.
** Add that index to the index buffer.
** Do not add any vertex attributes to the attribute arrays

The above obj file contains vn records and the algorithm process them properly so how should I interpret smoothing groups ? Are they necessary in that case ?

12-02-2012, 06:19 AM

Ilian Dinev

You don't need to handle smoothing-groups.
The modelling app initially uses them to generate normals per face-vertex; later to subdivide (tesselate) just before raytracing.

You only need to handle the "vn", and ignore "s".

12-02-2012, 04:38 PM

dukey

err
Normal groups are very useful. Say if you render a cube you don't want to normals to be smoothed on the shared vertices for example. You would want it to look like flat shading and so have 6 normal groups ......

as for parsing OBJ, good luck with that. It's a horrible format.

12-03-2012, 12:34 PM

Ilian Dinev

The modeler already gives you the normals per face-vertex exactly the way you want them. No need to parse "s" yourself.....