Preserve the color of a vtkPolyData after it is split by vtkOBBDicer

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
Report Content as Inappropriate

Preserve the color of a vtkPolyData after it is split by vtkOBBDicer

This post was updated on .
I am trying to implement isosurface visualisation in Unity using VTK.
Since Unity mesh's number of vertices is limited to 65553, a large surface needs to be split  up into smaller chunks.
I used vtkOBBDicer, vtkThreshold, and vtkGeometryFilter to spit and extract the polydata.
However, the resulting polydata from the extraction process lost the color array element.
Is there any solution to split up the vtkPolyData and keep the color accordingly?

Thank you in advance.

The result of the isosurface, the largest surface is white because the color array has gone when it is split into chunks.

This is the method I use to return the vtkPolyData chunks (it uses Activiz C# wrapper).

public static List<vtkPolyData> CreateGroups(vtkPolyData poly)
                vtkOBBDicer dicer = vtkOBBDicer.New ();
                vtkThreshold th = vtkThreshold.New ();
                vtkGeometryFilter geo = vtkGeometryFilter.New ();
                List<vtkPolyData> polys = new List<vtkPolyData> ();

                dicer.SetInput (poly);
                dicer.SetDiceModeToSpecifiedNumberOfPieces ();
                dicer.SetNumberOfPointsPerPiece((int) VERTICESMAX);
                dicer.Update ();
                th.SetInput (dicer.GetOutput ());
                th.AllScalarsOff ();
               th.SetInputArrayToProcess(0, 0, 0, 0, "vtkOBBDicer_GroupIds");
               geo.SetInputConnection (th.GetOutputPort ());

                for(int i = 0; i < dicer.GetNumberOfActualPieces(); i ++){
                        th.ThresholdBetween (i, i);
                        th.Update ();
                        geo.Update ();
                        vtkPolyData pol = vtkPolyData.New();
                      polys.Add (pol);

                return polys;