-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For TriangleMesh triangle_material_ids_ do not relate to the materials_ #5924
Labels
bug
Not a build issue, this is likely a bug.
Comments
dbs4261
added a commit
to dbs4261/Open3D
that referenced
this issue
Feb 20, 2023
Changed TriangleMesh::materials_ to be a std::vector<std::pair<std::string, Material>> so that the order of materials when loading a mesh is respected. Using the unordered map caused issues when a Default Material and a texture were loaded and the texture would end up as the second material in the iterator. Now TriangleMesh::triangle_material_ids_ will indicate what material index should be used. A warning is given when passing a TriangleMesh to the visualizer and more than one material index is found, and the minimum value found in TriangleMesh::triangle_material_ids_ is used. If no triangle_material_ids_ exist then the first material in the order they are loaded will be used.
dbs4261
added a commit
to dbs4261/Open3D
that referenced
this issue
Feb 20, 2023
Changed TriangleMesh::materials_ to be a std::vector<std::pair<std::string, Material>> so that the order of materials when loading a mesh is respected. Using the unordered map caused issues when a Default Material and a texture were loaded and the texture would end up as the second material in the iterator. Now TriangleMesh::triangle_material_ids_ will indicate what material index should be used. A warning is given when passing a TriangleMesh to the visualizer and more than one material index is found, and the minimum value found in TriangleMesh::triangle_material_ids_ is used. If no triangle_material_ids_ exist then the first material in the order they are loaded will be used.
dbs4261
added a commit
to dbs4261/Open3D
that referenced
this issue
Feb 20, 2023
dbs4261
added a commit
to dbs4261/Open3D
that referenced
this issue
Apr 20, 2023
Changed TriangleMesh::materials_ to be a std::vector<std::pair<std::string, Material>> so that the order of materials when loading a mesh is respected. Using the unordered map caused issues when a Default Material and a texture were loaded and the texture would end up as the second material in the iterator. Now TriangleMesh::triangle_material_ids_ will indicate what material index should be used. A warning is given when passing a TriangleMesh to the visualizer and more than one material index is found, and the minimum value found in TriangleMesh::triangle_material_ids_ is used. If no triangle_material_ids_ exist then the first material in the order they are loaded will be used.
dbs4261
added a commit
to dbs4261/Open3D
that referenced
this issue
Apr 20, 2023
For the Python 3.11 support part, track |
errissa
pushed a commit
that referenced
this issue
Oct 14, 2023
* Fix for Issue #5924: Changed TriangleMesh::materials_ to be a std::vector<std::pair<std::string, Material>> so that the order of materials when loading a mesh is respected. Using the unordered map caused issues when a Default Material and a texture were loaded and the texture would end up as the second material in the iterator. Now TriangleMesh::triangle_material_ids_ will indicate what material index should be used. A warning is given when passing a TriangleMesh to the visualizer and more than one material index is found, and the minimum value found in TriangleMesh::triangle_material_ids_ is used. If no triangle_material_ids_ exist then the first material in the order they are loaded will be used. * Updated CHANGELOG.md with info about fixing Issue #5924 * Updates to work with changes to the translation of tensor mesh materials ---------
@dbs4261 Thank for both reporting this issue and for the PR to fix it! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Checklist
master
branch).Describe the issue
The triangle_material_ids_ vector contain indices for which texture should be applied. However because materials are stored in an unordered_map, the indices cannot be used to access the corresponding material. It would be better to store a vector<pair<string, Material>> that way it is indexable, but materials could still be accessed by name using find with a lambda comparing names.
Steps to reproduce the bug
Error message
No response
Expected behavior
No response
Open3D, Python and System information
Additional information
No response
The text was updated successfully, but these errors were encountered: