八叉树遮挡

发布于 2024-09-24 13:06:30 字数 138 浏览 6 评论 0原文

我刚刚开始学习 opengl 并编写一个第一人称射击游戏,但是当我绘制 5000 个立方体时,我的帧速率很糟糕。所以现在我尝试使用八叉树执行遮挡和剔除。我困惑的是从哪里投射光线。我只能从近平面的锥台上投射它们吗?看来我会错过扩大的锥体的一部分。任何帮助表示赞赏。

I just started learning opengl and writing a first person shooter but I'm getting horrible framerates when I draw 5000 cubes. So now I'm attempting to perform occlusion and culling using an octree. What I'm confused about is where to cast the rays from. Do I only cast them from the fustrum near plane? It seems like I would miss part of the fustrum that expands. Any help is appreciated.

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

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

发布评论

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

评论(1

℡Ms空城旧梦 2024-10-01 13:06:30

如果 5000 个立方体已经提供了糟糕的帧速率,您应该考虑更改渲染立方体的方式。

我们非常不清楚你画这些立方体的目的是什么。如果它们是静态的(即不移动),那么最好将它们全部打包到单个顶点缓冲区中。如果立方体应该移动,那么你应该去实例化。如果您想要像《我的世界》这样由立方体组成的景观,那么您应该创建顶点缓冲区,但只放入实际可见的立方体的面。

我想提供更多帮助,但我不确定你在做什么。

If 5000 cubes already gives bad framerates, you should consider changing the way you render your cubes.

It's very unclear to us what you are drawing the cubes for. If they are static (ie. don't move), then its best to pack them all into a single vertex buffer. If the cubes are supposed to move, then you should go for instancing. If you're going for a landscape made of cubes like minecraft, then you should create vertex buffers but only put in the faces of cubes that are actually visible.

I'd like to help more, but I'm unsure what you're doing.

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