how to speed up vtkRenderWindow->Render()

I have an Qt(5.15.2) application which display pointcloud using vtk9.1 and pcl1.12, and I need to update pointCloud at about 30fps, each PointCloud has about 100K points ,But I found that calling vtkRenderWindow->Render() will cause Ui slow down,
and I test the cost, every call of Render() will cost about 10~15ms, that means about 0.3~0.45s per second, I dont know why.
my code snap is just as below

//
void ShowPCLWgt::SetPointCloudData(pcl::PointCloudpcl::PointXYZRGB::Ptr pcl)
{
//LOG_INFO() << “SetPointCloudData start.”;
m_pViewer->setPointCloudData(pcl);
//m_bufferedPclCount++;
m_pQVTKWgt->renderWindow()->Render();// this will cost about 10~15ms
//LOG_INFO() << “SetPointCloudData end.”;
}

void ViCloudView::setBackground(vtkRenderer* render)
{

vtkNew colors;
render->GradientBackgroundOn();
render->SetBackground(colors->GetColor3d(“Gray”).GetData());
render->SetBackground2(colors->GetColor3d(“LightSlateGray”).GetData());
}

void ShowPCLWgt::InitWgt()
{

QHBoxLayout* pLayout = new QHBoxLayout(this);
pLayout->setMargin(0);
pLayout->addWidget(m_toolbar);
m_pQVTKWgt = new QVTKOpenGLNativeWidget(this);
pLayout->addWidget(m_pQVTKWgt, 1);

//m_pViewer = new ViCloudView("viewer", false);

vtkNew<vtkRenderer> renderer;
//renderer->SetBackground(colors->GetColor3d("SteelBlue").GetData());
vtkNew<vtkGenericOpenGLRenderWindow> renderWindow;
renderWindow->AddRenderer(renderer);
renderWindow->SetWindowName("RenderWindowNoUIFile");
renderWindow->GlobalWarningDisplayOff();
//renderWindow->GlobalWarningDisplayOn();
m_pViewer = new ViCloudView(renderer, renderWindow, "viewer", false);//PCLVisualizer wrapper
//m_pViewer->getRenderWindow()->GlobalWarningDisplayOff();
m_pQVTKWgt->setRenderWindow(renderWindow);
m_pViewer->setupInteractor(m_pQVTKWgt->interactor(), m_pQVTKWgt->renderWindow());
vtkRenderer* render = m_pViewer->getRenderWindow()->GetRenderers()->GetFirstRenderer();
vtkRenderWindowInteractor* interactor = m_pViewer->getRenderWindow()->GetInteractor();
m_pViewer->setBackground(render);
m_pViewer->addOrientationMarkerWidgetAxes(interactor, 0.0, 0.0, 0.2, 0.2);
m_pViewer->addOrientationPlanes(render, 1.5);

render->GetActiveCamera()->SetFocalPoint(0, 0, 0);
m_pViewer->initCameraParameters();
//m_pViewer->setCameraPosition(0, 0, -1, 0, 0, 1, 0, 1, 0);
m_pViewer->setCameraPosition(0, 0, -1, 0, 0, 0, 0, -1, 0);
//render->GetActiveCamera()->SetFocalPoint(0, 0, 0);
//m_pViewer->setCameraPosition(0, 0, -0.2, 0, 0, 1, 0, 1, 0);
m_pViewer->resetCamera();

/*connect(&m_renderTimer, &QTimer::timeout, this, [this]()
    {
        if(m_bufferedPclCount > 0)
		{
			m_bufferedPclCount = 0;
			m_pQVTKWgt->renderWindow()->Render();
		}
    });
m_renderTimer.start(100);*/

}

Can any one help?

Hello @Vicore.Nv,

It’s indeed strange AFAIK you should be able to have a better performance with 100k points.

Could you please share how you configure your mapper?

Also note that if you don’t use a dynamic pipeline logic, you can set the Static member of your mapper to true which will have a great impact for your performance issue.

Best

I use pcl::visualization::PCLVisualizer , not directly use vtkxxxmap as rendering pipeline

m_pViewer is just a wrapper of pclVisualizer