If you are interested in finding out how to procedurally generate a terrain in Unity, you’ve come to the right place.

How it works:

The TerrainGenerator.cs takes in values for the perlin noise which is used to calculate the entire terrain height. I then added mountains that are generated by lifting up a random point on the terrain and then looping through each of the surrounding points to adjust their height values.

I am basically doing the exact same thing for the holes but instead of raising a point, we are lowering a point.

For the terrain painting I simply wrote a class that holds all the values for a splat prototype and I added a height value which will determine the terrain height for the set texture.

I am using noise and mapping to roughen the edges between two kinds of textures to ensure a more realistic look.





Download the Repository on GitHub!

Liked it? Take a second to support Kristin on Patreon!

Leave a Reply

Your email address will not be published. Required fields are marked *