重复场景树 (Java3d / OpenGL)

发布于 2024-08-28 05:01:51 字数 255 浏览 3 评论 0原文

我想制作一个自行循环的 3D 场景。也就是说,如果你一直往某个方向走,就会循环回到另一边。

我现在的实现太糟糕了,承认这一点很尴尬。我将每个变化重绘二十七次,以制作一个 3x3x3 的场景立方体。当用户到达中间立方体的末端时,我将他们跳到另一边。保持一致性(更不用说性能)是一场噩梦。彻底的灾难。

这似乎不是一个不寻常的请求,所以我想知道是否有人知道更合法的解决方案。

谢谢!

编辑/注意:Java3d 中没有可用的渲染到纹理功能。

I want to make a 3d scene that loops around on its self. That is to say, if you keep going in any direction, you will loop back to the other side.

My current implementation is so bad, it's embarrassing to admit to it. I redraw the each change twenty-seven times, to make a 3x3x3 scene cube. When the user reaches the end of the middle cube, I jump them over to the other side. Maintaining consistency (let alone performance) is a nightmare. Total Disaster.

This doesn't seem like it would be an unusual request, so I'm wondering if anyone knows of a more legit solution.

Thanks!

EDIT/NOTE: There is no render-to-texture functionality available in Java3d.

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

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

发布评论

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

评论(2

橘和柠 2024-09-04 05:01:51

在不了解您的特定场景以及您正在渲染什么类型的对象的情况下,27 个立方体听起来像是“正确但不是最佳”的做法。

然而,如果你想不出别的办法,你至少可以先在相机上进行视锥体剔除,这意味着找出 27 个立方体中的哪些当前位于相机视野内。

然后,您无需绘制超过 6 个立方体,加上您当前所在的立方体。如果您的视野很窄,则绘制的次数甚至更少。

假设您最多只能看到远处 1 个立方体...否则您将必须渲染纹理。

Without any knowledge of your specific scene and what sort of objects you are rendering, the 27 cubes sounds like the "correct but not optimal" way of doing it.

However, if you cant think of anything else, you can at least perform frustum culling on your camera first, which means finding out which of the 27 cubes are currently inside the cameras field of view.

Then you never have to draw more than 6 of these cubes, plus the current cube you are in. Even less if you have a narrow field of view.

That is assuming that you can only see a maximum of 1 cube into the distance... Otherwise you will have to do rendering to texture.

等风来 2024-09-04 05:01:51

我可以想到另一种选择,但它不是很漂亮。

你可以让用户锚定在你的宇宙的起源上。因此,不要移动它们,而是朝相反的方向移动宇宙中的其他一切。任何跨越宇宙边界的东西都会被带回相反的一侧。

I can think of another option, but it's not very pretty.

You could keep the user anchored at the origin of your universe. Therefore, instead of moving them, move everything else in the universe in the opposite direction. Anything that crosses the boundary of the universe would be brought back in on the opposite side.

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