- Home /
Procedural mesh generation, problem with textures
I am trying to achieve tiling with mesh. I manage to get it working but I have odd problem with textures. On edges there are sometimes lines which shouldn't be there, the thing is its not on every tile like that, and if I move the camera it disappears from one place and it shows up on another place. Pictures: Picture 1, Picture 2. And here is the code I use for applying texture to a mesh:
newUVs.Add(new Vector2(tileSize * texture.x, tileSize * texture.y + tileSize));
newUVs.Add(new Vector2(tileSize * texture.x + tileSize, tileSize * texture.y + tileSize));
newUVs.Add(new Vector2(tileSize * texture.x + tileSize, tileSize * texture.y));
newUVs.Add(new Vector2(tileSize * texture.x, tileSize * texture.y));
tileSize is 0.32f in my example. texture is Vector2(Grass texture is 0,0 and Dirt texture is 1,0). I really have no idea how to fix it anymore. I tried bunch of stuff but same thing.
Ensure your tiles are mathematically flush (sharing verts). Set your texture's tiling mode to "clamp" ins$$anonymous$$d of "repeat". Ensure you're using "Fantastic" quality settings to eli$$anonymous$$ate quality as a factor.
Setting to clamp removed them somewhere but they still appear, quality is set on fantastic.
Uhh thanks, I googled for "seam" and it was exactly what I was looking for, thank you! Would you $$anonymous$$d converting your last comment to answer so I can select it?
Answer by AlwaysSunny · Mar 30, 2015 at 09:45 PM
Because this is a fairly common issue, I'm sure there's quite a few posts about how to address it hiding in plain sight on the web. A dozen or so different factors can contribute to produce similar issues, and the only way to eliminate the problem entirely involves observing the "best practices" for each aspect. (game quality, mesh quality, texture settings, camera properties, scene characteristics...) Do plenty of research to satisfy yourself that you're doing everything you possibly can to overcome the problem. Search for terms like "seam" and "artifact" as well as plain-english like "black line" in conjunction with "unity".