isl-org / isl-org/Open3D

visualization.rendering.OffscreenRenderer incorrect color values

Open
#5,861 1 comment 0 reactions 0 assignees View on GitHub
bug
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).

### Describe the issue

I am rendering a colored mesh with different viewpoints using OffScreenRenderer. While rendering the projection to image, I am getting different RGB channel values. While rendering, the RGB values of triangle faces (must be constant for each triangle face) have different values when examining the images on GIMP.
The same algorithm, when used with View Control, delivers consistent RGB values corresponding to each triangle face.

### Steps to reproduce the bug

```python
img_width = 640
img_height = 480
render = o3d.visualization.rendering.OffscreenRenderer(img_width, img_height)

mtl = o3d.visualization.rendering.MaterialRecord()
mtl.base_color = [1.0, 1.0, 1.0, 1.0]

render.scene.add_geometry('rotated_model', mesh, mtl,True)

vertical_field_of_view = 15.0 # between 5 and 90 degrees
aspect_ratio = img_width / img_height # azimuth over elevation\n
near_plane = 0.1
far_plane = 50.0
fov_type = o3d.visualization.rendering.Camera.FovType.Vertical
render.scene.camera.set_projection(vertical_field_of_view, aspect_ratio, near_plane, far_plane, fov_type)

render.scene.camera.look_at(center, eye, up)
img_o3d = render.render_to_image()
img_cv2 = cv2.cvtColor(np.array(img_o3d), cv2.COLOR_RGBA2BGRA)
cv2.imwrite(r'/home/complete_rendering/'+mesh_name+'_'+str(triangle_in_consideration)+'_'+str(Distance_from_obj)+'______'+str(datetime.now().time().strftime(\"%d_%m_%H_%M_%S\"))+'.png',img_cv2)
```

### Error message

non-uniform color values generated when rendering the colored mesh.

### Expected behavior

The images must have uniform RGB color values for each triangle face (there must not be any variation in the RGB values for a single triangle face)

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 22.04
- Python version: Python 3.10.8
- Open3D version: 0.16.1
- System architecture: x86
- Is this a remote workstation?: no
- How did you install Open3D?: pip
```

### Additional information

_No response_

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.