Terrain Tool

 

This is the beginning of the terrain tool I am working on. Currently, it allows you to generate terrains in edit mode, but there is so much more I want to do with this. Here is a list of all the other things I want to add:

* Allow Materials instead of colours
* Allow users to supply own shader
* Make into 1 whole mesh
* Collision mesh
* Allow window to scroll as needed
* Different block size
* Presets

Everything here is done in code. I was looking at building meshes via specifying the vertices, triangles and uvs to be able to make a voxel world and it lead to this. Originally, I had it so the player would have to give a cube gameobject (hopefully!) and I would use that for the terrain. I took that unnecessary step out and just generated my own cube. It was really interesting. One problem I ran into was the order I was creating the triangles. Because I didn’t have the vertices being added in the same order on every side, the triangles were forcing it to be rendered the wrong way around. I found out the order is important after a while, and fixed it. I eventually got a beautiful cube I made which I used in the tool.

Another problem I had with the cube was the normals were all wrong. The lighting looked awful! I was really confused as I through the normals would have been worked out. After a bit of searching, I felt silly because I forgot to reset the normals. Once that was done, the cube looked just like the default unity cube. I was super happy with it. I will be using this knowledge to improve my terrain tool by making the whole terrain a single mesh rather than individual meshes. It would drastically improve the performance of it and would allow for much larger landscapes.

Leave a comment