We are creating our maps using tiles and everything works fine, however sometimes when moving some lines will appear where the tiles meet.
[1497-screen+shot+2012-07-02+at+3.36.14+pm.png|1497]
This happens because the edge tile on the top is a little bit higher (0.005) than the grass tile below it. For reference, below are the tiles in this scene:
Is there any way to fix this? Hopefully some other way other than combining meshes, i’d prefer to keep everything in it’s own mesh.
Thanks a lot! I appreciate your time
Although I don’t really understand the connection between your first and second image, this looks like a simple wraparound problem. Unless you need the textures to be repeatable, have you tried setting the WrapMode of your textures to “Clamp”?
Also, it is not clear what you mean by “is a little bit higher (0.005) than the grass tile below it”. You mean physical/terrain height and there are actually several tile layers on top of each other? Why do you need it to be higher? Or do you mean width/height dimension and your tile is strechted a bit?
EDIT:
One solution would be of course to place the sand-tile also 0.005 higher. But this “solution” only fixes the symptom you have. It would be better to fix the actual problem, which is the 0.005 shift, and the z-fighting if there is no shift.
A better solution would be a custom shader for your alpha-channeled sand rim. First, don’t do the 0.005 shift. Use a shader with “Offset 0,-1” or “Offset -1,-1” set (maybe experiment a bit which will give you the best results). You can also try to increase the render queue of the shader (could also be done by script via renderer.material.renderQueue+=1;
). If you are certain that these rims will only cover other co-planar layers below (such as the grass), you can also experiment with “ZTest Always”, but note that in this case if you want to place any objects above that rim, they’ll probably need an even higher renderQueue, so this will get more complicated.
See also here: Unity - Manual: ShaderLab: commands