isl-org / isl-org/Open3D

calling `update_geometries` results in a very slow `vis.poll_events` call

Open
#5,198 0 comments 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

We have a use case where we want to set the position of N objects manually each frame. However we have found that this seems to result in extremely slow rendering (6 Hz instead of 60 Hz). The code is below:

```python
for i in range(0, min_poses, 1):
start = time()

for geo in GEOMETRIES:
geo.mesh.transform(geo.pose.T_mat(i))

t1 = time()

cam = ctr.convert_to_pinhole_camera_parameters()
T_cam = cam_poses.T_mat(i)
cam.extrinsic = np.linalg.inv(T_cam)
ctr.convert_from_pinhole_camera_parameters(cam)

t2 = time()

# Comment this for loop out to make poll_events (t4-t3) go from taking 164ms to 8ms
for geo in GEOMETRIES: # There are 8 meshes in here
vis.update_geometry(geo.mesh)

t3 = time()

vis.poll_events()

t4 = time()

vis.update_renderer()

t5 = time()

for geo in GEOMETRIES:
geo.mesh.transform(geo.pose.T_inv(i))

end = time()

print('t1-start {:.3f} t2-t1 {:.3f} t3-t2 {:.3f} t4-t3 {:.3f} t5-t4 {:.3f} end-t5 {:.3f}'.format(
t1-start, t2-t1, t3-t2, t4-t3, t5-t4, end-t5))
```

Typical output:
```
t1-start 0.005 t2-t1 0.000 t3-t2 0.006 t4-t3 0.164 t5-t4 0.000 end-t5 0.005
```

164 milliseconds is being spent in the `vis.poll_events` call if the the `update_geometry` for loop is run. Without the `update_geometry` calls the loop runs at 60 Hz and a typical output is:

```
t1-start 0.005 t2-t1 0.000 t3-t2 0.000 t4-t3 0.006 t5-t4 0.000 end-t5 0.006
```

So my questions are:
* Why is the slowness appearing the `poll_events` call?
* Is moving objects meshes slow in Open3D, or is there a better way?

Thanks so much!

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.