I have a number of spherical longitude/latitude coordinates for points on a sphere that I need to visualize. For that purpose, I transformed the points to cartesian coordinates and built a mesh of triangles that I can render with VTK. Works so far.
Now I want to use a texture for the sphere model. Therefore I transformed the spherical coordinates to texture coordinates and assigned these to each point. This works for the majority of the sphere's surface triangles and the result looks acceptable.
But, for the triangles on the opposite side of the prime meridian, where the texture wraps, the triangles are textured incorrectly: Instead of repeating the texture and mapping “over the texture boundary”, the whole texture gets squeezed onto the single triangle.
Here is a picture of how it looks like:
The zick-zack line is obviously wrong, the blue line should be visible instead. The whole texture is mapped on the triangles, resulting in red and white stripes. This makes sense since, for the triangles in question, the texture coordinates span the whole texture space.
To illustrate this problem, which is not specific to spheres but all closed objects, I have created the following figure:
In the upper rectangle, we see a triangle that spans over the texture boundaries with computed texture coordinates A, B and C. Since the texture can be tiled, this is how I would like the triangle to be rendered.
The lower triangle shows how the texture coordinates are interpreted currently. The coordinates of the edges A, B and C are the same, but this time, the majority of the texture is used for the triangle, instead of tiling the texture at the borders.
I am sure there is quite a common mistake I made but I didn't find anything to help me yet. Have any hints for me?