c++ - 如何在 Qt3D 中优化点云渲染
问题描述
我正在尝试使用 Qt3D 显示大型点云(~20M pts)。
我首先发现了这个库https://github.com/MASKOR/Qt3DPointcloudRenderer这是一个很好的例子,但是我重写了一个极简的例子来加载一个特定的 LAS 或 PCD 点云并用Qt3DRender::QGeometry
.
它有效,点云很好,但滞后很多。我认为没有优化,一直显示所有20M点。
我能做些什么来优化这个?
(相同的点云在同一台笔记本电脑上与 QuickTerrainReader、Pix4D 甚至 VTK 等其他软件一起使用。)
目前,在加载时,点云被序列化为 2 Qt3DRender::QBuffer
,我从那里创建了 2 个属性:
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);
解决方案
推荐阅读
- r - 当我输入代码时,R 只是在等待,它甚至不会给出错误。我该如何解决?
- c# - 正则表达式:字符串的开头和结尾带有指定长度的字母
- android - 如何在android studio中构建url时编码特殊字符?
- html - 为什么我不能为我的可滚动组件分配“scrollLeft”属性
- pyodbc - 用于在 pyodbc 中转换 DECIMAL('100.000') 的输出转换器
- ios - 在 React Native 库中使用本地 .xcframework 的 Podspec 文件应该是什么?
- python - href beautifulsoul html选择不返回想要的结果
- windows - 将时间戳日期从文件夹中的文件复制到具有相同名称的不同文件夹中
- c - libjpeg 读取原始宽度 1/8 的扫描线
- html - 如何在 r 中为闪亮的应用程序获取 html 变量中的背景颜色?