WPF 3D 关闭项目似乎“不稳定”

发布于 2024-12-02 11:09:49 字数 898 浏览 1 评论 0原文

我正在 WPF 中编写 3D 地球控件。

大多数效果都很好,但是当我从太近的地方(例如 10 米或更远)观察一座山时,它会变得“不稳定”(意思是 - 相机的每一个微小移动都会改变山模型的顶点,所以它看起来像果冻一样。)

我尝试使用近平面和远平面,在近平面上指定范围从 0.001 到 5,在远平面上指定范围从 100 到 1000000,甚至是正无穷大,它没有帮助。

我还尝试将模型从 1/10 大小缩放到 10 倍大小,甚至将 Lat/Long/Alt 到 ECEF 的结果四舍五入到厘米、米和 10 米单位。

没有任何帮助,它看起来仍然摇晃(尽管四舍五入到 10 米单位确实有帮助,并且在这种情况下摇晃非常罕见,但它使模型变形太多以至于无法使用)。

我想这主要是一个精度问题。知道如何提高精度或有其他解决方法吗?

板井。

更新: 我添加了一个视频来演示该工件。

已解决 我发现在 World Wing 中构建模型也存在同样的问题,在此处询问并回答

一般来说,正如我怀疑的那样,问题是精度问题。解决这个问题的方法是将实际相机保持在原点(0,0,0),同时允许其旋转,并向相反方向移动所有图块。

生成每个图块时,我从每个图块的顶点中减去图块的 XYZ 中心,因此最终的图块围绕 (0,0,0) 构建。

在图块 GeometryModel3D 中,我设置了平移变换,以便将其放置在正确的位置。

I'm writing a 3D globe control in WPF.

Most of it works good, but when I look at a mountain from too close (say, 10 meters or less), it becomes "wobbly" (meaning - every tiny movement of the camera changes the vertices of the mountain model, so it looks like jello.)

I tried playing with the near and far planes specifying ranges from 0.001 to 5 on the near plane, and 100 to 1000000 and even positive infinity on the far plane and it didn't help.

I also tried scaling the model from 1/10 of its size and to 10 times its size, and even rounding result of the Lat/Long/Alt to ECEF to centimeters, meters and 10-meters units.

Nothing helps, it still looks wobbly (although rounding to 10 meters units does help, and wobbling is very rare at this case, but it deforms the models so much it is unusable).

I guess this is a precision issue, mostly. Any idea how I can increase the precision or any other idea of how to fix it?

Itai.

UPDATE:
I added a video demonstrating the artifact.

SOLVED
I found there was the same problem with building models in World Wing, asked and answered here.

Generally the problem was, as I suspected, a precision issue. The way to solve it was to keep the actual camera at the origin (0,0,0) while allowing it to rotate, and move all the tiles in the opposite direction.

When generating each tile I subtract the tile's XYZ center from each of the tile's vertices, so the final tile is built around (0,0,0).

In the tile GeometryModel3D I set a translation transform so it is placed in the correct position.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

捎一片雪花 2024-12-09 11:09:49

我发现在 World Wing 中构建模型也存在同样的问题,在此处询问并回答

一般来说,正如我怀疑的那样,问题是精度问题。解决这个问题的方法是将实际相机保持在原点(0,0,0),同时允许其旋转,并向相反方向移动所有图块。

生成每个图块时,我从每个图块的顶点中减去图块的 XYZ 中心,因此最终的图块围绕 (0,0,0) 构建。

在图块 GeometryModel3D 中,我设置了平移变换,以便将其放置在正确的位置。

I found there was the same problem with building models in World Wing, asked and answered here.

Generally the problem was, as I suspected, a precision issue. The way to solve it was to keep the actual camera at the origin (0,0,0) while allowing it to rotate, and move all the tiles in the opposite direction.

When generating each tile I subtract the tile's XYZ center from each of the tile's vertices, so the final tile is built around (0,0,0).

In the tile GeometryModel3D I set a translation transform so it is placed in the correct position.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文