Grouping statements set a state: they apply to every element after them, until the next statement of the same kind. They do not change the vertex numbering.
g – Group
g name1 [name2 …] names the groups the following elements belong to. An
element can be in several groups at once. A file with no group statement puts everything in
the group called default.
s – Smoothing group
s number or s off. Elements with the same non-zero number
are smoothed together where they share an edge. 0 and off
turn smoothing off. For free-form surfaces any number above 0 means on. A face with
normals of its own ignores smoothing groups.
mg – Merging group
mg number res or mg off. Free-form surfaces in the same
merging group are checked for adjacency within the resolution res and
joined where they meet. res must be greater than 0 and is required when a
group is set. 0 and off turn merging off.
o – Object name
o object_name names the object the following elements belong to. The
specification says this name is informational only and is not processed.
Many programs write one o for each separate part of a model. The
explorer uses o, then g, to arrange a file’s structure tree.
o Table
g top
s 1
usemtl Oak
f 1 2 3 4
g legs
s off
usemtl Steel
f 5 6 7 8
Not described
What this page leaves out, and what the explorer does not do.
Known, not yet covered
- Reference: how programs differ in using
oandg(some start a new mesh at each, some ignore them): visible in the code of Blender’s importer and tinyobjloader, not written up. Howsinteracts with normals follows the specification and is unchecked in practice. - Viewer: objects, group names and smoothing groups are listed with their face counts, and the tree is arranged by them, but they do not change the pictures. Smoothing groups are not used for shading, and merging groups (
mg) are checked and not applied.