Possible bug in OBJ importer ?

Anonymous 9 years ago 0
This discussion was imported from CodePlex

Rogad wrote at 2014-02-26 15:12:

I've touched on this before, but thought I would start a fresh thread.

I have an .OBJ model with 5 groups.
The five groups use a combination of materials.
One group may refer to more than one material.
The .OBJ file contains 33 references to these materials within the 5 groups.

When I load the OBJ file via Helix I end up with a model with 33 groups rather than the expected and desired 5 groups.

It seems the importer is making groups/children from each material rather than the OBJ file group.

Is this behaviour intended ?

It makes it impossible to run code on a single group, because its been split up.

When viewed in the model viewer the model appears as desired so there is no problem with mapping the textures.

Rogad wrote at 2014-02-26 15:43:

P.S. The model loads fine in MeshLab

Rogad wrote at 2014-02-26 18:19:

Just pulling the old topic in here : https://helixtoolkit.codeplex.com/discussions/528072

I changed my mind again. I think I was on track when I was suggesting the importer was making too many groups.

Because I can now answer this question :

objo wrote:
Can a group contain meshes with different materials?
In that case it is possible that the importer adds a new model for each mesh. The output model could be changed to a hierarchy, where the first level correspond to the groups.
The answer is yes a group can contain meshes with different materials :)

If that could be be changed to a hierarchy as you suggest then that may work for the best.

Rogad wrote at 2014-02-26 22:35:

Was thinking... yeah I do that !

I was concerned that implementing the hierarchy might break a lot of people's code.

I overcame my problem with multiple groups by de-fragmenting my model before I import it into Helix.

I think I have to live with a mesh being broken into groups to suit the materials.

So really it's up to you if you want to change the way it works, though my vote would go for a hierarchy.