Loosing duplicate points when applying vtkClipPolyData?

Hi all,

I am working on a large visualization project based on VTK and have stumbled on the following issue. What I am doing:

  1. Creating many polyData starting with some custom polygons;
  2. Assinging scalar values to points for coloring;
  3. Appending all polyData to each other;
  4. Creating mapper (with lookup table), actor and putting to screen;
  5. Clipping the created large polyData with a plane using vtkClipPolyData.

After step 5, I see that I loose colour transitions at sharp edges. My guess is that when I apply vtkClipPolyData filter, the data is cleaned-up, there is only one set of points on the edges and consequently coloring transitions smoothly (depending on triangulation resolution). I have a small C++ example to illustrate this (as a new user, however, I can not upload it). I am developing in Windows environment and using VTK-9.2.0.rc2.

Does anyone have any suggestion how to clip poly data without cleaning up the duplicate points?

I have found 2 possible workarounds to this issue, which are both sub-optimal:
A. refining the triangulation of polygons - this sharpens the color transition, but in large visualizations this leads to a very large number of polygons that need to be created and poor clipping performance (I regenerate the clips quite often).
B. using a separate actor for each polygon - this allows to keep sharp edges, however results again in poor rendering performance (as noticed by quite a few users before, such as in here and here).

Hi Ugis,

vtkClipPolyData works on manifold PolyData.
Your final PolyData is a merging of several manifold sub-PolyDatas, and is thus not manifold anymore.

There are certainly many many ways to do it, but the one I’ve chosen is to use a separate vtkClipPolyData for each sub-PolyDatas (with the same clipping parameters), and use the results as input of AppendPolydata filter.

Performances are not bad, and result is OK.

1 Like

Cool, thanks for the quick answer!

I have been thinking about applying clipping on separate polyData that builds up the whole set. But then I would have to keep track of sub-PolyDatas myself, right? Or is there an efficient way to break down the polyData output of AppendPolydata filter?

Once your polydatas have been merged by Append, your only way to retrieve any information about original data is to add point data at the beginning (eg. data index), and then re-get it at the end after append.

Right, I was expecting something like that. Then I think it would be more efficient to actually keep track of the individual poly data.

Thanks again for the useful comments!