I’ve been working on AlexStv’s voxel tutorial and gotten it set up for the most part the way I wish it work. However, with all image settings correct - I keep ending up with white lines at a distance between the texture atlas tiles. After researching on Unity Answers and Forums, the best thing I can come up with is to add padding between the images and to the actual calculations but I cannot quite figure out where to do so.
https://gyazo.com/bcf8d98470314f2e1a5b922ca12dad60
Shown here, the padding has been added to the texture atlas, but I can’t seem to account for it in code:
public virtual Tile TexturePosition(Direction direction)
{
Tile tile = new Tile();
tile.x = 0;
tile.y = 0;
return tile;
}
public virtual Vector2[] FaceUVs(Direction direction)
{
Vector2[] UVs = new Vector2[4];
Tile tilePos = TexturePosition(direction);
UVs[0] = new Vector2(tileSize * tilePos.x + tileSize ,
tileSize * tilePos.y);
UVs[1] = new Vector2(tileSize * tilePos.x + tileSize,
tileSize * tilePos.y + tileSize);
UVs[2] = new Vector2(tileSize * tilePos.x,
tileSize * tilePos.y + tileSize);
UVs[3] = new Vector2(tileSize * tilePos.x,
tileSize * tilePos.y);
return UVs;
}
What do I need to modify? My padding setting is +3 between images, but I’ve tried adding that to tilePos.x/y and tileSize.