isl-org / isl-org/Open3D

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

Open
#6,102 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### 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](https://github.com/isl-org/Open3D/files/11302035/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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.