• No results found

Procedural Generation of Volumetric Data for Terrain

N/A
N/A
Protected

Academic year: 2022

Share "Procedural Generation of Volumetric Data for Terrain"

Copied!
13
0
0

Loading.... (view fulltext now)

Full text

(1)

IN

DEGREE PROJECT COMPUTER SCIENCE AND ENGINEERING, SECOND CYCLE, 30 CREDITS

STOCKHOLM SWEDEN 2019,

Procedural Generation of Volumetric Data for Terrain

HENRIQUE FURTADO MACHADO

KTH ROYAL INSTITUTE OF TECHNOLOGY

SCHOOL OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

(2)

Sammanfattning

En proceduell metod har framställts för att generera volymdata för terräng-

er med hjälp av en höjdkarta samt information om terrängens material. Till

skillnad från tidigare metoder har följande nyttjat den omfattande forskningen

kring genererad terräng. Det här genom att anpassa materialens lager till ter-

rängens topologi. Metoden tillåter användaren att specifiera materialen som

stratifierade eller eroderade, vilket genereras olika: stratifierat material stap-

las och generar på så vis materialen i lager, medan eroderat material samlas

på jämn terräng. Vi jämför en termisk erosionsmetod med originellt tillväga-

gångssätt som nyttjar användarinformation om terrängens lutning som en gen-

väg till att generera eroderade lager samt presterar signifikant bättre. Fördelar

samt nackdelar med båda teknikerna utforskas och diskuteras.

(3)

Procedural Generation of Volumetric Data for Terrain

Henrique Furtado Machado

School of Electrical Engineering and Computer Science KTH Royal Institute of Technology

hfm@kth.se

Figure 1: Procedually generated volumetric material layers .

ABSTRACT

A procedural method is proposed to generate volumetric data for terrain using a surface height map and information about materials as input. In contrast to previous explored methods this approach takes advantage of the extensive research on surface terrain gener- ation by adapting the material layers to the topology of the input terrain. The method allows the user to specify materials as stratified or eroded, which are generated differently: stratified materials are stacked to generate material layers while eroded materials accumu- late on even terrain. We compare a thermal erosion method and an original approach that uses information about the slope of the terrain as a shortcut to generate eroded layers and performs signifi- cantly better. The advantages and drawbacks of each technique are explored and discussed.

KEYWORDS

procedural terrain generation, volumetric terrain, thermal erosion, procedural modelling

1 INTRODUCTION

Terrain is often an integral part of virtual applications such as games, feature film special effects and simulations. Creating land- scapes with a high level of detail can be a time consuming task for artists and developers, thus several techniques have been pro- posed to procedurally generate them. Using these techniques it is possible to randomly create expansive environments in a matter of seconds. These methods have been explored both in the field of computer graphics and procedural content generation, and can broadly be categorized as procedural-based, simulation-based or example-based methods [Galin et al. 2019].

The use of procedural generation is even more relevant for ap- plications that require volumetric terrain - terrain in which there is also information about subsurface materials - since the amount of data that has to be created is exponentially larger. The success of Minecraft1, a game in which players explore a procedurally generated virtual world that they can dig through to find caves and secrets underground shows the demand for techniques that generate volumetric terrain.

1https://www.minecraft.net/

1

(4)

Input height map User generated material information

Output terrain

Stratified layers

generation Erosion Simulation

Figure 2: Step by step of the proposed method.

In the literature, volumetric models for storing data are often used to improve surface terrain using erosion techniques [Mus- grave et al. 1989] or by adding interesting features such as arches and overhangs [Gamito and Musgrave 2001; Peytavie et al. 2009].

However, very little has been explored regarding techniques that generate volumetric material data for terrain, and the only method present in the literature produces uninteresting surface terrain [Santamaría-Ibirika et al. 2014].

In this paper a method is introduced to generate appropriate volumetric data that adapts to the topology of the surface terrain provided as input. In order to achieve these results, two different methods are proposed to generate what are referred to as eroded materials. While the stratified materials form the layers that are stacked on top of each other to create the static part of the volu- metric terrain, the eroded materials accumulate on areas with even terrain. To generate them, one of the proposed methods is a tra- ditional approach based on thermal erosion techniques, while the other is a novel technique that takes advantage of the derivatives of the terrain height to produce similar looking results with much higher efficiency.

2 RELATED WORK

The research field of procedural content generation (PCG) investi- gates the algorithmic creation of content. It aims to allow content to be generated automatically, and can therefore reduce the workload of artists and designers [Hendrikx et al. 2013]. One of the most important parts of any game is the terrain the user will traverse through and sometimes interact with while playing. PCG of ter- rain, also known as procedural modelling of terrain, is a widely researched area [Smelik et al. 2014], and has been used in several commercially successful applications, such as games and movies.

2.1 Terrain Generation

Several methods have been proposed to generate and modify terrain.

