Terrain Generator
Language: C++, Middleware: OpenGL, QT
Overview of the project
Motivation
- How to create or modify massive virtual world like that in Skyrim.
Problem which I had
- Generating large terrain can be labour intensive and monotonous works so that the terrain needs to be procedurally generated. When it comes to modification of terrain, it can be even more demanding task to get natural outcome since modified parts should get along with their adjacent parts, for example, moving mountain to other location.
Which features are included in this project
- Drag and drop: Mountains can be moved as the user drags them.
- Mountain creation: Mountain can be added with simple interface.
- Ridge creation: Ridges can be generated with simple drawing tool.
- Re-generating target area: Selected area can be re-generated and its shape has to be similar to the rest of area.
- Texture transfer: Texture of terrain can be switched to that of other terrain, but the shape of terrain should be same.
How to solve the problem
- Used various texture synthesis algorithms onto the height map of terrain such as patch-based hole filling, boundary matching, Gaussian Pyramid texture transfer and Poisson solver.
Limitation
- The system works very well if the height map has stochastic features (such as Fractal or Perlin noise terrains), but the system can fail when the texture of height map has structured features (such as urban area).
Detail of the project
1. Introduction
The rendering of terrain by people requires an enormous amount of time and labour. In early video games, users were satisfied when their avatars stayed in the small virtual world which can be seen in computer screen at a time. Today, users’ expectations for virtual worlds are too high to satisfy with small world. For this reason, the terrain in virtual worlds is larger than ever before. For example, if the size of the map in World of Warcraft is converted into real world measurements, its size would be equivalent to 146 Hyde Parks in London .
This project focused on local modification of the terrain in order to reduce manual work by users and produce variations in the output terrain. The project mainly aims at local modifications because, according to the artists we met with, creating geological features on the desired area is a tedious task. To achieve this task, we defined possible local modifications that can be useful for artists. These were narrowed down to ridge/peak generation, transferring detailed texture of the geological features and regenerating similar, but new, texture for the area.
Image from http://www.giantbomb.com/profile/aperturesilence/blog/a-relative-size-comparison-of-game-world-maps-fasc/49712/
1. Introduction
The rendering of terrain by people requires an enormous amount of time and labour. In early video games, users were satisfied when their avatars stayed in the small virtual world which can be seen in computer screen at a time. Today, users’ expectations for virtual worlds are too high to satisfy with small world. For this reason, the terrain in virtual worlds is larger than ever before. For example, if the size of the map in World of Warcraft is converted into real world measurements, its size would be equivalent to 146 Hyde Parks in London .
This project focused on local modification of the terrain in order to reduce manual work by users and produce variations in the output terrain. The project mainly aims at local modifications because, according to the artists we met with, creating geological features on the desired area is a tedious task. To achieve this task, we defined possible local modifications that can be useful for artists. These were narrowed down to ridge/peak generation, transferring detailed texture of the geological features and regenerating similar, but new, texture for the area.
Image from http://www.giantbomb.com/profile/aperturesilence/blog/a-relative-size-comparison-of-game-world-maps-fasc/49712/
2. System Structure and Layout
This project focused on terrain modification by the user. So the system should provide local modifications of terrain such as drag and drop, peak/ridge generation and texture transfer and trace all user modifications. In this case, the input and output data of the system is height map. Following diagram is operation flow of the system.
This project focused on terrain modification by the user. So the system should provide local modifications of terrain such as drag and drop, peak/ridge generation and texture transfer and trace all user modifications. In this case, the input and output data of the system is height map. Following diagram is operation flow of the system.
The system consists of several sub-windows like Photoshop to display function windows, which are using at the moment. So the user can only focus on target function. Following image shows the layout of the system.
< 1. main window, 2. 3. 4. sub-windows, 5. function tool bar >
< 1. main window, 2. 3. 4. sub-windows, 5. function tool bar >
3. Terrain Regeneration
Randomizing terrain is one of the key features in the initial stages of this project, because it is quite tedious work in terrain design. Users simply want to change the target area without creating any visible flaws. For terrain randomization, the texture hole filling approach can be applied because it generates a target area from the information outside the hole under the boundary constraints for seamlessness.
Doing so, the system can create random terrain on selected area without any visible flaw.
Randomizing terrain is one of the key features in the initial stages of this project, because it is quite tedious work in terrain design. Users simply want to change the target area without creating any visible flaws. For terrain randomization, the texture hole filling approach can be applied because it generates a target area from the information outside the hole under the boundary constraints for seamlessness.
Doing so, the system can create random terrain on selected area without any visible flaw.
4. Peak / Ridge Generation
In many 3D modification tools, such as Z-Brush and Unity, mountains are generated as elevating and carving of the original height field to produce a satisfying result. Making each ridge different can be a daunting task. Creating mountains on the existing height field can produce more problems than generating an entire terrain because its texture has to be matched to the existing one.
Mountains can be created using peak tool as given height and location of the peak by user. The shape of the mountains can be determined using this tool. Left side of tool is top view of the mountain which is used to decide the location of the peak and right side is side view of the mountain which is used to design shape of mountain.
Ridges are created by following steps. Sketch the ridge line onto the height field viewer.
1. Determine the height of the ridge line.
2. Synthesize the mountain ridge from the skeleton.
1. Determine the height of the ridge line.
2. Synthesize the mountain ridge from the skeleton.
Following image is the result of ridge generation.
5. Drag and Drop of the geological features
Users or artists may need to generate certain shapes of terrain repeatedly. To meet this need, the system is able to reproduce terrain with a simple user interface, such as the drag and drop style.
Copy and paste of terrain is not available because the boundary of copied terrain does not match to that of existing terrain. To achieve this task, only the gradient of height value is transferred rather height value itself. The gradient tells us the characteristics of terrain such as ruggedness. Doing so, we can transfer the feature of the terrain while we preserve the height of original terrain.
6. Texture Transfer
The terrain texture transfer is designed to solve two issues: making the terrain have a rich texture or a different texture from original. First, when a user generates mountains or ridges on the terrain with a rich texture, the system is able to create natural mountains or ridges. However, if there is not enough texture, the results will be awkward. Secondly, a user may want to change texture to another one from a different height field to make the terrain dynamic. The texture transfer control panel helps a user copy or transfer the desired texture from other height fields.
The image above shows the first case and the image below shows the second case.
The terrain texture transfer is designed to solve two issues: making the terrain have a rich texture or a different texture from original. First, when a user generates mountains or ridges on the terrain with a rich texture, the system is able to create natural mountains or ridges. However, if there is not enough texture, the results will be awkward. Secondly, a user may want to change texture to another one from a different height field to make the terrain dynamic. The texture transfer control panel helps a user copy or transfer the desired texture from other height fields.
The image above shows the first case and the image below shows the second case.