In UV mapping each vertex has a UV coordinate, but wouldn't that just make 1 pixel for every vertex? How do you find out the texture coordinate for the spaces in between the vertices? Am I not understanding UV mapping right?
-
1\$\begingroup\$ No, it wouldn't. To find out the space between the vertices you use interpolation. \$\endgroup\$– tkauslJan 17, 2016 at 20:53
-
\$\begingroup\$ @tkausl So it kind of cuts the shape of the triangle out of the UV map? \$\endgroup\$– fabtasticwillJan 17, 2016 at 20:59
-
\$\begingroup\$ Yes, basically, that's it. \$\endgroup\$– Vaillancourt ♦Jan 17, 2016 at 21:00
-
\$\begingroup\$ It "kind of" cuts out a triangle between the three UV-coordinates which has not necessarily the same size as the triangle in the "world". \$\endgroup\$– tkauslJan 17, 2016 at 21:01
-
\$\begingroup\$ Each vertex has only one XYZ coordinate, so doesn't that just make 1 pixel for every vertex? \$\endgroup\$– user253751Jan 18, 2016 at 3:56
1 Answer
Actually every face of your mesh has UV coordinates through which UV mapping works. Let take an example of cube.
Cube has 6 faces and every face has 4 coordinates. That means a Cube must have 24 coordinates for UV mapping.
Now second part is to map coordinates with texture. Let's take an example of a square texture image having 6 different color boxes ( for each face actually). This means texture has 2 rows and 3 columns of color boxes containing 6 different colours. Have a look
Now if I want to map red color on Cube's top face let say and I know that the coordinates at 0, 1, 2, 3 represents the top face of cube. Then I would map as
- Coordinate at 0 would map 0,1 of texture
- Coordinate at 1 would map 0.33,1 of texture
- Coordinate at 2 would map 0.33,0.5 of texture
- Coordinate at 3 would map 0,0.5 of texture
As texture's points lies between 0 and 1. And if 0.33 is not clear then it is 1/3 of total width because 1/3 + 1/3 + 1/3 = 1
-
\$\begingroup\$ You are welcome, If you are now clear from my answer then you should consider to mark it as answer. Its a good practice :) \$\endgroup\$ Jan 18, 2016 at 22:13