After watching some Youtube tutorials I thought I had understood the concept of UV mapping:
I have a net of triangles, and I have an image representing my texture.
Now I tell the GPU which point of the image shall be mapped to which point of my triangle net, and then some magic happens inside the GPU to generate a textured object.
IF I move a point of a triangle, the mapped texture is distorted accordingly.
Correct so far?
Now I read somewhere the following "specification" regarding UV mapping on a planar surface:
A three pixel wide texture belongs to every single triangle.
Per triangle the following UV mapping shall be used:
triangle point A: UV(0.2, 0.5)
triangle point B: UV(0.5, 0.5)
triangle point C: UV(0.8, 0.5)
My problem is that I don't understand what the author means:
I have a three pixel wide texture, values are... whatever... 2,4,6.
Let's define coordinate 0, 0 for the left pixel and 1, 0 for the right one.
Then UV(0.2,0.5) means that point A of my triangle shall have value (0.8 * 2) + (0.2 * 4) = 2.4, point B then has value 4 (it's in the middle) and point C has value (0.2 * 4) + (0.8 * 6) = 5.6.
Is it so?
And all other points of the triangle are interpolated according to their coordinates based on these three corners? Or what happens to them?
And all other points [...] are interpolated[...]?
Actually that is up to you and your application. You can set up to have a linear filtering, in which case, yes, everything would be interpolated (although I think the 2.4 and 5.6 values you calculated might be wrong). You can also set up to always read out the nearest value, in which case your point A would read only the value 2 and see, it is closest, therefore just take it. Then you wouldn't have any interpolation. E.g: Take a look at this tutorial, showing the difference: learnopengl.com/Getting-started/Textures $\endgroup$ – Tare Nov 21 '19 at 15:58