Culling of Point Labels

Is there a way to cull or hide point labels when they are behind a mesh? There’s a good example of this phenomenon here at pyvista Issue 282.

I’ve tried to use vtkLabelPlacementMapper instead of vtkLabeledDataMapper, but the issue persists despite using UseDepthBufferOn.

Do you have any suggestions?

1 Like

Maybe vtk.vtkLabelPlacementMapper.RenderOpaqueGeometry could help? Seems relevant but I don’t know how to implement this

I’ve spent a couple of weeks with this recently and after fixing a fix small issues (1, 2, 3), visibility of point labels works quite well now. The only limitation is that it only works with opaque surfaces (not with semitransparent surface or volume rendering). See for example the curve widget, with points marked, pickable, with correctly shown/hidden point labels:

LabelVisibility2

Since we need to pick visible points, we determine markup point visibility using vtkSelectVisiblePoints and use it for both rendering and picking (otherwise display of 2D graphics such as labels would interfere with hardware picking of the point). See the implementation here.

2 Likes

This is exactly what we’re looking for. Thanks!