如何在 Unity 中从深度图生成点云
所以我对 Unity 还很陌生。我有一个用 python 生成的深度图。它由两个数组组成,一个数组包含所有 3D 点,另一个数组包含相应的颜色。我可以通过索引将点与颜色进行匹配。
现在我想将此深度图统一显示为简单的非动画点云。有趣的是,3D 点来自 360° 相机,因此点云应该位于 Unity 视点周围。
到目前为止,我尝试使用网格。我可以将 3D 点设置为顶点,将颜色设置为网格的颜色。现在我在定义网格的三角形时遇到了麻烦。当我迭代这些点时,我不知道数组中的哪些点与我当前正在查看的点最接近,因为我的点没有排序。例如,我的数组看起来像这样:
[187 167 177]
[185 135 232]
[ 15 111 236]
[ 1 111 236]
[201 167 177]
即使我会排序我的点,我的问题是,我必须相应地更改颜色数组。即便如此,由于我的点围绕视口,我必须以某种方式决定我的点位于相机的哪一侧,而不是通过开放空间绘制三角形。
现在我的问题是:我必须使用三角形作为网格吗?还有其他方法来显示简单的点云吗?
提前致谢!
So I am quite new to Unity. I have a depthmap I generated with python. It consists of two arrays, one array with all the 3D points and one with the corresponding colors. I can match the points to the colors by index.
Now I want to show this depth map as a simple non-animated point cloud in unity. It is interesting to note, that the 3D-Points come from a 360° camera, so the Point cloud is supposed to be around the Unity Viewpoint.
Till now I attempted to use a mesh. I could just set the 3D points as the vertices and the colors as the colors of the mesh. Now I am having troubles defining the triangles for the mesh. When I am iterating over the points, I do not know what points in my array are the closest ones to the one I am currently looking at, because my points are not ordered. My Array for example would look like this:
[187 167 177]
[185 135 232]
[ 15 111 236]
[ 1 111 236]
[201 167 177]
Even if I would order my points, my problem is, that I would have to change the color array accordingly. And even then, since my points go around the viewport, I would somehow have to decide on which side of the camera my points are, to not draw triangles through the open space.
Now my questions are: Do I have to use triangles for meshes? Is there another way to display simple Point Clouds?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论