how to color unstructured grid (.vtu) ?

Hello,

I am not sure if this is a proper solution, but it might work if you create a new mapper at the end of the setColors function.

            output.GetPointData().SetScalars(colors);

+           vtkDataSetMapper mapper = vtkDataSetMapper.New();
+           mapper.SetInput(output);
+           actor.SetMapper(mapper);
        }

It may also be possible to draw the array directly instead of creating an RGB array. (The following was also added at the end of the setColors function.)

            #output.GetPointData().SetScalars(colors);

+           var mapper = actor.GetMapper();
+           mapper.SelectColorArray(column);
+           mapper.SetScalarModeToUsePointFieldData();
+           var range1 = getRange(actorIndex, column);
+           mapper.SetScalarRange(range1[0], range1[1]);
        }

I think your question will be better answered in the vtk forum (https://discourse.vtk.org/) than in the ParaView forum.

1 Like