jupyter-widgets-contrib / ipygany

3-D Scientific Visualization in the Jupyter Notebook
BSD 3-Clause "New" or "Revised" License
489 stars 52 forks source link

Clipping range issue #119

Open tomsal opened 3 years ago

tomsal commented 3 years ago

Hi,

I am using ipygany together with pyvista in a jupyter notebook. I am mostly working with large point clouds of traffic scenes. When zooming in on certain parts of the point cloud, points are disappearing. It is a behavior I do not experience with for example the ipyvtklink backend of pyvista.

Unfortunately, I cannot give you a minimal working example at the moment, because the data I am using is not public, but here's a short video of what I am experiencing. (Note the backend was set globally to ipygany.) https://user-images.githubusercontent.com/21262762/131076118-225bac83-5408-4462-bf11-1ade3a31f80a.mp4

I am guessing is that this is a clipping issue. Specifically, I suspect that line https://github.com/QuantStack/ipygany/blob/20b82f08c41f415919da11bf161c7dee2d97b2c7/src/widget.ts#L987 and https://github.com/QuantStack/ipygany/blob/20b82f08c41f415919da11bf161c7dee2d97b2c7/src/widget.ts#L1015 could cause this issue. Is there a way to change the clipping range? Using the camera object of pyvista does not seem to have an effect.

The reason I suspect that this is the issue, is that the order in which I add meshes to the plotter matters. For example,

...
plotter.add_mesh(pc, point_size=5, render_points_as_spheres=True, color='g')
arrow = pv.Arrow()
plotter.add_mesh(arrow)
...

works fine (except for the clipping when zooming in), whereas doing it the other way around

...
arrow = pv.Arrow()
plotter.add_mesh(arrow)
plotter.add_mesh(pc, point_size=5, render_points_as_spheres=True, color='g')
...

leads to a blank scene.

I really like the idea of ipygany, but this makes it unusable for me at this point, unfortunately. It would be great to see this fixed in the future. :)