1

When visualizing a 3d object from lidar data, the colors are included and mapped to the correct location. Mesh Rendered with color in open3d.visualization()

o3d.visualization.draw_geometries([voxelMesh])

However, when I go to write this exact mesh to an object, the color is not included and it appears gray, with no .mtl file included. I cannot figure out why this is happening and how to fix it. .obj file created by open3d.io.write_triangle_mesh()

meshTransformed = np.array([[1, 0, 0, 0], [0, 0, 1, 0], [0, -1, 0, 0], [0, 0, 0, 1]]) o3d.io.write_triangle_mesh(outputPath, voxelMesh.transform(meshTransformed), write_triangle_uvs=True)

What I don't understand is how the mesh has the color, and works perfectly within the Open3D viewer window but the colors do not export when the .obj file is created, even with write_triangle_uvs=True.

EDIT

So, when the program is executed, there is no MTL file with the .obj file that would include the textures. Output object file created by open3d. If you open the file created it is still in black and white.Open the file in any 3d viewer: i.e. Blender, Maya, Microsoft 3d You will see there is no texture included with it.

4
  • Could you please include more information to reproduce this error? I was able to visualize the colors as expected using the following snippet, and I cannot see what is different in your approach gist.github.com/dilaragokay/d0f9b88b125593cd077a94c7d71daa82 Commented Jul 28, 2022 at 8:57
  • Hello, I included more information in the edited post. Also I ran your code and if you go to your file output location and open the object file you will see there are no colors as expected. My concern is not visualization, my concern is saving the file with the textures included. Hope this helps! Commented Jul 29, 2022 at 12:36
  • Same question here. Did you end up with any solution? Commented Jan 30, 2023 at 18:10
  • Use a different library, Open3D does not have this functionality... I used: import pymeshlab as pml Commented Feb 10, 2023 at 20:03

1 Answer 1

0

This comment points to the possible culprit: github.com/isl-org/Open3D/issues/4763#issuecomment-1040248762

The python loader somehow creates two textures, one fake empty one and your actual texture. (Try print(voxelMeshes.textures)).

One workaround is to set enable_post_processing=True when loading as suggested in that comment.

Another workaround is to update textures to keep only yours i.e.

# remove the empty texture in the first position of the list
voxelMesh.textures = [voxelMesh.textures[1]]

# update the mapping triangle_ids -> material ids so that all triangle use the texture at position 0 of voxelMesh.textures i.e. yours
num_triangle = len(voxelMesh.triangle_material_ids)
keep = [0] * num_triangles
voxelMesh.triangle_material_ids = o3d.utility.IntVector(keep)

You should see the texture when visualizing both with the open3d command line and the python function draw_geometries

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.