vtkBillboardTextActor3D text always renders behind raycast volume

Hi all,
I’m trying to use vtkBillboardTextActor3D to create some text labels for objects in a raycast volume. The text renders at the correct location. However, when I rotate the volume such that the text should be in front of the raycast volume. The text is occluded by the volume. When I rotate the volume such that the text is to the side or behind the volume, everything works fine.
I do NOT get this problem when using vtkFollower to render the text, but I’d prefer to use vtkBillboardTextActor3D.
Any ideas as to what’s going wrong?

Displaying labels correctly is extremely difficult. I’ve spent a lot of time experimenting with different options for markup display in 3D Slicer, but each option has different limitations.

To tackle occlusion: To make sure the labels are not occluded, you can display 3D label actors on a separate layer or use 2D actors. However, then you need to manually hide the actors when the corresponding point of interest is occluded. In general, determining if a certain point is occluded is a very costly operation, so you either have to be smart when you do it (e.g., only when camera interaction is finished) or how you do it (e.g., using hardware acceleration). Label placement mapper can do some Z-buffer based visibility checks, but I could not make it work very accurately (label for occluded points are often still visible).

Overall, for me it seems that the label placement mapper is the closest to an acceptable solution, but some more fixes and improvements would be needed (make hiding label occlusion computation more robust, implement concident label repositioning, etc.).

It would be great to hear experience from others, too.

1 Like

I’ve investigated why Z-buffer based visibility check is not working reliably and I’ve figured out what was the problem. We display a glyph at each labeled point and so the exact point position was always occluded by the glyph. We added some tolerance to vtkSelectVisiblePoints to account for this, but it was either hid too many points or not enough, since its depth tolerance was specific in normalized display coordinates instead of world coordinates. I’ve added an option to the vtkSelectVisiblePoints filter to be able to specify distance tolerance in world coordinates and voila! - occlusion checks started to work perfectly. I’ve submitted a pull request with the change, hopefully it’ll get merged soon.

With this latest development, it seems that by using label placement mapper and vtkSelectVisiblePoints, all important requirements can be fulfilled (non-clipped display of labels, high-quality anti-aliased text rendering, occluded labels are hidden, occluded glyphs cannot be picked). There are just a few nice-to-have features that are still not implemented, such as label occlusion by volume rendering, or automatic displacement of labels that are too close to each other.

Great! Thanks very much, Andras.