views:

276

answers:

1

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.

A: 

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.

Coincoin
Yes you understand the question correctly and thanks for the insight. This should get me pointed in the right direction.
abraginsky
Also, this is using OpenGL ES 1.1 (iPhone) FYI...
abraginsky