经历垂直变形的多边形网格中的恒定水平带高度 (OpenGL ES 1.1)

发布于 2024-07-13 00:12:50 字数 560 浏览 3 评论 0原文

当使用常用算法在标准多边形网格上实现纹理映射时,您可能会遇到与沿 y 轴变形相关的问题,因为变形沿着四边形的恒定高度行的带进行,而不是沿着该方向的顶点能够与沿 x 轴的拉伸相比,独立拉伸。

我遇到这个问题是因为在定义网格的顶点时,每一行都定义了底部和顶部顶点,导致一行的顶行顶点与其上方的行共享底行顶点。

虽然如果您仅沿 x 或 z 轴使网格变形,这是可以的,但如果您沿 y 轴使网格变形而不考虑这一点,您将看到四边形的行一起充当带恒定高度而不是独立点的行。 您将看到网格沿 y 轴变形,但您也会看到纹理撕裂,因为这些带的宽度没有变化,导致网格中出现间隙。

还有其他人遇到过这个问题,他们会建议如何最好地将 (x,y) 位移贴图过滤器应用于以这种方式构建的多边形网格吗? 或者定义网格的方法是否必须从根本上改变?

网格生成算法的示例可以在 ZEUS OpenGL|ES 纹理教程中查看映射

谢谢。

When implementing texture mapping on a standard polygonal mesh using the usual algorithm, you can run into issues related to deformations along the y-axis in that the deformations follow along bands of constant height rows of quads instead of the vertices in this direction being able to stretch independently compared to that along the x-axis.

I'm running into this because when defining the vertices of the mesh, each row defines both a bottom and a top vertex, resulting in the top row of vertices for one row sharing the bottom row of vertices for the row above it.

While this is ok if you're only deforming the mesh along either the x or z axes, if you deform the mesh along the y-axis without taking this into account, you will see that the rows of quads act together as a band of constant height instead of rows of independent points. You will see deformation of the mesh along the y-axis, but you will also see texture tearing as these bands do not change in width, leading to gaps in the mesh.

Has anyone else run into this who would have suggestions on how best to apply an (x,y) displacement map filter to a polygonal mesh constructed in this fashion? Or does the approach to defining the mesh have to change in some fundamental way?

An example of the mesh generation algorithm can be seen on ZEUS OpenGL|ES Tutorial on Texture Mapping.

Thanks.

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

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

发布评论

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

评论(1

另类 2024-07-20 00:12:50

好吧,让我们先看看我是否理解这个问题。

如果我理解正确的话,您正在尝试渲染纹理映射补丁。 但是,当您尝试在垂直方向拉伸补丁以使其变得更高时,网格中的不同水平带会撕裂,最终会得到几个水平补丁带。

是对的吗?

如果是这样,问题出在网格生成算法上,纹理映射本身必须保持不变。 从我在提供的链接上看到的,每个水平带之间的顶点不共享,它们是重复的。 因此,如果缩放顶部顶点之间的间距,则还需要缩放带高度,以便底部顶点适合下一行顶部顶点。

该算法的基本原理是有效的,您只需要调整行距和行高。 当您更多地了解基元列表的工作原理时,您可能想了解索引基元。 这些实际上可以让您共享顶点,而不是为每个图元复制它们。

希望能帮助到你。

Ok lets see if I understand the question first.

If I understand you correctly, you are trying to render a texture mapped patch. But then when you are trying to strech the patch in the vertical direction so it gets taller, the different horizontal bands from your mesh tear and you end up with several horizontal band of patch.

Is that right?

If so, the problem is in the mesh generation algorithm, the texture mapping itself must stay unchanged. From what I can see on the provided link, the vertices between each horizontal bands are not shared, they are duplicated. So, if you scale the spacing between top vertices, you also need to scale the band height so that the bottom vertices will fit the next row top vertice.

The fundamentals of the algorithm work, you just need to adjust both row spacing and row height. When you understand a little bit more how primitive lists work, you might want to learn about indexed primitives. Those will actually let you share vertices instead of duplicating them for every primitive.

Hope it helps.

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