Procedural Terrain Generation System is a compact procedural terrain solution for creating natural looking, rich environments inside Unreal Engine and Unity. System is powered by a custom implementation of perlin noise that is used by Fractal Brownian Motion and Value Noise.
Parameters of the system is being generated with an LLM model, in my another work called Diamond AI RAG.
Perlin Noise is one of the most used game development noises for creating natural looking textures. The original Perlin Noise was implemented for having great memory management at least 20 years ago. Because of this Perlin Noise uses a static hash table in its original form, which is a limiting factor while creating textures. This procedural terrain generator system uses an advanced perlin noise approach, where the permutation table is determined by a given seed at the start. Perlin Noise’s permutation table is also used by other noises available inside the terrain generator such as value noise.
FBM is a very powerful algorithm used in game development widely. Procedural terrain generation system uses FBM to create multiple layers, in an amount of octaves, of perlin noise to create natural looking terrains.
Value noise is used for distributing the biomes available in the terrain. Usually white noise is being used for generating value noise, but in the procedural terrain generation system, perlin noise is being used for generating noise while getting values of selected cell’s neighbours.
Widely used in computer graphics, Gaussian Kernel or Gaussian Filter is a very powerful algorithm to smooth noises. The common approach is not using Gaussian Filter on terrain generation but the biome map approach is very suitable for Gaussian Filter. Since different biomes might have different heights compared to each other at the borders of the biomes, a fading function is required to smooth the height between biomes. Without the Gaussian Kernel function, the terrain would look very unnatural and incomplete.
Gaussian Kernel in the procedural terrain generator, determines the weights of each biome on given x, y location based on the exponential gaussian function to ensure distant neighbours affect the weight of the cell less.
Assigns a biome to each point using value noise. For each x and y, a noise is being calculated based on the noise scale. Noise scale divides both x and y, because perlin noise performs better in smaller numbers. Later the noise is multiplied with the total weight available to generate a threshold value. This threshold value is used for getting the biome index of the point. Since the point’s biome is calculated with value noise, the point is guaranteed to be in a cluster all the time. An array of biome data for each point is being returned at the end by the function.
Calculates blending weights for biomes in each x, y point with Gaussian Kernel and uses biome specific FBM to calculate the height generated for each biome at given point. Later heights multiplied with weight of each biome, resulting in the biome's FBM to be dominant at the center of the cluster while not breaking the smooth transition effect between biomes. Gaussian Kernel is the perfect solution, because of the exponential nature of Gaussian function, centers of the clusters will not be affected from blending between two biomes.
Biome weight totals are always normalized to have a maximum value of 1, because higher values will create inconsistent results. Blended height generated by the function is also multiplied with terrain amplitude since FBM, or perlin noise, works very well on small numbers and the result of FBM is very small. The new value transitions after multiplication will be visible with the human eye in the game.