Cell picker using HardwareSelector

I know this question is raised before but I still cannot find definite answer how to use hardwareselector.
I’m using ActiViz 9.2 and have the same problem discussed here
How to select a hexahedral cell using HardwareSelector.
I’m using vtkgeometryfilter to triangulate unstructured grids and I do set PassThroughCellIdsOn() in order to preserve original cell id, but vtkSelectionNode always returns the ID of the triangle used to represent faces of the hexahedral or polyhedral cell. Here use the peace of the code I have so far.

vtkHardwareSelector hs = vtkHardwareSelector.New();
hs.SetRenderer(renderer);
hs.SetFieldAssociation(1);
hs.SetArea((uint)pos[0], (uint)pos[1], (uint)(pos[0]+1), (uint)(pos[1])+1);
vtkSelection selection = hs.Select();
vtkSelectionNode SelectionNode = selection.GetNode(0);

Previously I was using vtkStaticCellLocator this works fine hexahedral cells, but in case of polyhedral cell type, cell picking is very sketchy and inaccurate. The same issue is with vtkCellPicker

I tested the same polyhedral unstructured grid in ParaView and as expected works perfectly.
Can anybody please share ideas how they do it or is that heavily guarded secret. :slight_smile:

Thanks in advance.
MK

vtkHardwarePicker uses vtkHardwarSelector and is the equilavent of vtkCellPicker.
vtkHardwarePicker uses a rendering way to pick cells while vtkCellPicker uses a geometric way to pick cells.

1 Like

Hi Spiros
Thanks for reply.
I tested earlier vtkHardwarePicker and was having the similar issue as with vtkHardwareSelector. Strangely only after I swap vtkDatasetMapper to vtkPolydataMapper, vtkHardwarePicker worked perfectly. Not sure why would that be a problem but at least it works now.
MK

I am glad to hear that it works as expected.