八叉树遮挡
我刚刚开始学习 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果 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.