[vtk.js] Implementing cell selection with the HardwareSelector

Would it be a pain to implement cell selection in HardwareSelector? Maybe you could suggest some key points and locations. I was looking to the current source code for a while but still could not get to the root.

I have polyData with cells. Cells are grouped via additional field data (let’s call it faceId). Usually, there are up to 100 faces for an object. If a user clicks on an image, I need to determine faceId of the clicked cell. I have done it with vtkCellPicker, but it is painfully slow.

Or, would it be feasible to create a separate actor for every face and use HardwareSelector on them instead?

It could be done the same way (or slightly simpler) as it is done in VTK C++. Basically add another pass to the selection process. Color that pass by the cell ID, then convert the webgl cell ID to the VTK cell ID for each actor. Not a trivial piece of code (and the implementation in VTK C++ is way more complex) but not super hard either.

Thanks for the tips. As I did not fully understand all this “pass” thing, I went for a solution with many actors. Unfortunately, I hit another problem as posted here.

It seems I will have to dig the code anyway :slight_smile: