I’m creating a serious game which requires maps of the world to be rendered on a very high resolution screen, I’m doing this by creating an array of gameObjects (8x8) and loading images into them for the relevant area of the world. The problem is that the edges of the quads appear to be interfering with each other which results in the appearance of lines on my map.
My code is mostly built using the example that follows but addressing the renderer of the quad in the array rather than the parent renderer. The transparency line that is commented out was for troubleshooting purposes as explained later on;
for (int x = 0; x < arraySize; x++)
{
for (int y = 0; y < arraySize; y++)
{
Vector2 bottomLeft = new Vector2(
(tileSize.x * x) - (mapSize.x / 2f),
(tileSize.y * y) - (mapSize.y / 2f));
Vector2 topRight = new Vector2(
bottomLeft.x + tileSize.x,
bottomLeft.y + tileSize.y);
BoundingBox bbox = new BoundingBox(bottomLeft, topRight);
WWW www = new WWW(TileUrl(bbox));
yield return www;
//tiles[x,y].renderer.material.shader = Shader.Find("Transparent/Diffuse");
tiles[x,y].renderer.material.mainTexture = www.texture;
}
}
(Unity - Scripting API: WWW.texture)
My code calls a tile server using WMS which returns an image for a bounding box of lat/lng in PNG format. As a simple troubleshooting example I reduced my GameObject array to 2x2 to manually stitch the images together to confirm they have no edges. The four tiles can be find at these URLs;
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG%3A4326&BBOX=-180,-90,0,0&WIDTH=800&HEIGHT=400
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG%3A4326&BBOX=-180,0,0,90&WIDTH=800&HEIGHT=400
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG%3A4326&BBOX=0,-90,180,0&WIDTH=800&HEIGHT=400
http://vmap0.tiles.osgeo.org/wms/vmap0?LAYERS=basic&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG%3A4326&BBOX=0,0,180,90&WIDTH=800&HEIGHT=400
If I manually stitch these images together using Paint.NET there is no issue;
[31628-grid+issue+paint.net.png|31628]
If I render these same tiles in Unity3d I see lines between the quads, as this is 2x2 the lines appear at the equator and through Greenwich, bisecting at 0,0;
[31629-grid+issue+unity+render.png|31629]
I’ve tried setting the shader the quads use to transparent and manually moved the quads around to see if there is a better fit however these lines show up regardless. I’ve also tried with JPEG images and see the same issue, as well as with other tile servers too.
What could be causing this? It has me baffled.
Thanks,
Keegan