So I'm writing a parser for wavefront obj model files and there are a few irregularities that I'm not sure how to handle.
So based off of my reading, a mesh can be broken up into groups using the 'g' command and a material can be assigned to each group using the 'usemtl' command
So an ideal file would look like this:
g group1
usemtl material1
//vertices
//UV coords
//faces
g group2
usemtl material2
//vertices
//UV coords
//faces
etc....
However in some obj files I've downloaded (from places like Turbosquid), I've seen a single group contain multiple "usemtl" like this:
g group1
usemtl material1
//vertices, faces, etc
usemtl material2
//vertices, faces, etc
g group2
usematerial material3
//vertices, faces, etc
So if there can be multiple materials per group then what is the point of a group?
Are these files considered "non-standard" or broken?
Should I instead be grouping faces based on shared material instead of shared group?
Having multiple materials per group would complicate a lot of my code (for instance - let's say I have to generate a set of N random samples on a group of triangles/faces with a certain material. If there's just one material per group I can just look up the triangles in that group and generate samples. But if that group contained some triangles with the correct material and some without, I'd have to do some weird material checking on top of the group checking to generate the right samples. This is just one example - there are others where this becomes an issue as well)