These methods generally fall into three categories: procedural tech- niques, physical simulations and example-based methods [Galin et al. 2019].

2.1.1 Procedural techniques rely on algorithms which are not trying to emulate geological processes. Commonly, these methods rely on fractal models, attempting to mimic the fractal properties

that can be observed in large-scale terrain. This is often achieved through the use of fractional Brownian motion (fBm), where the same base function is sampled with increasing frequencies and decreasing amplitudes generating the so called octaves which are then added together [Fournier et al. 1982].

The midpoint displacement and diamond-square algorithms are popular examples of base functions that are used to generate octaves for the fBm. These subdivision algorithms iteratively divide the terrain while adding random displacements on the grid that is created [Mandelbrot 1983].

Another popular option of base function for the fBm are noise functions [Lagae et al. 2010]. Since the introduction of Perlin noise [Perlin 1985], many different variations, improvements and ex- tensions have been proposed and used for terrain generation. The original Perlin noise and most of its extensions are a type of gradient noise, where the a grid of pseudo random gradients are generated and the values between them are interpolated based on the dot products of the gradients on the nearest vertices.

Procedural techniques, although powerful and easily implemented, have several drawbacks. They fail to capture some characteristics of real-world terrain, such as the structure of mountain ridges and other specific land forms. The generated terrain tends to be very repetitive and the lack of control means that the user must have technical understanding of the parameters to be able to modify the generation process in a meaningful way.

2.1.2 Physical simulations tend to focus more on modelling the systems that generate and modify the terrain then on how it will ultimately look like. The majority of simulation techniques focuses on erosion, that is, a processes that removes material from one area of the terrain and moves it to another location. These are often used to simulate the effects of rainfall, wind, water streams and time, and may be used in combination with procedural techniques in order to improve the terrain generated by them.

Hydraulic erosion aims to simulate the effects of water, usually rain, on the landscape. The most common implementation works by depositing droplets of water at random points of the terrain and allowing them to move through it while removing or depositing material in the process [Olsen 2004]. The amount eroded by droplet of water during a time step depends on its volume and the amount of sediment it is already carrying. This type of erosion tends to form steeper slopes and larger valleys.

2

(5)

Thermal erosion is another commonly used erosion technique.

The goal here is to simulate the weathering that naturally occurs on real-world terrain where material is set loose and accumulates at the bottom of steep slopes [Musgrave et al. 1989]. At each time step loose material is moved from one point to another if the height difference between them is larger than a predetermined settlement angle.

Although the most prevalent topic in research, erosion tech- niques are not the only simulation methods that have been explored.

Work has been done with the simulation of tectonic activity, by simulating the mechanics of uplift to generate mountain ranges [Cordonnier et al. 2016; Cortial et al. 2019].

2.1.3 Example-based methods opt to use existing terrain infor- mation to guide the generation process and often rely on scanned height maps called Digital Elevation Models (DEMs). Most com- monly, these methods select and deconstruct different terrain ex- emplars and blend the pieces together to form a coherent output [Zhou et al. 2007]. Most recently, machine learning approaches have been explored through the use of adversarial networks: one that generates terrain and another that guesses if an example is a generated or a real DEM [Guérin et al. 2017].

2.2 Terrain Representation

Several different models to represent and store terrain data have been used in the literature [Natali et al. 2013]. Historically there has been a trade-off between the flexibility of the model and its memory cost.

2.2.1 Height maps are the most popular model used for terrains.

They consist of a 2D discrete grid in which each cell contains the altitude at a specific point. The memory cost isO(n2) wheren is the number of divisions on the square grid. While height maps are relatively cheap and easy to use, they have drawbacks: height map representations have no volumetric information and it is impossible to represent caves and overhangs using them, which limits the possibilities of the procedural generation.

Figure 3: A common visualization of height maps where height values are encoded into a gray scale and displayed as an image. Sourced from Olsen [2004].

2.2.2 Voxels (volume pixels) offer a solution to this problem.

Instead of a 2D grid, the voxel model uses a 3D grid in which each cell contains a material index. The memory cost, however, is much

larger, and a naive implementation will requireO(n3) instead. This can be improved by using Sparse Voxel Octrees [Laine and Karras 2010] and other compression techniques [Kämpe et al. 2013], but still performs worse than height maps memory-wise. The voxel model is widely used for physical simulation techniques such as erosion, providing much better results than height maps.

2.2.3 Layer representations arose from the observation that real- world terrain is structured in stratified layers. That is, usually, there are few changes of material layers vertically. That means that it is not necessary to store a big number of voxels if they all have the same material index and come one right after the other. Instead, the model can be organized in a 2D grid of stacks which are composed of layers of materials each with their own heights. This model lends itself particularly well for erosion simulation, combining the benefits of the voxel model with the speeds that can be achieved using height-maps [Benes and Forsbach 2001]. With a memory cost ofO(mn2) wherem is the maximum possible number of material layers in a stack, the space efficiency is very close to a height map, since most of the timem is orders of magnitude smaller than n.

