渲染海量数据
我有一个 3D 浮点矩阵,在最坏的情况下,大小可能是(200000x1000000x100),我想使用 Qt/OpenGL 可视化该矩阵。
由于元素的数量非常多,我想以一种方式渲染它们,当相机远离矩阵时,我只显示一些有趣的点,这些点给出了矩阵的近似外观。当相机靠近时,我想要获得更多细节,因此会计算更多元素。
我想知道是否有处理这种可视化的技术。
I have a 3D floating-point matrix, in worst-case scenario the size could be (200000x1000000x100), I want to visualize this matrix using Qt/OpenGL.
Since the number of elements is extremely high, I want to render them in a way that when the camera is far away from the matrix, I just show a number of interesting points that gives an approximation of how the matrix look like. When the camera gets closer, I want to get more details and hence more elements are calculated.
I would like to know if there are techniques that deals with this kind of visualization.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
总体思路称为细节层次渲染,其本身就是一门完整的科学。
对于您的域,我建议采取两个步骤:
1)通过对不同大小的立方体进行平均(算术平均函数)单元格数量并缓存这些立方体(在磁盘和 RAM 上)来减少单元格数量。 “不同”在这里意味着您在多种尺寸的立方体中拥有相同的数据,例如 10000x10000x10000 的粗粒度立方体和 100x100x100 单元的更细粒度立方体,从而产生多个细节级别。您必须以分层结构组织它们(较大的结构包含多个较小的结构),为此我建议使用八叉树:
http://en.wikipedia.org/wiki/Octree
2)第二步是实际上渲染此八叉树的部分:
为此,请使用相机指向子立方体的距离。遍历立方体并决定是进入子立方体还是使用此距离函数和启发式选择或猜测的阈值来渲染较大的立方体。
(2) 可以进一步优化,但这是可选的:要优化此渲染,请将要渲染的立方体组织为图层:图层的方向(无论是 x、y 还是 z 切片)取决于您的相机-它应该接近垂直的视点。然后将每个切片渲染为纹理,瞧,您只需为每个切片渲染一个具有该纹理的四边形,渲染 1000 个四边形是没有问题的。
The general idea is called level-of-detail rendering and is a whole science in itself.
For your domain i would recommend two steps:
1) Reduce the number of cells by averaging (arithmetic-mean function) them in cubes of different sizes and caching those cubes (on disk as well as RAM). "Different" means here, that you have the same data in multiple sizes of cubes, e.g. coarse-grained cubes of 10000x10000x10000 and finer cubes of 100x100x100 cells resulting in multiple levels-of-detail. You have to organize these in a hierarchical structure (the larger ones containing multiple smaller ones) and for this i would recommend an Octree:
http://en.wikipedia.org/wiki/Octree
2) The second step is to actually render parts of this Octree:
To do this use the distance of your camera-point to the sub-cubes. Go through the cubes and decide to either enter the sub-cube or render the larger cube by using this distance-function and heuristically chosen or guessed threshold-values.
(2) can be further optimized but this is optional: To optimize this rendering organize the to-be-rendered cube's into layers: The direction of the layers (whether it is in x, y, or z-slices) depends on your camera-viewpoint to which it should be near-perpendicular. Then render each slice into a texture and voila you only have to render a single quad with that texture for each slice, 1000 quads are no problem to render.
Qt 有某种方法可以有效地渲染大量元素。检查作为 QT 一部分的 examples/demo。
Qt has some way of rendering huge number of elements efficiently. Check the examples/demo that is part of QT.