如何实现正确的立方体视锥体剔除
我正在尝试为我的 directx 应用程序实现视锥体剔除。我的应用程序中的每个几何体都被一个包围体包围,我试图用它来确定它是否在视锥体内。包围体是保证完全覆盖几何体的立方体。为了实现立方体剔除,我使用了rastertek视锥体剔除教程,但我认为存在一个错误。
它的实现如下:
CheckCube 检查立方体的八个角点中是否有任何一个是 在视锥体内。它检查是否有任何一个角点 在视锥体的所有 6 个平面内。如果它确实找到了一个点 在视锥体的所有六个平面内,它返回 true, 否则返回 false。
但是,当两个角点都不在截锥体内时,立方体也可能位于截锥体内部。我画了一个草图 - 为简单起见,假设自上而下的视图和正交投影。 红色是视锥体,蓝色是包围体:
如您所见,边界体积位于平截头体内部,但两个角点都不是。这会导致对象出现和消失的错误,但我还无法解决这个问题。我想知道是否有人可以在这方面为我指明正确的方向。
I'm trying to implement frustum culling for my directx application. Each geometry in my application is surrounded by a bounding volume, which I'm trying to use to determine whether it's inside the view frustum or not. The bounding volume is a cube that guarantees to completely cover the geometry. To implement cube culling I used the rastertek frustum culling tutorial, but I think there is a bug.
It's implemented as:
CheckCube checks if any of the eight corner points of the cube are
inside the viewing frustum. It checks if any one of the corner points are
inside all 6 planes of the viewing frustum. If it does find a point
inside all six planes of the viewing frustum it returns true,
otherwise it returns false.
But it's also possible for the cube to be inside the frustum when neither of the corner points is. I've made a sketch - for simplicity assuming top-down view and orthographic projection. In red is the view frustum, in blue the bounding volume:
As you can see the bounding volume is inside the frustum, but neither of the corner points are. This causes bugs where objects appear and disappear and I haven't been able to solve this yet. I was wondering if someone can point me in the right direction on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论