Basically I want to build a map in one draw by creating a MxN room and applying same texture to each generated plane, apply the UV coordinates to match the specific position of the texture and build one mesh.
So this was my thought process:
- Create two triangles that will generate a square/plane - done
- Create normals so that the triangles are visible - done
- Create UV’s and place their position on wanted position on the texture - semi-done
What I am having trouble with is that the generated square and texture applied to it make a small white border around the edge, like it’s bigger than it needs to be. Image below:
That white border should not exist. To get the UV position this is what I’ve done:
- Took the png width and height and divided it by the size of each square (16x16) to get row/col.
- Divided the row and col by 1 (1/row and 1/col) to get the UV scale.
- Set x = 4, y = 1 (I want 5th row and 2nd col texture)
- Manually positioned the UV of each vertex like this:
let uvs = [
x, z,
x + u, z,
x, z + v,
x + u, z + v
];
Why do I still get the white border? Am I doing something wrong? Sorry for the very long question but I didn’t know how to shorten it.