Is there a way to get around this?
(The problem has been discussed here too long time ago, but I don’t fully understand the proposed solution).
Thanks
What is happening is that you are jumping from one point to another in your texture, and OpenGL interpolates the texture coordinates between those 2 points. You can tell the shader at the texture edges “make this texture periodic” so it does a texture coordinate interpolation differently with SeamlessU and SeamlessV, but I’m afraid you won’t be able to do the same kind of things if you do jumps inside your texture like that.
What you could do is duplicate points where this happens and make this interpolation happen between those duplicate points. The jump from (0.38, 0.063) to (0.92, 0.97) must happen at the same point location in your example.
You could look at discontinuities in the (u,v) coordinates that must be mapped to points. A threshold on these discontinuities might be enough. You can use vtkGradientFilter to detect those discontinuities (the derivative should be high on the seam).
We had a similar problem for the PLY reader. The issue was that colors were assigned per cells in the PLY file but were set on points when data was read. As Yohann mentioned this resulted in discontinuities for the texture coordinates which causes problems similar to what you are seeing. So one thing you can try is to save you data as PLY and then you can toggle between duplicating points at discontinuities or not using
SetDuplicatePointsForFaceTexture (bool)
So you can understand how you want it to work, try to collapse points from the yellow bottom line into the positions of the top layer. You can have consistency on which point goes when by looking at the orientation of your triangles (do a cross product of compute the triangle normal, and see how points turn around this normal).
This will distort the geometry but will remove the seam.
Now, what you want is you want to keep the geometry intact, and actually duplicate points. What you need to do is instead of collapsing, create a new strip of triangles as thick as a line, with new points. You want this strip to replace the yellow strip that you are currently seeing. So basically you need to need to edit triangles from this yellow strip and change the point ids to match the ones of your new strip. Don’t forget to add this triangle strip into your poly data polys and the new points into your vtkPoints* vtkPolyData::GetPoints().