Original Post
Hello,
In my application I want to handle textures in a same way, even if they are applied in a different manner (projection, cylindrical, spherical, box). So this means I don't want to use automatic texture coord. generation, but I want to calculate them myself, when the object is created.
Usually, people calculate one texture coordinate (u,v) for each vertex (x,y,z). So each vertex will always have assigned the same texture coordinate.
But in my understanding, this cannot work when using cylindrical/spherical texture mapping:
suppose that one of the triangle (with vertices A, B, C) closing the cylinder has following angular coordinates (in polar coordinates, in degrees): 340, 350, 10
So those 3 vertices will be mapped following 3 u-texture coordinates: 0.9, 0.95, 0.05 (approximately!)
But that is not correct: the texture fragment would be spanning across almost the whole texture!
we should rather have following u-texture coordinates: 0.9, 0.95, 1.05
I could assign the vertex C the u-texture coordinate "1.05" to make that triangle look ok, but the problem is that the same vertex C is also part of other triangles, which might rather require the u-texture coordinate "0.05".
I hope I explained myself clearly enough ;)
So the only solution to this would be to have 3 texture coordinates for each triangle, rather than to have one texture coordinate for each vertex. Do people usually do that?
Is there another option?
Thanks for any advice!
In my application I want to handle textures in a same way, even if they are applied in a different manner (projection, cylindrical, spherical, box). So this means I don't want to use automatic texture coord. generation, but I want to calculate them myself, when the object is created.
Usually, people calculate one texture coordinate (u,v) for each vertex (x,y,z). So each vertex will always have assigned the same texture coordinate.
But in my understanding, this cannot work when using cylindrical/spherical texture mapping:
suppose that one of the triangle (with vertices A, B, C) closing the cylinder has following angular coordinates (in polar coordinates, in degrees): 340, 350, 10
So those 3 vertices will be mapped following 3 u-texture coordinates: 0.9, 0.95, 0.05 (approximately!)
But that is not correct: the texture fragment would be spanning across almost the whole texture!
we should rather have following u-texture coordinates: 0.9, 0.95, 1.05
I could assign the vertex C the u-texture coordinate "1.05" to make that triangle look ok, but the problem is that the same vertex C is also part of other triangles, which might rather require the u-texture coordinate "0.05".
I hope I explained myself clearly enough ;)
So the only solution to this would be to have 3 texture coordinates for each triangle, rather than to have one texture coordinate for each vertex. Do people usually do that?
Is there another option?
Thanks for any advice!