As proposed by Peytavie et al. [2009] this model can represent overhangs and caves by treating air as another material, and having air layers in between layers of regular materials.

Rock Sand Stone Air

Layer representation Voxel representation

Figure 4: Comparison between a cross section of the layer and a voxel representation of the same terrain. Air layers are used to represent empty space between material stacks.

Figure 4 shows a cross section of the same terrain in a layered and a voxel representation. Due to discretization of space in all dimensions, some vertical material information can be lost while using the voxel representation, while the layer representation is only horizontally discrete and can have layers of any size.

2.2.4 Subsurface geology representations are a collection of dif- ferent models for storing volumetric information about terrain that are used by geological modelling tools. These are often focused in accomodating different modelling approaches and giving the user of the tool freedom to model. An overview of these modeling techniques was compiled by Natali et al. [2013].

2.3 Volumetric Terrain Generation

All of the generation methods mentioned on section 2.1 focus on the creation of realistic looking surface terrains. The generation of volumetric data for terrain has notoriously not been explored in the literature [Galin et al. 2019]. Most uses of volumetric data for terrain generation is with the goal of improving the surface terrain through erosion or with the presence of arches and caves.

3

(6)

Gamito and Musgrave [2001] introduce a method that applies a wrapping function to height map modelled terrain to create over- hangs which are usually impossible with this representation. Pey- tavie et al. [2009] use the layer representation to create volumetric structures and simulate the settlement of debris with an approach similar to thermal erosion.

In commercial applications it is common to see the use of higher dimensional noise functions to generate volumetric structures. The problem with this approach is that 3D noise functions have no knowledge of the physical restraints of the real world, and can generate unrealistic features such as floating islands and other disconnected structures. In most cases some post-processing - such as connectivity tests - is required to ensure that the generated landscapes look realistic enough.

Another application of volumetric representation is for the gen- eration of procedural 3D cave systems. Most of the approaches involve carving a cave from a voxel representation of 3D space.

Boggus and Crawfis [2009] present a method that mimics the struc- ture of real caves by modelling acidic water erosion. Mark et al.

[2015] use a grammar-baser approach to generate cave structures and a noise meatball technique to carve out navigable paths.

Santamaría-Ibirika et al. [2014] introduced the only technique present in literature to procedurally generate volumetric terrain, focusing on the generation of individual material layers. Their approach uses designer input, where user must provide the system with information about the properties of the materials - the depth they appear on, how likely they are to blend with other materials and so on. The system then combines these material randomly taking into account the design specifications and creates layers made of these blends. The materials, however, have no physical properties and all the layers are generated through simple noise functions.

Figure 5: Resulting terrain achieved using the volumetric generation introduced by Santamaría-Ibirika et al. [2014]

The cave and vein generation is done using a midpoint displace- ment technique, where the sides of a square are subdivided and randomly displaced. This generated fractal shape is used as the horizontal contour of the cave, and the height at each point is cal- culated based on the minimum distance to a border. This is by far the most time consuming step in the process and it creates random but similar looking caves which are inserted between layers in the generation process.

The resulting topology of the surface is sub-par when compared with the state-of-the-art generation techniques, and most of the in- teresting features on it appear because a cave or vein was generated beneath it. This can be seen in figure 5: the shape of underground caves propagates to the top as layers are stacked. Because of this the mountains have roughly the same topology as the caves under- neath. Since layers are stacked on top of each other, it is impossible for any other material to appear on the surface apart from the one that forms the top layer.

3 METHODOLOGY

With the goal of expanding the possibilities for procedural genera- tion of volumetric data for terrain a top-down approach to generate material layers using pre-generated surface terrain as input is pro- posed. In contrast to the work by Santamaría-Ibirika et al. [2014], the method’s goal is to allow the user to take advantage of the expansive research that has been conducted on the procedural gen- eration of surface terrains by creating appropriate volumetric data for the provided terrain.

The pre-generated surface terrain must be in the form of a height map. The second input that must be provided by the user is the properties of the materials that will be used for the layers. The materials can be of two different kinds: stratified or eroded. The output is volumetric data appropriate to the terrain in the form of the layer model shown in section 2.2.3.

Two different methods are proposed to create the eroded ma- terial layers. The first one, referred to as the erosion method in this paper, uses a stabilization simulation technique introduced by Peytavie et al. [2009] that is very similar to thermal erosion ap- proaches explored in section 2.1.2. The second one, the slope method, is an original technique that tries to approximate the results of the erosion technique with a smaller computational overhead.

3.1 Base Surface Generation

For the purposes of testing the method a surface terrain has to be generated to serve as input. In order to simulate a typical setting where this method could be used, a Perlin noise generated height map was used. A commonly used modification to the noise was performed by elevating the noise values to the power of four to create flatter valleys and steeper mountains as shown in figure 6.

