How do put different labels/annotations on faces of VTKHexahedron

Hi VTK experts,

I’m new to VTK and I cannot seem to figure out how to put different text annotations/labels on the faces of a VTKHexahedron.

I’m displaying a thousands of cubes ( implemented using vtkhexahedrons) stacked on on each other using a singular unstructured grid and I need to label the different faces of the hexahedron with custom labels.
For example X+ face will have text “Label1”, Y+ face will have a label “Label2”, Z+ face will have “Label3”. My question is whether this is possible ? If it is, how do I do this ? If it is not possible, what suggestions do you have on changing my implementation ( using unstructured grid and cells defining hexahedrons) ? I’m completely lost and would appreciate any pointers/suggestions.


I would try vtkLabeledDataMapper, however I expect the display to be very busy.

Thanks @danlipsa for your prompt response ! Do you think I need to reimplement my approach of displaying the cubes for a quicker rendering ?

My concern was not necessarily the rendering time but rather filling up the screen with lots of labels.

@danlipsa Can you please look at my code snippet and let me know what am I missing here ? I’m not getting any labels to show up at all ???

vtkNew labelPoints;
vtkNew labels;
labels → SetNumberOfValues(polygonList.size());
labels → SetName(“Labels”);

for( polygon3DInfo & polyInfo : polygonList)
labelPoints->InsertNextPoint( polyInfo.xmin, polyInfo.ymin, polyInfo.zmin);
labels → InsertNextValue(;

vtkPolyData *polydata = vtkPolyData::New();
polydata->SetPoints( labelPoints);
polydata->GetPointData()->AddArray( labels);

vtkNew<vtkLabeledDataMapper> labeledDataMapper;

vtkNew<vtkActor2D> labelActor;

this → renderer → AddActor2D(labelActor);

Any help/suggestion is greatly appreciated !