Category: Unity 3D

Terrain Generator For Unity – Step 6

In this step we will create the ground textures, also called “splat maps”. Unity stores the information about ground textures in a three-dimensional float array. The first two dimensions are the coordinates (x, y), the third dimension is the index of the texture that is to be used at that position. The index refers to the…


Terrain Generator For Unity – Step 5

In this step we will tweak the height map a bit to make it look more realistic. First of all we will add a water layer. We will also post process the height map so that areas close to water are made more flat (like beaches or riversides) and mountain areas are made higher to…


Terrain Generator For Unity – Step 4

In this step we will make the terrain generator more customizable. Instead of changing values in the source code we would like to change values in the editor. Fortunately Unity makes it easy to add fields to the inspector of the script, simply by making fields public. 1 We actually have four variables that are…


Terrain Generator For Unity – Step 3

In this step we will add some more detail to the terrain. What we have now is the basis but it lacks variation. We will do this by adding more layers of perlin noise to the existing layer. Furthermore the height map will be normalized before passing it to Unity. 1 Add another height variable…


Terrain Generator For Unity – Step 2

In this step we will create the basic terrain. We will generate a height map which Unity will convert into a terrain map. A height map is basically a two dimensional array of floats where each position represents the height (between 0 and 1) of the terrain at that position. The final height of the…


Terrain Generator For Unity – Step 1

In this tutorial we will build a terrain generator for Unity 3D. The terrain generator will have the following features: It will work in the editor as well as at runtime. It will be able to create virtually endless terrains. It will not only create the terrain but also ground textures, grass and trees. It…