Search Unity

Unwanted "Seams" between voxels on a procedural mesh

Discussion in 'General Graphics' started by Xynhay, Sep 3, 2021.

  1. Xynhay

    Xynhay

    Joined:
    Jul 8, 2017
    Posts:
    21
    Hello,

    I'm working on a minecraft like game.

    I generate a procedural terrain with voxels, everything works well, but i don't know why the mesh has "lines" between voxels :
    upload_2021-9-3_1-17-41.png

    The texture does not contain any lines...

    I managed to reduce the effect by rescaling the faces on the UV map : upload_2021-9-3_1-24-53.png

    But that's not a really elegant method, and the seams only disapear on close-to-camera terrain !

    Why sould I do ?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,348
    This is caused by mipmapping and not having wide enough padding between UV islands with a atlas texture.

    The fix is to:
    A) Disable mip maps on the texture, which will result in heavily aliasing in the texture, and possibly performance degradation. It’ll also possibly still break if you enable MSAA.
    B) Increase the padding between UV islands, but you’ll still get lines once the mip level drops low enough. So you’d need to limit the mip level either on the texture itself, which requires creating the texture asset in c# as they didn’t choose to expose the option to the texture importer, or the shader.
    C) Lots of complicated shader still like doing all mip mapping and bilinear filtering in the shader.

    D) or the real solution… use texture arrays.