Figure 6: Examples of surface terrain generated using the modified Perlin noise.

4

(7)

3.2 Materials

One of the inputs the user must give to the algorithm is the infor- mation about the materials that are going to be part of the layered terrain. These materials can either be stratified or eroded.

3.2.1 Stratified materials are trying to simulate the naturally observed phenomena of sedimentary rock or soil settling to create distinct layers on the earth’s crust. For these materials the user must input the following properties:

•Depth: The depth at which the material appears.

•Thickness: The average size of the layer that this material tends to form.

•Roughness: The amount of variation on the layer’s thick- ness.

3.2.2 Eroded materials on the other hand, are simulating loose materials such as dirt, sand and gravel that will not accumulate on steep hills, but will settle on flat areas and valleys. The generation of these material layers will adapt itself to the provided terrain and create realistic looking granular accumulation. For these materials the following properties are required:

•Weight: This is used to the determine the ordering of the material layers.

•Thickness: The amount of eroded material.

•Angle of repose: The angle at which the material stabilizes.

•Maximum slope: The maximum steepness of a slope in which the eroded material will appear. This value is only used on the slope method.

3.2.3 Resolution. is the final input the user must provide the al- gorithm. Since the method is designed to be resolution independent the values for the material’s thickness and depth will be propor- tional to the resolution. In practice this means that a material stack of height 0.5 will be 150 units high if the resolution is 300x300, and 50 units high if the resolution is 200x200. This allows for the generation of the same terrain in any size desired, as shown in figure 7.

(1) (2)

Figure 7: The same terrain with different resolutions:

400x400 (1) and 100x100 (2).

3.3 Slope

Consider the following definition of slopesi, jthat will be used in this method:

si, j = max(|hi, j−hi −1, j−1|, |hi, j−hi −1, j|,

|hi, j−hi −1, j+1|, |hi, j−hi, j−1|,

|hi, j−hi, j+1|, |hi, j−hi+1, j−1|,

|hi, j−hi+1, j|, |hi, j−hi+1, j+1|)

(1)

That is, the greatest height difference between a material stack and its eight neighbours wherehi, jis the height of the stacki, j.

3.4 Layer Generation

The layer generation is based on the information provided by the user for the stratified materials. First, the algorithm chooses the material for the new layer. If this is the first layer, this will be the material with the largest depth property. Otherwise, the chosen material will be the one whose property is closest to the current depth on the generation process.

Starting Height Map First Layer

Second Layer Third Layer

Figure 8: Layer generation process where material layers are stacked on top of each other until the starting height is reached

Next, the algorithm generates the layer physically. This is done through the use of fBm Perlin noise. The roughness property of the material influences the frequency of the noise. This process is repeated for each material layer. As can be seen in figure 8, once the stack of material surpasses the height of the starting height map for that point, the final layers’ surplus material is removed and the generation algorithm will no longer add material to that stack.

Once all stacks get to this point the process is done.

3.5 Erosion Method

The first proposed method to generate eroded material layers is based on a stabilization simulation model [Peytavie et al. 2009] that is very similar to erosion simulations. The main difference between the two is the presence of stable material layers. While in erosion

5

(8)

Figure 9: Effects of increasing the roughness of all material layers

methods there is usually no distinction between different kinds of materials, the stabilization simulation considers some materials stable and only loose materials are allowed to move and settle. In the context of the proposed method, the stratified materials are stable and the eroded materials are loose.

The first step in the process is to erode material from the static stratified layers. The amount of material that is set loose is pro- portional to the thickness parameter defined by the user for the material. This means that this method will alter the surface terrain by changing the highest parts of the material stacks into eroded material and moving them if necessary.

After materials are set loose, they are ordered based on their weight parameter. The heaviest materials are transferred to the bottom of the stack. This is done because the simulation of multiple granular materials blending and interacting is extremely challeng- ing, so ordering and separating them simplifies the algorithm by allowing the use of a single angle of repose for each material while still producing satisfactory results. If there are multiple layers of the same material, these are merged together.

Before ordering Ordered stacks

Figure 10: Material layers being merged and ordered on the erosion method.

The next step in the algorithm is to simulate the movement of material. For each stack, part of a material layer will be moved to neighbouring stacks in case the angle between them is larger than the angle of repose. The layers are moved from the bottom to the top, starting off with the heaviest materials. This process is repeated until there is no unstable stacks with material that should be moved. Figure 11 shows the resulting terrain on a very small example-case. It is clear to see the effects of the difference in the angle of repose between the two different materials.

Considerhithe height of material stacki. Material will be moved from stacki if the height difference ∆h between it and any of its neighbouring stacks is larger than tanα where α is the angle of

Unstable material Settled material

