BSP树遍历与位置有关?

发布于 2025-01-03 10:28:28 字数 239 浏览 1 评论 0原文

这更多的是一个概念问题,而不是一个编码问题。我已经弄清楚了 BSP 树的基本概念,但我在定位方面遇到了困难。我发现,为了找到我在 BSP 树中的当前位置,我不断递归地迭代树,如果我在分割平面前面,则向右移动;如果我在分割平面后面,则向左移动。当我最终到达一个叶节点时,那就是我所在的世界。

现在,在渲染方面,如果我必须从前到后渲染,我会从树的右侧开始并一直递归渲染,直到到达左侧的最后一个节点。那么从后到前呢?会适得其反吗?

谢谢!

This is more of a conceptual question than a coding question. I have figured out the basic concepts of a BSP tree but am having trouble wrapping my head around the positioning. I have figured out that to find my current location in the BSP tree, I keep recursively iterating through the tree moving to the right if I am in front of the split plane, and left if I am behind it. When I eventually hit a leaf node, that is where I am in the world.

Now, in terms of rendering, if I had to render from front to back, would I start at the right side of the tree and render all the way recursively until I hit the last node on the left side. What about back to front? Would it be the opposite?

Thanks!

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

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

发布评论

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

评论(1

黑白记忆 2025-01-10 10:28:28

如果您想向后绘制(这是Painters 算法),您将在前面时先遍历左侧节点,然后渲染,然后遍历右侧节点。

从前到后则相反。

If you wanted to draw back to front which is the Painters algorithm you'd traverse left nodes first when you are in front, then render and then traverse right nodes.

For front to back it would be the opposite.

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