I've created a textured cube in Blender, which I have uv-mapped like this:
The tiles are 256x256, and I've mapped the coordinates exactly at the edges (e.g. x: 256, y: 512). I then export my model as an fbx-file to Unity. In Unity, if I put many cubes adjacent to each other, seams appear between the cubes, like this:
I think I understand why this happens, because the uv-coordinates are exactly on the edges, and thus two faces sample from the same points along an edge.
I could solve this in some ways:
- By making the uv-tiles smaller, but it would look ugly with patterns.
- By adding some space between the tiles in the texture, and aligning the uv-coordinates to them.
My question: is there a better proper way for achieving this?
UPDATE:
So, about half a year later I still have issues with the seams. I've tried many things:
- Start uv-coordinates at 256.5 instead of 256, and so on...
- Turned of mipmapping.
- Set wrap mode to clamp.
- Set filter mode to point filter.
- Edge padded the texture atlas with first 4px, 8px, 16px, 32px. But still bleeding occurs at certain angles. Also updated the uv-coordinates accordingly.
- Changed my atlas to be of Power of 2 instead, i.e. 1024x1024 instead of 1024x768.
- Set "Non Power of 2" in Unity to None so Unity doesn't rescale my texture to nearest Power of 2.
- Set texture format to Automatic Truecolor instead of Compressed.
With 32px edge padding it actually gets a lot better, but it still isn't perfect, I guess I could go on and try even more padding, but my textures will get bigger and bigger.
I understand now that it is the mip-levels that are causing the bleeding. At far distances I don't think this is a problem, but I can see this occuring just about 5-7 units away from the player, if the player is looking down.
I believe there is something trivial about this that I'm missing. This is really a showstopper for me, forever grateful to the one who helps me solve this.
Thanks in advance!
This is how I have edge padded my texture (lines not visible on real texture), the problem does not only occur when the faces has such extremes distinct difference in colors as this one. It also occurs when the faces have patterns.