vtkBillboardTextActor3D objects stacking when added to vtkAssembly - SetPosition has no effect

I’m encountering an issue when using vtkAssembly to group multiple vtkBillboardTextActor3D objects. Despite calling SetPosition() on individual text actors, all labels appear stacked at the same location (typically the assembly’s origin). This occurs even though I’m setting distinct positions programmatically.

#include <vtkSmartPointer.h>
#include <vtkAssembly.h>
#include <vtkBillboardTextActor3D.h>
#include <vtkRenderer.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkTextProperty.h>


int main() {
    vtkSmartPointer<vtkAssembly> assembly = vtkSmartPointer<vtkAssembly>::New();
    assembly->SetPosition(0, 0, 0); // 装配体位于原点,排除整体偏移干扰
	assembly->SetScale(1.0, 1.0, 1.0); // 确保装配体没有缩放
    assembly->SetOrigin(0.0, 0.0, 0.0); // 确保装配体没有缩放
    
    // 添加第一个文本(X+方向)
    vtkSmartPointer<vtkBillboardTextActor3D> text1 = vtkSmartPointer<vtkBillboardTextActor3D>::New();
    text1->SetInput("X+ Text + 100");
    text1->SetPosition(5.0, 0.0, 0.0); // 明显偏移
    text1->GetTextProperty()->SetColor(1, 0, 0);
    assembly->AddPart(text1);

    // 添加第二个文本(Y+方向)
    vtkSmartPointer<vtkBillboardTextActor3D> text2 = vtkSmartPointer<vtkBillboardTextActor3D>::New();
    text2->SetInput("Y+ Text + 200");
    text2->SetPosition(0.0, 5.0, 0.0); // 明显偏移
    text2->GetTextProperty()->SetColor(0, 1, 0);
    assembly->AddPart(text2);

    // 渲染设置
    vtkSmartPointer<vtkRenderer> ren = vtkSmartPointer<vtkRenderer>::New();
    ren->AddActor(assembly);
    ren->SetBackground(0.1, 0.1, 0.1);

    vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
    renWin->AddRenderer(ren);
    renWin->SetSize(800, 600);

    vtkSmartPointer<vtkRenderWindowInteractor> iren = vtkSmartPointer<vtkRenderWindowInteractor>::New();
    iren->SetRenderWindow(renWin);

    ren->ResetCamera();
    ren->GetActiveCamera()->Azimuth(45);
    ren->GetActiveCamera()->Elevation(30);
    renWin->Render();
    iren->Start();

    return 0;
}

I don’t think you need vtkAssembly Have a look at this example, where I have added a cone for orientation. Here you will see that the vtkBillboardTextActors are positioned correctly. I’ll probably add this to the vtk-examples website.
Here is the code: BillboardTextActor.tar.gz (1.4 KB) and a screenshot:

Thank you so much for your response!

However, my specific need is to design a 3D label similar to vtkBillboardTextActor3D, but one that supports multi-line text with varying styles. As shown in the image below, I want the first line of text to be red and the second line to be green.

My initial approach was to wrap multiple vtkBillboardTextActor3D instances within a vtkAssembly, hoping it would behave like a single multi-style label.

Unfortunately, after testing, I found that the resulting vtkAssembly doesn’t handle depth properly in the 3D scene like a single vtkBillboardTextActor3D does, so it doesn’t achieve the desired effect.

If you have any suggestions on how to approach this, I’d greatly appreciate your input!

Have a look at TestBillboardTextActor3D.cxx, you can use something like:setupBillboardTextActor3D() to position and colour the actors.