2

I'm trying to display large point clouds (~20M pts) with Qt3D.

I first found this library https://github.com/MASKOR/Qt3DPointcloudRenderer which is a good example, but I rewrote a minimalist example to load a specific LAS or PCD point cloud and display it with a subclass of Qt3DRender::QGeometry.

It works and the point cloud is nice, but it lags a lot. I think there is no optimization and all 20M points are displayed all the time.

What can I do to optimize this?

(The same point clouds is fluid on the same laptop with other softwares such as QuickTerrainReader, Pix4D or even VTK.)

Currently, at loading, the point cloud is serialized into 2 Qt3DRender::QBuffer, and I create 2 attributes from there:

Qt3DRender::QAttribute* vertexAttrib = new Qt3DRender::QAttribute(nullptr);
vertexAttrib->setName(Qt3DRender::QAttribute::defaultPositionAttributeName());
vertexAttrib->setVertexBaseType(Qt3DRender::QAttribute::Float);
vertexAttrib->setVertexSize(3);
vertexAttrib->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
vertexAttrib->setBuffer(m_vertexBuffer);
vertexAttrib->setByteStride(12);
vertexAttrib->setByteOffset(0);
vertexAttrib->setCount(m_pointcloud->size());
addAttribute(vertexAttrib);
setBoundingVolumePositionAttribute(vertexAttrib);

t3DRender::QAttribute* colorAttrib = new Qt3DRender::QAttribute(nullptr);
colorAttrib->setName(Qt3DRender::QAttribute::defaultColorAttributeName());
colorAttrib->setVertexBaseType(Qt3DRender::QAttribute::UnsignedByte);
colorAttrib->setVertexSize(3);
colorAttrib->setAttributeType(Qt3DRender::QAttribute::VertexAttribute);
colorAttrib->setBuffer(m_colorBuffer);
colorAttrib->setByteStride(3);
colorAttrib->setByteOffset(0);
colorAttrib->setCount(m_pointcloud->size());
addAttribute(colorAttrib);
Alexandre
  • 498
  • 2
  • 8
  • 2
    Have you tried adding a [`QFrustumCulling`](https://doc.qt.io/qt-5/qt3drender-qfrustumculling.html) node to you framegraph? I don't think Qt3D is at the top performance-wise but maybe that helps. – Florian Blume Jul 08 '20 at 15:29
  • Yes I have tried with FrustumCulling but I did not see a big improvement. In theory, I guess it should help when only a subpart of the point cloud is displayed. But what how to also improve performance when the whole cloud is shown? I didn't manage to find in VTK source code whether they apply an algorithm to discard points before filling the buffers, or if they use some shaders. Thanks ! – Alexandre Jul 08 '20 at 15:54

0 Answers0