Figure 11: The starting and ending state of material being stabilized on the erosion method.

repose of the material being moved. The amount of material moved with each time step is set to a small constantc. This is done in order to avoid oscillations on the algorithm, where material is moved endlessly back and forth between two neighbouring stacks. Material is moved until the angle between a stack and all of its neighbours is smaller than the angle of repose.

i − 1 i i + 1 hi

∆hi −1

α tanα

i − 1 i i + 1

hi tanα

α

Figure 12: Material stacks before and after stabilization on the erosion method.

The moved material is divided between all neighbouring stacks where each stack receives an amountm proportional to a weighted average of their height difference, that is, more material will be moved to stacks that have a larger∆h. For stack i:

mi = c ∆hi

Í8

k=1∆hk (2)

3.6 Slope Method

The slope at a certain point on the terrain can be calculated by obtaining the derivatives of the height values on a height map.

These values are commonly used in rendering to apply appropriate textures to the mesh of a generated terrain. Points with a high derivative value will be mapped to a stone texture while flat areas are mapped to grass, with blending in the transition regions.

Observing the results of the erosion method it is clear that sedi- mentary material tends to accumulate on valleys and flatter areas.

Because of this, the slope of the terrain can serve as a shortcut to generate material layers. In contrast with the texturing however, derivative values aren’t enough on their own. The very top of a mountain can have the same slope as a flat area in the middle of a valley, but the sediment accumulation on both of these would not be the same.

6

(9)

The first step of the algorithm is to go through the height map and create an analogous slope map using the computation shown in equation 1. Then, the starting heightshi for the material stacks are calculated:

hi =

 si > S : 0

si ≤S : tS −sSi (3)

WhereS and t are the maximum slope and the thickness proper- ties set by the user andsiis the corresponding value on the slope map for stacki. In practice, this will only generate material at points where the slope is smaller thanS, and hi will increase in value as the slope increases, getting to its maximum thickness when the slope is equal to zero.

The following step is a simplified and inverted version of the stabilization simulation explored in section 3.5. Instead of being stacked on top of the stratified layers, the eroded material layers are inserted into the top of the material stack and a part of the static layers are removed to make place for them.

The stabilization simulation is used to calculate the heights of the material stacks, but no material is moved throughout the process.

Instead material is just removed, until there are no neighbouring stacks with the height difference angle greater then the angle of repose.

Starting heights Stable stacks

Figure 13: On the slope method material is removed from the starting stacks to achieve the angle of repose shown by the dark dotted lines.

The lack of material movement cuts down the algorithm’s com- putation time by avoiding cases where some material will have to be moved all the way down from a mountain. It also means that cases where oscillations might happen are impossible, and thus the need for a constant amount of material to be moved is unnecessary.

Instead, the algorithm removes the amount required for the stack to achieve the angle of repose with the smallest neighbour, even if the height difference between them is very large.

Points wheresi > S have no material. This means that its neigh- bouring stacks that do have material will always have an amount smaller than tanα, ensuring a smooth transition between stacks that contain the eroded material and ones that do not. The thickness will only grow if the current stack has a large enough slope and does not have any neighbours that lack eroded material.

i

i − 1 i + 1

hi

∆hi −1 α tanα

α

i − 1 i i + 1 hi

tanα α

Figure 14: Material stacks before and after the removal of material on the slope method.

3.7 Voxel representation

For these methods to be rendered it was necessary to transform the stack representation of the terrain into a voxel representation.

This is not necessary for all applications, but it is by far the most computationally intensive part of the process, if required. In order to generate visualizations in a reasonable time the process was par- allelized by dividing the terrain into smaller chunks and converting each chunk separately on the GPU.

4 RESULTS

The methods were implemented using C++ and tests were per- formed on an Intel Core i5-8400 CPU clocked at 2.80GHz and equiped with 24 GB of RAM. All of the results shown in the images on this paper were rendered using the MagicaVoxel2, a application used for modelling and visualizing voxel models.

4.1 Visual

Figure 16 shows comparisons between the results obtained by the method using both techniques used to generate erosion layers on the same input terrain.

The stratified material layer generation produced the expected visual results. As shown by Santamaría-Ibirika et al. [2014] material layers are present in real-world terrain and the method proposed here achieves very similar results to the ones obtained by them.

This means that, while this method does not generate simulations of real terrain and does not achieve the breadth of variety seen in them, it does show some similarities such as stacked layers and the propagation of folds over several layers (figure 9).

Both methods used to generate eroded layers produced realistic looking results, although differing slightly. The goal of having loose material accumulate on flat areas and not appear on steep hills and mountain was achieved, producing reasonable looking material accumulation. On the erosion method the eroded layer tends to be thinner in really flat areas while sediment accumulation on the bases of mountains is more prominent. The erosion method also shows less accumulation on the high flat areas such as mountains tops and hills, but this can be adjusted by tinkering with the material properties.

