itk-vtk-viewer icon indicating copy to clipboard operation
itk-vtk-viewer copied to clipboard

Improve the point cloud rendering performance by using strided arrays

Open oeway opened this issue 4 years ago • 2 comments

Hi @thewtex I noticed that the viewer becomes unusable when displaying a large number of points.

See the screen recording below, for an image with 1.7 million points, after displaying the image, I can barely do anything: itk-vtk-viewer-point-cloud

In contrast, with another three.js based point cloud viewer called Fairy Dust, we can display the file nicely: fairy-dust

(for now you can reproduce it by this link: https://shareloc.xyz/#/?type=dataset&id=04cb0d658f351d47446b351dca89ef4c after loading the page, click the eye icon for the Fairy Dust viewer, and the VTK icon for itk-vtk-viewer, NOTE: this link might not work in the future)

Fairy Dust has a relatively simple solution, see the imjoy plugin here. If I understand correct the trick it does is that it will first divide the point cloud array into chunks or strided arrays based on their original order, then it will display the chunks incrementally. Since I am not faimilar with the webgl programming, but I believe this part is relevant.

Of course the best way forward would be support full multi-resolution octree similar to potree, but that might require substantial changes. For short term, I am thinking that whether we can use a similar strategy as Fairy Dust does.

@thewtex What do you think?

oeway avatar Jun 29 '21 17:06 oeway

(for now you can reproduce it by this link: shareloc.xyz/#/?type=dataset&id=04cb0d658f351d47446b351dca89ef4c after loading the page, click the eye icon for the Fairy Dust viewer, and the VTK icon for itk-vtk-viewer, NOTE: this link might not work in the future)

@oeway Love this!

Fairy Dust has a relatively simple solution, see the imjoy plugin here.

Very nice!

If I understand correct the trick it does is that it will first divide the point cloud array into chunks or strided arrays based on their original order, then it will display the chunks incrementally. Since I am not faimilar with the webgl programming, but I believe this part is relevant.

Yes and we could also use meshoptimizer, which optimizes this process is WebAssembly.

Of course the best way forward would be support full multi-resolution octree similar to potree, but that might require substantial changes. For short term, I am thinking that whether we can use a similar strategy as Fairy Dust does.

Agreed. We can support potree / entwine / cesium 3d-tiles multi-resolution data structures going forward, but we can add Fairy Dust viewer and this simple sort-sample approach for "smaller" in-memory datasets. I'll take this approach as we improve the point set support. :two: :brain:

thewtex avatar Jun 30 '21 13:06 thewtex

@thewtex Thanks! Sounds good.

I just found an earlier version of Fairy Dust which is here: https://github.com/Flexi23/pointcloud-loader The files might be easier to understand than the ImJoy plugin I have.

oeway avatar Jun 30 '21 18:06 oeway