In my previous post, I talked about working with the physics in Unity and making a little “roll-a-ball” game to get familiar with the software and language of C#. Today I will be talking about terrain in Unity, essentially the world that everything happens in for your program.
Working with terrain in Unity has its different levels, you could be a beginner and make some rolling hills or you could be an expert and create a whole landscape with water, grass, and trees. I am just a beginner seeing that I have only been working with Unity for about two weeks or so but I started fooling around with the terrain and all the features that you can use with it. At first, I made a few hills and added a ball into the scenario and rolled it around to see how it interacted with the terrain. I was very pleased how it worked and went on from there.
The next thing I wanted to do was to import real life terrain into Unity so it could be represented as a 3D model. This was much harder than I had initially expected. The concept of importing a grayscale height map into Unity is rather simple but the execution can have its obstacles and weird problems. To import real life terrain, one has to get a grayscale picture of the terrain, convert that picture from jpeg or png to raw using a photo editor (photoshop in my case), and then import the raw into unity and bingo you have a 3D representation of your real life terrain. That is how easy it should be but I had my problems
Firstly, when importing the raw the dimension and resolution of your picture they have to be just perfect for Unity to render it correctly. If the dimensions are skewed or wrong then you will be left 3D representation of this:
which is not a real-life terrain.
Secondly, which wasn’t a problem with Unity, I didn’t have a photo editor that could save a picture as raw so that took me quite awhile to finally realize that I could just download the trial version of photoshop infinitely so I could have my supply of raw pictures.
So after all that tweaking, I was finally able to import a raw, grayscale height map and get my desired 3D real life terrain. The terrain that I took was from Mount Lemmon which is important as I progress in my project.
Yay! Finally I did it