add colors to draw plotly mesh object
- 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](https://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](https://www.open3d.org/docs/release/) and the [latest documentation](https://www.open3d.org/docs/latest/) (for `main` branch).
### Proposed new feature or change
The colors of a triangle mesh is ignored by `o3d.visualization.draw_plotly`. We could consider implementing a similar behavior to `get_point_object` in `get_mesh_object`?
```python
def get_mesh_object(geometry,):
triangles = np.asarray(geometry.triangles)
vertices = np.asarray(geometry.vertices)
if geometry.has_vertex_colors():
vertexcolor = np.asarray(geometry.vertex_colors)
elif geometry.has_vertex_normals():
vertexcolor = (0.5, 0.5, 0.5) + np.asarray(geometry.vertex_normals) * 0.5
else:
geometry.paint_uniform_color((0.6, 0.6, 0.6))
vertexcolor = np.asarray(geometry.vertex_colors)
mesh_3d = go.Mesh3d(x=vertices[:, 0],
y=vertices[:, 1],
z=vertices[:, 2],
i=triangles[:, 0],
j=triangles[:, 1],
k=triangles[:, 2],
vertexcolor=vertexcolor,
flatshading=True,
lighting=dict(ambient=0.18,
diffuse=1,
fresnel=0.1,
specular=1,
roughness=0.05,
facenormalsepsilon=1e-15,
vertexnormalsepsilon=1e-15),
lightposition=dict(x=100, y=200, z=0))
return mesh_3d
```
### References
_No response_
### Additional information
_No response_
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.