Mapper for transparency

I have a situation, where I would like to hide some cells based on a custom array. I know that I add a custom array, threshold and a geometry but it is too slow. Meshes are very large.

I was thinking whether it was possible to access a custom array in a shader and just do a replacement shader with an early exit in the vertex shader.

I can use the vertex colors, scalarColor in the shader, but I also need them for display. Is it possible to have both vertex and cell colors enabled (=available, but not used). Preferably, I would like to use the cell colors just for indexing (=flags). I plan on using it for an undo feature for some sculpting that I am investigating.

Ideally, I would like to expose a custom attributes that is not used for anything thing else than what I would use it for. Even better if the current polymapper can do this already. When I apply a LUT, the LUT the determines color - could it just change the opacity and keep the original color RGB values. That would also solve it.

I know I can subclass the vtkPolyDataMapper, but then I need to do WebGL, WebGPU also. Currently looking into the code and see if there is some buffer that I can abuse for the purpose.

Trying with a custom vertex buffer… Will figure out what the name is and how I address it.

Thanks in advance.

Hiding individual cells from rendering and processing can be done using ghost arrays. Create a vtkUnsignedCharArray using vtkDataSet::AllocateCellGhostArray or vtkDataSet::AllocatePointGhostArray with the same number of tuples as the number of cells/points and set the individual values to vtkDataSetAttributes::HIDDENCELL or vtkDataSetAttributes::HIDDENPOINT. This array will serve as a binary mask effectively. See Ghost and Blanking (Visibility) Changes blog post for more details.

I have succeeded in doing this and the example demonstrating is currently broken, Hidden structured data (shown anyway, bug?) - #4 by Jens_Munk_Hansen