Search Unity

Rendering/Shader problems between tiling terrain. Texture falling down sides

Discussion in 'World Building' started by makkenr95, Aug 20, 2021.

  1. makkenr95

    makkenr95

    Joined:
    Sep 2, 2013
    Posts:
    7
    Hi!

    Ive been messing around with procedural generation of terrain and cant get the terrain edges to look seamless. I believe this is thanks to the texture/material continuing down the positive sides of the terrain as you can see this does not happen on the negative sides as the texture does not continue down those sides:

    problems.png
    problemss.png

    Here is the code:

    Code (CSharp):
    1.  
    2. void GenerateNewTerrain(Vector2 currentVector)
    3.         {
    4.             TerrainData tD = new TerrainData();
    5.             tD.heightmapResolution = width;
    6.             tD.size = new Vector3(width, depth, height);
    7.             tD.SetDetailResolution(1024, 32);
    8.             tD = GenerateTerrain(tD, (int)currentVector.x, (int)currentVector.y);
    9.             tD.alphamapResolution = width;
    10.             tD.baseMapResolution = width;
    11.          
    12.             GameObject terrain;
    13.             terrain = Terrain.CreateTerrainGameObject(tD);
    14.             terrain.GetComponent<Terrain>().materialTemplate = mat;
    15.             terrain.GetComponent<Terrain>().groupingID = 1;
    16.             terrain.GetComponent<Terrain>().allowAutoConnect = true;
    17.             terrain.tag = "Terrain";
    18.             terrain.transform.position = new Vector3(currentVector.x, transform.position.y, currentVector.y);
    19.  
    20.             updateOnce = true;
    21.         }
    All i want to do is to get seamless tiling terrain and i think all i have to do is make sure the texture doesnt run down the sides. By changing the shader to unlit the problem got solved but it wont work with my planned day and night cycle.

    Please tell me if any more information is needed.

    Thanks in advance!
     
  2. makkenr95

    makkenr95

    Joined:
    Sep 2, 2013
    Posts:
    7
    UPDATE:

    To avoid this problem i ended up generating my own meshes instead of using unity terrain tool.
    If you want to do the same here is the start of a three part procedural mesh terrain generation tutorial series by Brackeys: