centering (justification/alignment) of vtkFollower text

Hi all, I’m trying to use vtkFollower ( to render text that labels a point in 3D space. The text appears slightly above and to the right of the point (i.e., the origin of text appears to be the lower, left corner of the text).

Is there a way to center the vtkFollower text on the point? There don’t appear to be any obvious methods for this.

  much thanks,

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.

Thanks very much, Alison! However, it appears that vtkBillboardTextActor3D has some issues with occlusion when using it with raycasting:

@lassoan, I like your suggestion of using vtkLabelPlacementMapper, but I can’t figure out how to control the size of the text or its alignment/justification.

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.

Thanks very much, Allison. I’ll give that a shot.

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?

The typical way to do this would be vtkSelectVisiblePoints to filter out points that would be obscured. I’m not sure it’d work with a volume or if it only works with polygonal geometry…

From the thread you linked earlier, it sounds like @lassoan might have gotten it to work with a volume, so it should be worth a try.

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?

Thanks very much @allison.vacanti and @lassoan. I’ll look into it.