Introduction to Generator Modules

As you know, Ultimate terrains can generate terrains from many different sources. This can be a heightmap (like standard terrains), Perlin Noise, Voronoi, serialized 3D structure, etc. Ultimate Terrain can even combine up to 10 modules on a single terrain!

Basically, when Ultimate Terrains computes a part of the terrain, it will ask the Generator Modules to give the value of voxels at some positions in the world. In other words, Generator Modules decide how the terrain will look like.

A Generator Module must have a function taking a 3D position as argument and returning a value between -1 and 1 (see here for more information).

For example, the Heightmap Generator Module will compute the value at a given position by comparing the Y coordinate of the position with the color of the pixel at the equivalent position on the heightmap.

Working with modules gives an incredibly easy and powerful way to deeply customize the generation of your terrain, and so its shape, textures, etc.


Now let’s see how to use them

Ultimate Terrains offers a very clean an intuitive interface to use and eventually combine modules. Select your terrain object in the scene to open its inspector. Then go to the Generator Modules section and click on Edit Generator Modules. This will open a window showing all modules and how they are linked.

3D Generator Modules take a 3D position as input and give a value between -1 and 1 as output.

2D Generator Modules take a 2D position (X, Z) as input and give a value between -1 and 1 as output. They are useful to compute, for example, where you want to apply some texture or another based only on the X and Z coordinates. You should always use 2D Generators instead of 3D Generators when you can because they have much less impact on performances.

All of these values are then given to the Combiner Module which is in charge to combine them (by adding some them, multiplying some others, etc.) and returns the final value (still between -1 and 1). This mechanism allows to combine up to 10 3D/2D Generator Modules.

Lastly, the Voxel Generator Module take 2D Generator values and then combined value as arguments and returns a voxel, containing the final value and some other information like its type.

This might look a bit complicated at the beginning, but when you’ll look at the example scenes you’ll see that there is nothing to be afraid of. In a short time you will be able to use the modules you want, the way you want, to get the terrain you want.