2https://ephtracy.github.io/

7

(10)

4.2 Performance

The thermal erosion algorithm was not designed to be executed online [Jákó and Tóth 2011; Musgrave et al. 1989], that is, fast enough that a user could execute it on their computer and obtain results in a timely fashion. Fastest computation can be achieved by considering only half the neighbours when transferring material.

This will half the number of checks done during execution. Both the Von Neumann and the modified Von Neumann neighbourhood can be used (figure 15), with the latter having a slight performance edge Olsen [2004].

Von Neumann hi, j hi −1, j

hi, j+1

hi, j−1

hi+1, j

Modified Von Neumann hi, j

hi −1, j+1 hi+1, j+1

hi −1, j−1 hi+1, j−1

Figure 15: Different neighbourhoods can be used to achieve faster results with minimal quality loss.

However, thanks to recent hardware developments, there has been work done on techniques to execute fast erosion methods on the GPU [Jákó and Tóth 2011; Mei et al. 2007]. In the case of thermal erosion, it is possible to execute each material stack independent of the others by using virtual pipes to avoid write dependency. These virtual pipes store the material to be transferred to each stack and, once an iteration is done, the material is transferred all at once.

While these modifications allow erosion techniques to be run in real-time, they were out of the scope of this paper and were not implemented. The time comparisons, however, are still valid, since both techniques could benefit from them.

Table 1 shows the steep increase in computation time for both methods as the size of the generated terrain increases. For each different terrain size, twenty different tests were performed, using random seeds. The slope method proposed in this paper performs significantly better than the traditional erosion technique, especially for larger terrain sizes.

5 DISCUSSION

The performance results presented in the previous section shows that the slope method outperforms the traditional erosion approach.

This does not mean, however, that there are no reasons to use it.

These reasons will be explored in this section, along with compar- isons with other methods in literature and an example of a relevant use case for the generated terrains.

5.1 Physical simulation

While the results achieved by the slope method closely resemble the ones generated using the erosion technique, one fundamental difference between them is that the latter is trying to simulate a

Table 1: Average computation time by size of terrain gener- ated

Resolution Erosion Method Slope Method

(s) (s)

50x50 1.003 ± 0.295 0.186 ± 0.018 75x75 3.093 ± 0.966 0.499 ± 0.048 100x100 7.922 ± 2.456 1.015 ± 0.111 125x125 16.87 ± 7.865 1.784 ± 0.198 150x150 25.52 ± 8.941 2.868 ± 0.346 175x175 42.41 ± 16.81 4.349 ± 0.554 200x200 53.61 ± 18.37 6.213 ± 0.944

physical phenomena. This is one of the main reasons why the ero- sion method does not have great performance. The slope technique created good results through several conceits that do not aim to model any kind of real-world occurence so it should not be used if the goal is to approximate real-world thermal erosion as closely as possible.

5.2 Input alteration

The erosion method modifies the input terrain by removing material from mountains and moving it down. This method has historically been used to improve procedurally generated terrain, so there is value in using it to augment the generation process and produce better looking terrain. If erosion is already being used, then there is no reason to compute the eroded materials using another method.

On the other hand, if the goal is to not change terrain but to generate suitable volumetric data, the slope method is the clear choice as it can be combined with any other surface generation technique.

5.3 Endless terrain

One of the main problems with the thermal erosion methods is how they behave at the edges of terrain. This is critical for applications, such as games, that might need to create endless landscapes. Usually, game developers generate individual chunks of terrain on demand as the player moves through it, since generating it entirely from the start would be impossible. This is a problem for terrains generated using erosion techniques due to the uncertainty on how to behave at the edges of the map where there is incomplete information about the neighbourhood, as shown in figure 17. While the slope method may also suffer from this problem, the effects of it are much less stark. Since the surface geography is not altered, the terrain will still fit together seamlessly. Some anomalies may still happen in the connections between the subsurface layers, but those will be much less daunting, since mismatches on the surface terrain might generate impossible looking landscapes.

5.4 Comparison to other methods

The only other method proposed in literature to generate volumetric material data for terrain is the work done by Santamaría-Ibirika et al. [2014]. In their method, surface terrain is generated as the resulting topology of the top-most layer. This is a major difference in comparison to the method proposed in this paper since it uses surface terrain as input.

8

(11)

(1)

(2)

Figure 16: Comparison between the results for the slope method (1) and the erosion method (2) for the same surface terrain.

Figure 17: Example of material accumulation at the edge of a chunk. Material piles up because it can’t move outside of the boundaries. This might cause mismatches with adjacent chunks.

This method is also capable of generating terrain that can have several different stratified layers protruding from mountains and cliffs, an effect that can be observed in real life and is impossible to achieve using simple layer stacking. The creation of eroded layers provides the greatest improvement in regards to both the realism and look of the generated terrain.

