A question about UVs being not accurate.

Hello,

I am creating a voxel game, each chunk is a mesh that contains 1612816 blocks.
And I get textures from a 1616 texture map with each texture being 3232 so the whole file is 512px*512px

To calculate the UV for each block, I do the following:

newUV.Add(new Vector2(0.0625f * texturePos.x + 0.0625f, 0.0625f * texturePos.y));
newUV.Add(new Vector2(0.0625f * texturePos.x + 0.0625f, 0.0625f * texturePos.y + 0.0625f));
newUV.Add(new Vector2(0.0625f * texturePos.x, 0.0625f * texturePos.y + 0.0625f));
newUV.Add(new Vector2(0.0625f * texturePos.x, 0.0625f * texturePos.y));

Note that 0.0625 is simply 1 / 16

So the problem is, With a such big texture map, Its not precise, The textures always have an edge from the other texture near it, So I am asking if there is a way to use like sliced image or simply use pre-calculated x and y, X being <= 512 and so do to Y.

Here is how it looks right now: https://i.gyazo.com/8bba574d4cdaab92251a69318ed52f12.jpg

As you can probably see, There is some white lines in between the textures that I don’t want.

Any help is really appreciated, I just need to be directed to the correct way :slight_smile:

Bleed. If your UV map goes right up to the edge of the map, then you will get these artefacts. It’s a bit hard with 16x16’s, but usually you’d have several pixels of bleed to prevent this.