Open3D icon indicating copy to clipboard operation
Open3D copied to clipboard

No color is being rendered while rendering obj file

Open Zumbalamambo opened this issue 4 years ago • 7 comments

@germanros1987 I'm using the following code to read the obj file. However, the rendered 3d object doesn't have any colors. why is that so?

import open3d as o3d

def visualize(mesh):
    vis = o3d.visualization.Visualizer()
    vis.create_window()
    vis.add_geometry(mesh)
    vis.run()
    vis.destroy_window()

mesh_o3d = o3d.io.read_triangle_mesh("textured.obj")

Zumbalamambo avatar Dec 01 '20 17:12 Zumbalamambo

it throws the following error message,

[Open3D INFO] Skipping non-triangle primitive geometry of type: 2

I'm using open3d v 0.11

Zumbalamambo avatar Dec 01 '20 18:12 Zumbalamambo

I got the same problem, but the function works fine in version 0.9.0.0.

kaixin-bai avatar Dec 02 '20 13:12 kaixin-bai

Same Problem!

JohnHardline avatar Dec 04 '20 08:12 JohnHardline

Had the same issue today, for me what solved it is in blender combine al the meshes together, so only 1 mesh is left. Maybe this solves the issue for you aswell.

Retia-development avatar Dec 09 '20 13:12 Retia-development

I'm having the same issue as OP but it does not work for me even with the older versions of open3d.

@Retia-development can you please share some more details on how you managed to combine the meshes? When I combine and export a single mesh as .obj in blender, the color and textures are still not shown upon loading in open3d.

matemijolovic avatar Dec 16 '20 22:12 matemijolovic

@matemijolovic for the merging I just pressed ctrl+j with all objects selected in Blender (see quote below).

You can merge multiple meshes together using a feature in Blender by default. Simply select all the meshes you wish to merge, and hit CTRL + J to join them together.

Afterwards i removed all the excess materials so only 1 uv map/material would be left (I don't know the exact steps for this, sorry).

Also make sure to export the uv image (in the UV editor there should be a button save as when the correct image is open) and place it in the same directory as the final obj/mtl file. Not sure if this step is important, but it doesn't hurt to try.

For the rest, make sure the mtl is also in the same directory as the obj when importing into open3d, that's all i got.

Good luck!

Retia-development avatar Dec 17 '20 10:12 Retia-development

@Retia-development thank you for the detailed steps!

For me the problem was related to the fact that the colors were defined per face instead of per vertex - individual layers had the colors assigned but Open3D cannot read this. I solved this by loading the .obj file in MeshLab and applying the transformation Filters -> Color Creation and Processing -> Transfer Color: Face to Vertex. Hope this helps if someone has the same problem.

matemijolovic avatar Dec 20 '20 22:12 matemijolovic