It is difficult to compare both methods in terms of computational complexity. In their method, the most time consuming feature is the

creation of caves and veins, and computation time increases rapidly as the number and size of these features rise. The choice of number of caves to be generated in test cases would greatly influence this comparison. Perhaps it would be fair to consider the case where no caves or veins are created, since the method proposed in this paper lacks these features, but as discussed in section 2.3, these are extremely important for the topology of the resulting surface terrain on their method.

5.5 Use case

A major problem with the current graphics pipeline based on tri- angle meshes is that there is no volumetric data associated with objects. Meshes only model the surfaces, which means that objects are essentially hollow. This can be a great challenge for games that want to have destructible objects and surfaces, as they often have to rely on having objects made up of different chunks that can be disassembled. This means that a lot of work has to go into creating each of the destructible objects, and leads to situations where the player is able to destroy and interact with some objects in the game but not others, detracting from their immersion.

While the rendering of a lot of very small voxels was previously impossible due to memory restrictions, recent advancements in hardware have sparked the development of voxel-based engines, which forgo triangle meshes entirely and focus on rendering objects made up of voxels which have inherent volumetric data making it

9

(12)

much easier to change and remove parts. This voxel approach also lends itself very well to terrain generation. As mentioned before in section 2.2, a lot of the terrain PCG techniques voxilize the space. The use of voxel engines avoids having to transform that information into meshes.

One of the goals of the work done in this paper is for future use in a game made in a voxel engine. Volumetric terrain lends itself very well to applications where the user can dig and destroy the environment.

6 FUTURE WORK

As mentioned in section 3.1 and shown in figure 6, the surface terrain used to test the algorithm is a modification of Perlin noise.

While this is probably one of the most used techniques for terrain generation, it would be important to explore how the algorithms perform with input terrain created by other techniques. It would also be interesting to see how the eroded material layers differ when using other erosion methods instead of thermal erosion. This method would also work in combination with hydraulic erosion.

In section 2.3 the work in the literature regarding the use of volumetric models to generate caves was explored. Since most of the methods involve carving a 3D voxel representation, they can be combined with the presented method in order to create more interesting subsurface geology. Combining the creation of caves with the layer generation process could also produce interesting results and augment the method.

Finally, because of the nature of noise methods, the stratified layer generation tends to produce repetitive results. One way to increase their unpredictability is to add tectonic plate simulation to break them apart and move them. By detecting the presence of mountains it might be possible to the simulate the tectonic activity that could have led to the formation of the detected mountain range, such as tectonic plate collisions.

7 CONCLUSION

The method proposed in this paper expands on the scarcely re- searched field of volumetric procedural terrain generation. An orig- inal approach to generate eroded material layers that closely re- semble the ones created by thermal erosion was presented. This method was shown to be efficient when compared to a common im- plementation of settlement simulation inspired by thermal erosion.

The introduction of eroded material layers added to the real- ism and the look of the output terrain, and achieved the goal of having material accumulation on areas of low incline. The results obtained by the method were discussed and compared with a previ- ous method present in the literature.

ACKNOWLEDGMENTS

This thesis was done in association with Resolution Games3. I would like to thank my supervisor at the Royal Institute of Technol- ogy in Stockholm Björn Thuresson, my examiner Tino Weinkauf as well as my supervisor at Resolution Games Björn Englesson.

3https://www.resolutiongames.com

REFERENCES

Bedrich Benes and Rafael Forsbach. 2001. Layered data representation for visual simulation of terrain erosion. In Proceedings Spring Conference on Computer Graphics.

IEEE, 80–86.

Matt Boggus and Roger Crawfis. 2009. Procedural creation of 3d solution cave mod- els. In Proceedings of the 20th IASTED International Conference on Modelling and Simulation. 180–186.

Guillaume Cordonnier, Jean Braun, Marie-Paule Cani, Bedrich Benes, Eric Galin, Adrien Peytavie, and Eric Guérin. 2016. Large scale terrain generation from tectonic uplift and fluvial erosion. In Computer Graphics Forum, Vol. 35. Wiley Online Library, 165–175.

Yann Cortial, Adrien Peytavie, Eric Galin, and Eric GuÃľrin. 2019. Procedural Tectonic Planets. Computer Graphics Forum (2019). https://doi.org/10.1111/cgf.13614 Alain Fournier, Don Fussell, and Loren Carpenter. 1982. Computer rendering of

stochastic models. Commun. ACM 25, 6 (1982), 371–384.

Eric Galin, Eric Guérin, Adrien Peytavie, Guillaume Cordonnier, Marie-Paule Cani, Bedrich Benes, and James Gain. 2019. A Review of Digital Terrain Modeling. (2019).

Manuel N Gamito and F Kenton Musgrave. 2001. Procedural landscapes with overhangs.

In 10th Portuguese Computer Graphics Meeting, Vol. 2.

