Procedural Land Generation - Andreas Sepp
Bachelor's Thesis: https://comserv.cs.ut.ee/home/files/sepp_informaatika_2016.pdf?study=ATILoputoo&reference=DD8A7D42D542D38F624F67AA83B6CB1108696588
Main application repository: https://bitbucket.org/AndreasGP/procedural-land-generation-with-unity/overview
Presentation slides: https://docs.google.com/presentation/d/1EUxI0WDoEtDRG63L11fjop6nri4A_wCDxoYR0xQxOYU/edit#slide=id.p
The aim of this project is to develop a few small web applications that can be used to visualize the results of my bachelor's thesis on the same topic. Over the semester multiple small applications will be developed to visualize different parts of the thesis. For starters, small applications will be written that visualize the workings and results of some of the used algorithms (perhaps midpoint displacement and Simplex noise or some similar noise). At a latter stage a few Three.js applications will be made that uses those algorithms to generate a flat 3D terrain, a simple heightmap 3D terrain, heightmap terrain with some skewing and other methods to make the terrain more interesting, biome areas generation and visualization and finally an application that combines all the previous applications into one - visually interesting terrain with different looks in different biomes. HTML5 canvas and Three.js will be mainly used for the project.
Milestone 1 (29.02)
- a HTML5 canvas based application for generating a few noise textures(perhaps midpoint displacement aka diamond-square algorithm, perlin/simplex noise):
MDA implementation: https://dl.dropboxusercontent.com/u/68604934/veeb/midpointdisplacement.html
4x4 MDAs with shared borders: https://dl.dropboxusercontent.com/u/68604934/veeb/midpointdisplacementquad.html
Simplex noise implementation: https://dl.dropboxusercontent.com/u/68604934/veeb/simplexnoise.html
- Optionally using Three.js to show the generated textures in 3D as a heightmap.
Milestone 2 (14.03)
- Working basic terrain generation with voxels (will be partially ported from old CG project).
Rewrote an old project in Unity with C#. The result provides an easy to use basic voxel engine where different terrain generation algorithms can be tested.
- Optionally exploring different ways to make the landscape more interesting.
Added 3D noise on top of the heightmap 2D noise, which cutoff threshold increases the higher you go on a chunk to prevent floating islands.
2D base noise marked with stone and 3D noise generated on top of it with grass/dirt.
Milestone 3 (28.03)
- Pick a biome generation algorithm
- Implement a few biomes
During this iteration I spent most of the time researching and trying to come up with a better biomes algorithm than the one I came up with before. However I was unable to find a suitable one so I decided to continue with the one I came up with earlier. I will also continue trying to come up with a better one since I'm unhappy with current results.
Since I spent a lot of time researching, I didn't implement too much. I did implement my previous biome algorithm idea though.
- First a biome chunk size is chosen and the whole world is divided into biome chunks using that:
- Next using each biome chunk's global coordinates, a hash is generated to calculate a deterministic values for x and y axis offsets. This lets us generate a biome midpoint for each biome chunk:
- After doing this, we can determine which biome column each terrain column is in. If we know which biome chunk a terrain column is in, we can also find the 8 surrounding biome chunks to it:
- Now we have the closest biome midpoints for the column we're calculating biome for. Now we can find the closest biome midpoint to it and mark it with that biome's color, giving us a sort-of uniform Voronoi diagram:
- Now we have divided the world into biome regions, however their edges look a bit too sharp. Lets fix it by applying a small offset dependent on simplex noise at the edge coordinates to the algorithm, that figures out which midpoint is the closest:
- Now each column belongs to a biome cell and all we have to do is determine which kind of biome that cell has. For that we can calculate a rainfall and a temperature value using simplex noise and then we can use a Wittaker biome diagram modification to pick a biome for the cell:
This is as far as I got so far, the 3D implementation is in the works still.
Milestone 4 (11.04)
- Biomes in 3D
- Optionally tree placement algorithm + placing trees.
During this iteration I implemented the biomes algorithm in 3D but it still has several issues. First of all the uniformness and tendency to be parallel to x and y axes of my Voronoi cells implementation causes the edges to be very sharp and not very good looking. Secondly lerping amplification factor near biome edges is challenging because in the end result all biomes should blend together nicely at the borders and they should have different amplifications to make some biomes flatter than others etc. Right now amplification lerping is done by taking the amplification of current biome and amp of the closest biome and then calculated by averaging this. However in some corners 3 biomes meet and that produces ugly results.
Picture of the first problem:
Picture of the second problem:
Milestone 5 (25.04)
- Improving the biome border issues
- Optionally tree placement algorithm + placing trees.
Biome border issues were fixed by considering 3 neighbouring biomes when calculating amplification near borders.
- Added trees and other foliage elements by generating a single layer of 2D simplex noise and placing objects at local maximums of the noise (highest value in 3x3 region). That creates a layout similar to this:
The noise frequency can be changed to make plants more dispersed:
The result gives foliage like this:
Milestone 6 (09.04)
- Add more biomes
- Add some UI controls
- Make land load dynamically with movement
7 biomes in total were added, which are determined by the rainfall and temperature in the biome chunk. Their distribution(in estonian):
UI controls were added along with dynamic land loading (which can be toggled off) to easy experimenting: