vtkCellPicker very slow


I am implementing some point picking on a mesh with 127000 triangles. I’d love to pick points on the mesh while the user is interacting, but picking can take up to 300ms.
I tried with a mesh of similar size in three.js and there picking only takes 30ms.

Is there something I do wrong in the code? How can I improve performance?

   function cellPickOnActors(renderer, actorsToPickOn, point) {
           // Caching the picker has no performance gain
           // Ephemeral, short lived, picker
           let pointPicker = pointPicker = vtkCellPicker.newInstance(); // Alternative: vtkPointPicker
           pointPicker.setTolerance(0) // https://discourse.vtk.org/t/cellpicker-example-glitch/1852
           actorsToPickOn.forEach(actor => {
           pointPicker.pick(point, renderer);
           return pointPicker;

Warm greetings,
Emile Sonneveld

The vtkCellPicker has a method called AddLocator() for providing a vtkCellLocator that can accelerate the search.

The basic usage is:

  • create a vtkCellLocator
  • use SetDataSet() to put your data into the locator
  • call Update() on the locator
  • add the locator to the picker

We don’t have a cellLocator in vtk.js. We do have a hardware selector that allow point picking but not yet cell picking (if I recall correctly). And that one is fast as it is using the pixel of the rendering which is probably what three.js is doing.

vtkCellPicker is indeed relatively slow but there are many other pickers in VTK. Hardware-accelerated pickers can be magnitudes faster but they have other limitations (they rely on z buffer, so transparency may cause problems).

Thanks for the replys. It seems that in VTK.js, the locators are not implemented yet.

The hardware point picker sounds interesting, but I can’t find it in VTK.js. Anyone knows how to use it?

Here are some of its usage throughout the code: