Pixel-Wide gaps in Custom Meshes

This is the root of my problem; the white-lines that appear between the tiles of my terrain. I suspect it’s the result of using 4 vertices for every tile, even if it shares borders with it’s neighbours, but this is important to how the game works later on. Any ideas?

What did you do to create the mesh? Is it an .obj file? Can I load it now? Would you provide a link for it?

It’s a mesh generated from a rough heightmap by the game. The code for this looks something like this: float Tile.Size = 3.5f;

	verts.add((i % CHUNK_SIZE) * Tile.SIZE); //X Coord of the new Vertex, in this case the North-East corner of the tile.
    verts.add((float) tiles[i].corners[Tile.CORNER_NE] * World.SIZE_HEIGHT_INT); //Y, with height taken from the heightmap for this tile in particular.
    verts.add(((int) (i / CHUNK_SIZE)) * Tile.SIZE); // Z
    ind.add((i * 6)); //Add Edge to the next vertex.
    setTexCoordWithAtlas(tex, 3, 0); //Basically selects the texture of the tile from a texture atlas. Tex is the arraylist of texture coordinates, 3 is the index of the texture for the ground in the texture atlas, the last parameter should be 0 for this corner, 1 for the next, and so on.
    addNormalForVert(normals);//Blindly makes the normal of this vertex directly upwards.</code>

Over and over again. I’m pretty sure that this is a gotcha, and there’s some postprocess filter that will abolish it.

I’m going to need a test case or an file for the model. I can not guess what’s wrong from this information.

1 Like

A test case would be useful. Or if you want to debug this yourself:

…ou might confirm that it works with plain UVs and a regular non-atlas texture. This will tell you if it’s something messed up in the texturing (for an atlas this is extremely likely if you haven’t taken lots of care with bleed).

If it still shows gaps then it might be the mesh… but I can’t really determine how you are building your mesh from the code provided. If the quads share borders… like share actual vertexes in the index buffer then you will not see gaps unless it’s from texturing.

Do you repeat the texture with shader magic? Eg doing a loop over a subimage part?