Hi PaQ, yeah the term "smoothing groups" usually refers to something different than just support for reading in vertex normals, although both of these involve the mechanisms of how to make a flat polygon appear as though it is part of a smooth surface.
Usually what is meant by "smoothing group" is literally a group membership that you can have polygons assigned to, like 10 polygons could be assigned to "smoothing group 1", and some other 20 polygons could be assigned to "smoothing group 2". Then when creating vertex normals by the method of averaging the normals of adjacent polygons together, it will only make the average with polygons from the same group, which creates a kind of break line between the different groups.
But that only applies to having vertex normals calculated by an averaging process.
It is far better for imports to actually read the vertex normals from the file when they are present, rather than trying to recompute them by an averaging process at all.
This is especially important for NURBS models, since the vertex normals created from a NURBS model are very accurate and come from the actual smooth NURBS surface instead of just being averaged between flat polygons.
In the OBJ file, the actual vertex normals are stored in "vn" entries. If you open up the OBJ file in a text editor you will see some lines in it like this:
vn 0.88390502 0.00000000 0.46766645
vn 0.88390502 0.00000000 0.46766645
vn 0.86692122 -0.19508928 0.45868047
vn 0.81662210 -0.38268250 0.43206764
vn 0.81662210 -0.38268250 0.43206764
vn 0.73494043 -0.55556979 0.38885058
That is the stored vertex normal data. The relevant part of the OBJ spec says this:
quote:
vn i j k
Polygonal and free-form geometry statement.
Specifies a normal vector with components i, j, and k.
Vertex normals affect the smooth-shading and rendering of geometry.
For polygons, vertex normals are used in place of the actual facet
normals. For surfaces, vertex normals are interpolated over the
entire surface and replace the actual analytic surface normal.
When vertex normals are present, they supersede smoothing groups.
i j k are the i, j, and k coordinates for the vertex normal. They
are floating point numbers.
It's an optional thing for an OBJ file to have vertex normals, but when they are present it can make a really big difference in shading to read them in rather than trying to produce new normals only from the polygonal data.
It's also possible for there to be smoothing group data in an OBJ file as well, which are present in the OBJ file as "s" statements. MoI will actually export those as well, with polygons that come from one smooth surface being grouped together within the same smoothing group.
It's not really a problem to just ignore the "smoothing group" data though (the "s" directives in the file), because it should not actually end up being used for anything when the vertex normals are in the file, in OBJ files it is intended that vertex normals that are present in the file should be used instead of the smoothing groups anyway.
Reading the vertex normals out of the file is definitely a very important feature for rendering output from MoI.
- Michael