isl-org / Open3D

Open3D: A Modern Library for 3D Data Processing
http://www.open3d.org
Other
11.19k stars 2.27k forks source link

Why the rendered image is wrong while using the method open3d.visualization.draw_geometries? #6102

Open jackieyung opened 1 year ago

jackieyung commented 1 year ago

Checklist

My Question

When I tried to use the method open3d.visualization.draw_geometries to render an image, I found the output is wrong. Below is my codes and results.

Codes when I use the method open3d.visualization.draw_geometries:

import open3d as o3d
import numpy as np
import cv2

obj_path = 'Disk_01a.obj'
texture_path = 'T_Disk_01a_D.png'
vis = o3d.visualization.Visualizer()
w = 1024
h = 1024
vis.create_window(visible=True, width=w, height=h)
mesh = o3d.io.read_triangle_mesh(obj_path, enable_post_processing=True)
vis.add_geometry(mesh)
vis.poll_events()
vis.update_renderer()
o3d.visualization.draw_geometries([mesh], 'scene', width=w, height=h) 
vis.destroy_window()

The rendered image when I use the method open3d.visualization.draw_geometries:

1

From the result, we can see the texture image doesn't fill up the mesh. It's a wrong result.

When I change the method to open3d.visualization.draw, I got the right result.

Codes when I use the method open3d.visualization.draw:

import open3d as o3d
import numpy as np
import open3d.visualization.rendering as rendering

obj_path = 'Disk_01a.obj'
texture_path = 'T_Disk_01a_D.png'
mesh = o3d.io.read_triangle_mesh(obj_path, enable_post_processing=True)
material = rendering.MaterialRecord()
material.shader = "defaultLit"
material.base_metallic = 1.0
material.albedo_img = o3d.io.read_image(texture_path)
scene = {"name": 'scene', "geometry": mesh, "material": material}
o3d.visualization.draw(scene, title="scene", width=1024, height=1024)

The rendered image when I use the method open3d.visualization.draw:

2

From the result, we can see the texture image totally fill up the mesh. It's a perfect result.

Here is the mesh and its texture image: scene.zip

Is there anyone who can help me to get the right rendered result while using the method open3d.visualization.draw_geometries? Thanks a lot. God bless you.

dufengit commented 8 months ago

Hi, bro, have you found solution for this problem? i met the same problem https://github.com/isl-org/Open3D/issues/6506