网络上有没有关于如何使用着色器实现碰撞检测的示例?

发布于 2024-10-09 14:32:57 字数 88 浏览 0 评论 0原文

网络上是否有任何 OpenGL、OpenGL ES 或 WebGL 代码示例,说明如何使用着色器(最好是 GLSL)实现 3D 碰撞检测?

谢谢。

Is there any OpenGL, OpenGL ES or WebGL code example on the web how 3D Collision Detection can be implemented with Shaders (preferably GLSL)?

Thank you.

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

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

发布评论

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

评论(1

风轻花落早 2024-10-16 14:32:57

GLGE 具有基于着色器的碰撞检测。请参阅此演示。 (WASD、空格键和鼠标四处移动。注意如何与墙壁碰撞等)

如果您查看源代码,则碰撞检测是通过代码处理的

var ray=gameScene.ray(origin,[0,0,1]);

如果您按照此进入 glge.js您将看到这是如何通过特殊渲染模式 GLGE.RENDER_PICK 实现的(该模式又使用 pkfragStr 中的拾取片段着色器)。

GLGE has shader based collision detection. See this demo. (WASD,spacebar and mouse to move around. Notice how you collide with walls, etc.)

If you look at the source code, collision detection is handled with the code

var ray=gameScene.ray(origin,[0,0,1]);

If you follow this into glge.js you'll see how this is implemented with a special render mode GLGE.RENDER_PICK (which in turn uses a picking fragment shader in pkfragStr).

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