isl-org / Open3D

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

Pointcloud shifts position while trying to rotate #6516

Open ajktym94 opened 10 months ago

ajktym94 commented 10 months ago

Checklist

My Question

I have a pointcloud which I am visualizing using SceneWidget(). After loading it, I change the camera position using self.widget3d.scene.camera.look_at() to get my desired view. Now if I try to rotate the pointcloud using Left click + drag, the pointcloud initially shifts it's position to the left by a considerable amount and then continues rotating. I do not want it to shift. What can be done to avoid this?

saurabheights commented 10 months ago

Can you share a reproducible code

ajktym94 commented 10 months ago

@saurabheights I was working on a reproducible code and meanwhile I came to a point where it looks like this is a problem with the look_at() parameters. Do you know what exactly is excepted as parameters here? I am playing with values according to my intuition now.

Documentation says it expects (centre, eye, up) but I do not fully understand what exactly is needed.

BlakeFreer commented 7 months ago

I had the same issue. There seems to be a disagreement about the camera's center of rotation, i.e. where the scene will rotate about when moving the camera.

I fixed the issue by explicitly setting the center of rotation to match the centre argument from look_at()

centre = [x, y, z]  # fill in desired center of rotation
self.widget3d.scene.camera.look_at(centre, eye, up)
self.widget3d.center_of_rotation = centre

See open3d.visualization.gui.SceneWidget.center_of_rotation

Interestingly, setting the centre of rotation via SceneWidget.setup_camera() does not fix the issue.