Procedural mesh generation : river creasing issue

Hello,

I’m working on (trying to learn how to make) a procedural mesh generation project with multiple height maps.

For now I have :

  • a simple perlin noise map

6420046--717541--Capture d’écran de 2020-10-15 09-47-13.png

  • a river map which I build with a simple square function (i’d like to update this to a gaussian function in the upcoming days)

6420046--717544--Capture d’écran de 2020-10-15 09-49-30.png

Those 2 maps are combined to create a single height map which my MeshGeneration algorithm creates my mesh with.
Here is the result :


Here is the combination code :

float[,] newMap = new float[width, height];
        for (int y = 0; y < height; y++)
        {
            for (int x = 0; x < width; x++)
            {
                float currentHeight = 0f;
                currentHeight += noiseMap.GetMap()[x, y] * noiseMapOpacity;
                currentHeight += riverMap.GetMap()[x, y] * riverMapOpacity;

                newMap[x, y] = currentHeight;
            }
        }

I now have multiple issues i’d like to deal with :

  • The river edges are sharp and I don’t know how to smooth them
  • I can’t place a water plane at a certain height because 1. the edges are not horizontal enough and 2. there are vertices on the land (around the river) where the height is lower than the river edges

In other words, I think I want the edges of the river to have the lowest height of the land part but I dont have any clue on how to achieve that as long as keeping the whole mesh “smooth”.

Thank you for reading me, I hope this was understandable enough…

Why not add 3d terrain game object ? It has got all terrain building functions.

I will try using 3D Terrain but i’m pretty sure the issues come from my height map and not the tool i’m using to display it.