- Home /
A question about UVs being not accurate.
Hello,
I am creating a voxel game, each chunk is a mesh that contains 16*128*16 blocks. And I get textures from a 16*16 texture map with each texture being 32*32 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 :)
Answer by Tonks · Jan 05, 2016 at 03:52 PM
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.
Hey, first of all, thanks for your answer.
I am kinda new to unity and the whole game development thing, What do you mean with "bleed" ?, Do you mean that I should add borders to the textures ?
No problem :) http://wiki.polycount.com/wiki/Edge_padding This should explain it far better than I can.
Your answer
Follow this Question
Related Questions
Object odd light problem with mesh? 1 Answer
Procedural Mesh UVing 2 Answers
Updating UV in imported mesh without having to re-material 0 Answers