The vtkFollower and vtkVectorText approach does not offer many controls for text placement. It’s sort of a relic from a time before we had access to actual text rendering in VTK.
The better way to render 3D embedded text is to use vtkBillboardTextActor3D. It renders at a fixed size on screen and remains oriented toward the camera. It also provides a lot of customization options (including justification) via it’s vtkTextProperty.
It doesn’t look like vtkLabelPlacementMapper offers as much control over text rendering.
If just rendering the labels on top of the 3D geometry is an option, you may want to look at vtkTextActor, since it renders in the overlay plane (similar to vtkLabelPlacementMapper).
By default, it uses viewport (pixel) coordinates to specify location, but you can set it up to align with a 3D world location via textActor->GetPositionCoordinate()->SetCoordinateSystemToWorld(). This will anchor it to a 3D position in your scene, but it will always render on top of all 3D geometry in the current renderer layer.
Hi @allison.vacanti, Thanks again for the tip. Using world coordinates works great, but I have a new problem. Specifically, some of the text corresponds to points that are obscured by other voxels, but the text is always visible, which creates a lot of visual clutter. I’d like to only render text for points that are visible to the viewer.
Does anyone know if it is possible to get the accumulated opacity value of a point in a raycast volume so that I could know how visible that point is?
Most things work with volume rendering (point placing, picking, occlusion of glyph widget by the volume), however hiding of labels occluded by a rendered volume does not work.
vtkSelectVisiblePoints filter uses the Z buffer and as far as I know VTK does not write into Z buffer in translucent rendering step. Maybe the volume render mapper could be updated to write into the z buffer the distance where the ray reaches 1.0 opacity?