寻找教程/示例每个聚3D碰撞教育自己的自己的、示例、教程

2023-09-08 01:06:22 作者:誮落丷人斷膓

我一直在寻找的3D每个顶点的碰撞系统(教程使用C#和 XNA ,因为我有一个现成的),但只能够放在一起的点点滴滴。我有一个pretty的很好的理解,在这一点上,但是有一个相当大的,明显的洞我的理解。

I've been looking for a tutorial on 3D per-vertex collision systems (using C# and XNA, since I have that readily available), but have only been able to put together bits and pieces. I have a pretty good understanding at this point, but there's one rather large, glaring hole in my understanding.

基本上,我的问题归结为:我怎么了多边形和他们的信息

Basically, my problem comes down to: how do I get the polys and their info?

没有人有什么好的推荐?

Does anyone have any good references?

注意:当我使用XNA和上午与该系统最感兴趣,这更多的是自我的教育运动,而我感兴趣的是如何做到这一点在其他系统中,如果是做不同(如OpenGL的,等。)

Note: while I'm using XNA and am most interested with that system, this is more of a self-educational exercise, and I am interested in how to do it in other systems if it's done differently (i.e OpenGL, etc.)

澄清: 我的意思是我怎么了多边形,就是​​如果我有一个三维物体,甚至应用到该对象的动画,有用于检索测试所呈现的多边形的信息(位置等)的系统?最合乎逻辑的事情将被检索多信息,它已经呈现之后,但听起来也非常昂贵的,我不知道如何去这样做呢。我不知道是否有更好的方法,或者在该级别中检索呈现的信息是有可能的。

Clarification: What I mean by "how do I get the polys", is if I have a 3D object, and perhaps even an animation applied to that object, is there a system for retrieving the rendered polys' information (positions, etc.) for testing? The most logical thing to do would be retrieve the poly information after it's been rendered, but that also sounds exceedingly expensive, and I'm not sure how to go about doing that anyway. I wasn't sure if there was a better way, or if retrieving rendered information at that level was even possible.

推荐答案

您弄个从模型的多边形信息。会有一组呼叫和/或方法,它们将返回你像点的名单,法线,纹理坐标等,和引用这些其他阵列面的清单。

You get hold of the polygon information from the model. There will be a set of calls and/or methods which will return you things like lists of points, normals, texture coordinates etc, and a list of faces that reference these other arrays.

可以(以及它曾经是)非常难掌握的数据,一旦被送到显卡渲染。此外,一旦它被呈现的信息是在二维不是3D。

It can be (well it used to be) fairly difficult to get hold of the data once it has been sent to the graphics card for rendering. Also once it's been rendered, the information is in 2d not 3d.

每个多边形的碰撞是昂贵的,如果仅仅是因为即使是中等复杂程度的模型可如果不是数以千计的多边形包含数百个。第一步是,试图通过执行边界框的碰撞消除大部分信息。这会告诉你,在场景中的大多数对象不相互碰撞。然后,可以专注于其中包围盒相交以某​​种方式例。使用包围球是另一种方式,并可能给你更少的误报球会比一个盒子更紧密结合的对象。虽然计算可能会更贵一点。

Per polygon collision is expensive, if only because even moderately complex models can contain hundreds if not thousands of polygons. The first step is to try and eliminate most of the information by performing bounding box collisions. These will tell you that most objects in the scene don't collide with each other. You can then concentrate on the cases where the bounding boxes intersect in some way. Using a bounding sphere is another way and may give you fewer false positives as the sphere will bound the object more tightly than a box. Though the calculations might be a bit more expensive.

下一步是把各多边形中的测试对象,并检查其对其他对象。针对检查中的其他对象(S)所有的多边形前,用边界框/球测试重新开始。

The next step is to take each polygon in your test object and check it against the other objects. Again start with a bounding box/sphere test before checking against all the polygons in the other object(s).

您需要应包括在任何像样的书在3D图形的数学。

The maths you need should be covered in any decent book on 3d graphics.