Eric Guérin, Julie Digne, Eric Galin, Adrien Peytavie, Christian Wolf, Bedrich Benes, and Benoît Martinez. 2017. Interactive example-based terrain authoring with conditional generative adversarial networks. Acm Transactions on Graphics (TOG) 36, 6 (2017), 228.

Mark Hendrikx, Sebastiaan Meijer, Joeri Van Der Velden, and Alexandru Iosup. 2013.

Procedural content generation for games: A survey. ACM Transactions on Multime- dia Computing, Communications, and Applications (TOMM) 9, 1 (2013), 1.

Balázs Jákó and Balázs Tóth. 2011. Fast Hydraulic and Thermal Erosion on GPU.. In Eurographics (Short Papers). 57–60.

Viktor Kämpe, Erik Sintorn, and Ulf Assarsson. 2013. High resolution sparse voxel DAGs. ACM Transactions on Graphics (TOG) 32, 4 (2013), 101.

Ares Lagae, Sylvain Lefebvre, Rob Cook, Tony DeRose, George Drettakis, David S Ebert, John P Lewis, Ken Perlin, and Matthias Zwicker. 2010. A survey of procedural noise functions. In Computer Graphics Forum, Vol. 29. Wiley Online Library, 2579–2600.

Samuli Laine and Tero Karras. 2010. Efficient sparse voxel octrees. IEEE Transactions on Visualization and Computer Graphics 17, 8 (2010), 1048–1059.

Benoit B Mandelbrot. 1983. The fractal geometry of nature. Vol. 173. WH freeman New York.

Benjamin Mark, Tudor Berechet, Tobias Mahlmann, and Julian Togelius. 2015. Proce- dural Generation of 3D Caves for Games on the GPU.. In FDG.

Xing Mei, Philippe Decaudin, and Bao-Gang Hu. 2007. Fast hydraulic erosion simu- lation and visualization on GPU. In 15th Pacific Conference on Computer Graphics and Applications (PG’07). IEEE, 47–56.

F Kenton Musgrave, Craig E Kolb, and Robert S Mace. 1989. The synthesis and rendering of eroded fractal terrains. In ACM Siggraph Computer Graphics, Vol. 23.

ACM, 41–50.

Mattia Natali, Endre M Lidal, Julius Parulek, Ivan Viola, and Daniel Patel. 2013. Model- ing Terrains and Subsurface Geology.. In Eurographics (STARs). 155–173.

Jacob Olsen. 2004. Realtime procedural terrain generation. (2004).

Ken Perlin. 1985. An image synthesizer. ACM Siggraph Computer Graphics 19, 3 (1985), 287–296.

Adrien Peytavie, Eric Galin, Jérôme Grosjean, and Stéphane Mérillou. 2009. Arches: a framework for modeling complex terrains. In Computer Graphics Forum, Vol. 28.

Wiley Online Library, 457–467.

Aitor Santamaría-Ibirika, Xabier Cantero, Mikel Salazar, Jaime Devesa, Igor Santos, Sergio Huerta, and Pablo G Bringas. 2014. Procedural approach to volumetric terrain generation. The Visual Computer 30, 9 (2014), 997–1007.

Ruben M Smelik, Tim Tutenel, Rafael Bidarra, and Bedrich Benes. 2014. A survey on procedural modelling for virtual worlds. In Computer Graphics Forum, Vol. 33.

Wiley Online Library, 31–50.

Howard Zhou, Jie Sun, Greg Turk, and James M Rehg. 2007. Terrain synthesis from digital elevation models. IEEE transactions on visualization and computer graphics 13, 4 (2007), 834–848.

10

(13)

www.kth.se TRITA-EECS-EX-2019:439

References

Related documents

Volumetric Data Using Illumination and Transfer Functions. Linköping Studies in Science and Technology,

This thesis will explore a subset of the PG technique called Search Based Procedural Content Generation (SBPCG) and how it can be used as a tool to create levels for games.. The aim

48 procent flickor som deltog under Dream action day, var det endast en fjärdedel av de som svarat ”Ja, absolut” på frågan om de kommer fortsätta åka snowboard som var flickor..

Det är viktigt att poängtera att det i detta fall inte är flyktingarna i sig som konstruerar ett hot mot betydande värden utan själva påfrestningen som EU:s hela system ställs

We have studied the conceptions of children and nursery school teachers of how investigative interviews should be conducted, the occurrence of role behaviors in the interviews,

R2 : - Ja vi pratade ju med Namn från MRS och hon påpekade också det att det vore bra att ha något, för de får också väldigt tunga modeller när de ska göra kataloger och

The image synthesis pipeline is based on procedural world modeling and state-of-the-art light transport simulation using path tracing techniques. In conclusion, when analyzing

This thesis focuses on the optimization of decellularization strategies for blood vessels such as porcine vena cava, to determine the optimal decellularization protocol (Paper I)