I am generating terrain around a route. The route already exists. I am using the Perlin Noise function implemented in Unity to generate terrain tiles that merge seamlessly. I generate the terrain tiles in the origin layer. From each terrain grid point I shoot a raycast to scan the street. I set the height values so that they are below the road (see picture 1 box without number). The terrain therefore adapts to the road

Road weaving through terrain

The problem, however, are roads with an elevation profile. For these, I save the highest road point within a terrain tile and add it to the height value of the respective tile. This allows me to arrange the tiles along the elevation profile of the road (image 2). Unfortunately, this height offset again breaks the seamlessly transitioning Perlin Noise. Is there a way to make the tiles merge seamlessly again after adding the offset?

Terrain tiles with visible discontinuities along tile borders

So clearly the tiles surrounding the road sections with elevation profile are not supposed to be in the origin plane, but like the road elevation. I hope I have explained it reasonably well.

  • \$\begingroup\$ Are you able to query information about nearby road segments, so the terrain can slope up/down in anticipation as it approaches? Giving us some information about how the road is built can help us suggest ways to adapt the terrain to fit. \$\endgroup\$
    – DMGregory
    Commented Oct 25, 2022 at 13:52
  • 1
    \$\begingroup\$ Not 100% sure I'm following your issue but in case it helps... When I tried to solve a similar issue, I let the terrain generation run freely, then lerped between the terrain height and the road height based on distance from the road. That way if the road is below the terrain, it cuts out a valley. If above the terrain, it builds an "embankment" for the road to sit on. \$\endgroup\$
    – Basic
    Commented Oct 25, 2022 at 14:21
  • \$\begingroup\$ @Basic I think that would make a good answer, especially if you could include an example image / screenshot. \$\endgroup\$
    – Pikalek
    Commented Oct 25, 2022 at 17:50
  • \$\begingroup\$ Unfortunately, the road comes from a library that reads an XML-based file and then creates the mesh or geometry internally. Unfortunately, the library does not currently have an API where I can request street information. But this can be changed. Possible are querying the roadside points, points in the middle of the road, which road segment (straight or curve and how wide and long they are in metres). That's why I thought I would first ask if anyone knows of any ideas, papers or other sources of knowledge that I can read. Thanks for your comments and help. \$\endgroup\$
    – IMGSaibh
    Commented Oct 26, 2022 at 8:43
  • \$\begingroup\$ @Basic Yes, a picture would be great. I also use a similar technique to model the roadside space. Unfortunately, this does not help along the road with the height values with Perlin Noise. I would be very grateful for a picture or hints. \$\endgroup\$
    – IMGSaibh
    Commented Oct 26, 2022 at 8:46

1 Answer 1


I found the solution myself! Thanks to everyone anyway! It wasn't that difficult.

For all those who are interested, here is the solution: You need functions that describe the height profile of the road. I implemented an example using two chained functions (shown with the linerenderer in white) and generated 3 seamless terrainchunks.

The heightmap generated with Perlin Noise from each chunk must be additively linked with the function of the road height profile. result = PerlinNoiseHeightMap[x,z] += RoadHeightFunction(x); This generates the PerlinNoise along the height profile as shown in the picture.

I hope it helps those who are interested.

enter image description here enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .