在渲染中使用triangle-strip和triangle-fan有什么好处?

发布于 2024-09-18 14:07:35 字数 400 浏览 3 评论 0原文

我目前正在开发自己的 3d 引擎,它在几何渲染方面的能力非常有限,我想扩展它。我感兴趣的是应该如何存储和绘制几何对象。

目前,我的抽象仅支持将几何图形渲染为通用三角形列表(Direct3D 术语中的D3DPT_TRIANGLELIST)。还有其他几种表示对象的方法 - 例如三角形条带 (D3DPT_TRIANGLESTRIP) 或三角形扇形 (D3DPT_TRIANGLEFAN)。

我的问题是 - 在现代 3D 引擎中绘制几何图形时是否实际使用了它们?

它们的使用有何好处?它们是否以某种方式适合游戏创建流程? (我的意思是,艺术家可以开发他们的模型,以便他们利用这些/粉丝技术吗?)

I'm currently developing my own 3d engine, which has a very limited abilities in terms of geometry rendering and I want to expand it. What I'm interested in is how-it-should be done in terms of storing the geometrical objects and drawing them.

For now my abstraction only supports rendering geometry as generic lists of triangles (D3DPT_TRIANGLELIST in Direct3D terms). There are couple other ways of representing the objects - such as triangle strips (D3DPT_TRIANGLESTRIP) or triangle fans (D3DPT_TRIANGLEFAN).

My question is - are they actually used when drawing geometry in modern 3D engines?

How can their usage benefit and do they somehow fit in the game creation pipeline?
(I mean, like, can artists develop their models so that they're utilizing these strips/fans techniques?)

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

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

发布评论

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

评论(3

月亮邮递员 2024-09-25 14:07:35

还有其他几种方法
代表对象 - 例如
三角形条 (D3DPT_TRIANGLESTRIP)
或三角形扇形 (D3DPT_TRIANGLEFAN)。

我的问题是 - 他们实际上是
在现代绘制几何时使用
3D 引擎?

TriangleStrip 经常用于地形渲染或其他类型的网格,结合重新启动条带索引(0xFFFF 或 0xFFFFFFFF)或退化条带。它们提供了每个索引存储的三角形的最佳比率。如果您拥有良好的顶点缓存优化网格,它们将完全统治世界。

TriangleFan 存在于 D3D9 中,但已从 D3D10 和 D3D11 中删除。我的建议是,避免使用它们。它们不再有用的原因是,就属性插值而言(例如纹理坐标或法线),它们做得很糟糕,因为您可以用它们制作非常薄且拉长的三角形。

你可以说你也可以用条带或三角形列表来做到这一点,当然是的,但实际上做粉丝的能力会导致不友好的(人工制品方面的)网格。通过从 D3D 中删除它,内容创建工具可能会输出曲面细分,从而避免出现具有锐角的长三角形。

长而细的三角形也很糟糕(性能方面),因为它在光栅化过程中生成次优的四边形碎片(参见优秀的 关于三角测量的腐殖质帖子)。

当然,如果您正在编写高性能/高质量渲染引擎,则此建议适用,如果您正在编写业余爱好代码,您可能不太关心这一点。

There are couple other ways of
representing the objects - such as
triangle strips (D3DPT_TRIANGLESTRIP)
or triangle fans (D3DPT_TRIANGLEFAN).

My question is - are they actually
used when drawing geometry in modern
3d engines?

TriangleStrip are used frequently for terrain rendering or other type of meshes with conjuction of restart strip indices (0xFFFF or 0xFFFFFFFF) or degenerated strips. They offer the best ratio in terms of triangles per indices storage. And if you have good vertex cache optimized meshes, they will totally rule the world.

TriangleFan are present in D3D9 but have been removed from D3D10 and D3D11. My advice, avoid using them. The reason they are no good anymore is because they do an awful job as far as attributes interpolation are concerned (such as texcoord or normals), because you can do very thin and elongated triangles with them.

You can argue you can do that too with strips or triangle lists, yes of course, but actually the ability to do fans lead to not friendly (artefact wise) meshes. By removing it from D3D, content creation tools will probably output tesselation that avoid lenghty triangles that have acute angles.

Long and thin triangles are also bad (performance wise) because it generates suboptimal quad fragments during rasterization process (see excellent Humus post on triangulation).

Of course this advice apply if you are coding a high performance/ high quality rendering engine, if you are doing hobby code, you want maybe not care of this that much.

放飞的风筝 2024-09-25 14:07:35

三角形条非常常见,因为它们可以比三角形列表更有效地表示曲面。此外,您还可以将视觉上分离的三角形条缝合在一起,以便将整个不相交的几何图形渲染为单个条。您可以通过复制第一个条带的最后一个顶点和第二个条带的第一个顶点来完成此操作,从而创建两个桥接间隙但不渲染的退化三角形。

粉丝并不常见。它们可以在绘制凸多边形时派上用场,但即使这些通常也可以用条带同样有效地完成。

Triangle strips are extremely common, since they can represent surfaces more efficiently than triangle lists. Also, you can stitch together triangle strips that are visually separate so that entire disjoint geometries can be rendered as a single strip. You can do this by duplicating the last vertex of the first strip and the first vertex of the second strip, thus creating two degenerate triangles that bridge the gap but don't render.

Fans aren't so common. They can come in handy for drawing convex polygons, but even those can usually be done just as efficiently with strips.

浊酒尽余欢 2024-09-25 14:07:35

好处是它们减少了必须传输到渲染引擎的数据量。要在列表中发送 N 个三角形,需要指定 3*N 个点;如果它们可以表示为条带或扇形,那么您只需要指定N+2

The benefit is that they reduce the amount of data that must be transferred to the rendering engine. To send N triangles in a list would require specifying 3*N points; if they can be represented as a strip or fan, then you only need to specify N+2 points

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