使用硬件生成的原语进行碰撞检测

发布于 2024-07-12 22:49:43 字数 684 浏览 2 评论 0原文

关于碰撞检测的文献有很多,我至少阅读了其中的大部分内容,对大多数技术都相当熟悉。 然而,有件事让我困惑了一段时间,我想,既然 StackOverflow 可以同时接触到一大群才华横溢的人,我会先在这里问一下,然后再在书架上翻来覆去。

在当今时代,越来越多的工作被委托给 GPU 而不是 CPU,在很多情况下这是一件好事。 例如,有几何着色器可以创建新的几何体,或者(稍微不那么新,但仍然非常有趣)顶点着色器,您可以通过一堆顶点,然后从中产生一些优雅的东西。 但我正在考虑的是,由于这些基元仅存在于图形硬件上,因此如何使用这些基元执行可靠的碰撞检测? 假设我有某种极其简化的网格,它在顶点着色器中被替换(我没有具体的问题,我更喜欢这个想法,而且我还没有深入了解几何着色器)。

到目前为止,我考虑的是从适当的角度进行单独的“渲染”过程,或多或少关闭阴影,也许使用较低分辨率的网格,渲染我的第二个基元的内部(面向内翻转)以及我想要的网格测试网格并执行遮挡查询。 如果网格完全被遮挡,则不会有相交。 这当然要求我的第二个基元是凸的。

不知何故,我感觉随着基元数量的增加,这种测试将非常昂贵(即使可以直接剔除很大一部分)。 还有其他人有其他想法或技术吗? 我对 opengl 和 cg 比 directx 更熟悉,但是如果你有 directx 中的一些例子,我想我将能够找出 opengl 的对应项。

所有的想法都会受到赞赏,所以请集思广益。 :)

There's a lot of literature on collision detection, and I've read at least a big enough portion of it to be fairly familiar with most techniques. However, there's something that has eluded me for a while, and I figured, since StackOverflow provides access to a large group of brilliant minds at once, I'd ask here first before digging around in the bookshelf.

In this day and age, more and more work is being delegated to GPU rather than CPU, and in a lot of cases this is a good thing. For example, there are geometry shaders to create new geometry, or (slightly less new, but still quite fascinating) vertex shaders to which you can through a bunch of vertexes at, and something elegant will come out of it. What I was considering though, as these primitives exists only on the graphics hardware, how would you perform reliable collision detection with these primitives? Let's assume I have some kind of extremely simplified mesh which is displaced in a vertex shader (I don't have a concrete problem, I'm more playing with the idea, and I haven't gotten very deep into geometry shaders yet).

What I've considered so far is separate 'rendering' passes from suitable angles with shading more or less turned off, and perhaps lower resolution mesh, rendering the inside (with faces flipped inward) of my second primitive along with the mesh I want to test against, and executing an occlusion query for the mesh. If the mesh is completely occluded there'd be no intersection. This would of course require that my second primitive is convex.

Somehow I get the feeling that this kind of test will be extremely expensive as the number of primitives increase (even if a large portion can be culled directly). Does anyone else have another idea or technique? I'm more familiar with opengl and cg than directx, but if you have some examples or so in directx, I guess I'll be able to figure out the opengl counterparts.

All ideas are appreciated, so please brainstorm. :)

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

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

发布评论

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

评论(1

忆伤 2024-07-19 22:49:43

听起来像是 Dan Horn 在 GPU Gems 2 中的文章“GPGPU 应用程序的流缩减操作”正是您想要的。 与所有章节一样,它可以在线免费提供

It sounds like Dan Horn's article “Stream Reduction Operations for GPGPU Applications” in GPU Gems 2 is exactly what you want. Like all chapters, it's freely available online.

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