Drawing Multiple 2D text at 3D position

I need to draw Multiple 2D text with a 3D position. It can go up to a couple of thousand of text label. I tried using vtkCaptionActor2D, it is doing what i am looking for, but it is very slow.
I also made some test, using vtkTextActor, but then again its very slow.
Is there a way to put all the text in a single actor ? I understand the overhead of having so many actor is big. I tried using vtkPropAssembly but no difference.
Or is there a way to create some kind of custom actor and put my own openGL code so i can draw the text much faster ?

Note that each each text label has a different position and a different text.

Hello @Alucard, have you tried vtkTextMapper?

Thanks for the answer. I tried to use vtkTextMapper, but it still require to create one actor and one mapper per text, so in the end i still have a lot of actors and I do not see any performance improvement.

Can you share some profiler screenshots so we know where the bottleneck is?

For the vtkCaptionActor2D im not sure where the bottleneck is since it all happen inside the widget, but when I use vtkTextActor, When something move I change the 2D position of the actor so it stays at the 3D position, and it is the vtkTextActor.SetPosition that create the bottleneck.

vtkLabelPlacementMapper is intended for displaying many (hundreds or thousands) of labels in 3D. It seems to me that the class is incomplete (probably funding ran out before the work was done), for example the automatic perturbation of overlapping label positions and drawing of spokes is not fully implemented.

1 Like

Hi Alucard, I have the same problem when drawing a large number of tags (possibly thousands), the interactor becomes very slow, have you found a solution?

For now what I did is I made a function to decide to hide label that overlaps another label at each frame. this way there is much less visible label and rendering is much faster.

The drawback is that its long to add many label, renderer->AddActor2D is getting a bit slow if you need to add lots of text actor. Its only needed to do one time but still, in my worst case it takes 2 minutes where in another engine (Irrlicht) I was able to do the same task in 20 second without any rendering problem.
I have found no way of having multiple text in a single actor, I think that would be my ideal solution.