Generation and Visualization of Terrain in Virtual Environment

Generation and Visualization of Terrain in Virtual Environment

MASARYK UNIVERSITY FACULTY}w¡¢£¤¥¦§¨ OF I !"#$%&'()+,-./012345<yA|NFORMATICS Generation and Visualization of Terrain in Virtual Environment BACHELOR THESIS Rastislav Tisovˇcík Brno, 2012 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. Rastislav Tisovˇcík Advisor: Mgr. JiˇríChmelík ii Acknowledgement First of all, I would like to thank my advisor JiˇríChmelík for his price- less comments and remarks during the work on this thesis. I’d also like to thank my consultant Martin Bezdˇekaand all members of HCI laboratory for their most valuable advice. Last but not least I would like to thank my family and friends for their continual support during my work on this thesis. I wouldn’t be able to complete this thesis without you, hence thank you once again. iii Abstract The aim of this thesis is to examine several frequently used algo- rithms which can be used to generate terrain data which resemble natural terrain surfaces. These algorithms are described along with certain concepts needed for their visualization, especially with meth- ods of storage of terrain data in memory. The implementation part introduces the Terrain ability, a new part of the VRECKO framework which allows users to generate and ren- der highly customizable terrain surfaces using one of the three de- scribed algorithms. iv Keywords terrain generation, terrain visualization, VRECKO, OpenSceneGraph, Perlin noise, midpoint displacement, random faults, fractional Brow- nian motion v Contents 1 Introduction ............................1 2 Terrain in computer graphics ..................2 2.1 Terrain vs. landscape ....................2 2.1.1 Terrain . .2 2.1.2 Landscape . .2 2.2 Purpose in the scene ....................3 2.3 Obtaining the terrain data .................3 2.3.1 Terrain scanning . .3 2.3.2 Terrain modeling . .4 2.3.3 Generating the terrain . .4 2.3.4 Combination of previous approaches . .5 2.4 Notable uses .........................5 2.4.1 Alien (1979) . .5 2.4.2 Tron (1982) . .5 2.4.3 Landscape generation software . .6 2.4.4 Video games . .7 2.4.5 Navigation . .8 3 Visualisation of terrain .....................9 3.1 Internal representation ...................9 3.1.1 Polygon mesh . .9 3.1.2 Streaming mesh . 12 3.1.3 Voxels . 12 3.1.4 Combination . 13 3.2 Texturing ........................... 13 3.3 Environment ......................... 13 4 Generation of terrain surface .................. 15 4.1 Categorization ........................ 15 4.2 Fractals ............................ 15 4.2.1 Self-similarity . 16 4.2.2 Fractal dimension . 16 4.3 Stochastic values ...................... 17 4.3.1 Random vs. pseudo-random number generator 17 4.3.2 Uniform distribution . 18 4.3.3 Normal distribution . 18 5 Terrain generation algorithms ................. 20 vi 5.1 Fractional Brownian surface ................ 20 5.1.1 Brownian motion . 20 5.1.2 Fractional Brownian motion . 20 5.1.3 Two-dimensional fractional Brownian motion . 22 5.2 Midpoint displacement ................... 23 5.2.1 Midpoint displacement in 1D . 24 5.2.2 Midpoint displacement in 2D . 24 5.2.3 Pseudo-random error value . 26 5.2.4 Time complexity . 27 5.2.5 Advantages and disadvantages . 27 5.3 Random faults ........................ 28 5.3.1 Basic principle . 28 5.3.2 Decreasing the fault value . 29 5.3.3 Smoothing . 30 5.3.4 Modifications . 30 5.3.5 Time complexity . 32 5.3.6 Advantages and disadvantages . 32 5.4 Perlin noise ......................... 32 5.4.1 Basic principle . 32 5.4.2 Coherent vs. non-coherent noise . 33 5.4.3 Gradient and permutations table . 34 5.4.4 Perlin noise function in 2D . 34 5.4.5 Composition of multiple Perlin noise textures . 34 5.4.6 Time complexity . 35 5.4.7 Advantages and disadvantages . 36 6 Implementation in VRECKO .................. 37 6.1 VRECKO ........................... 37 6.2 Nature plug-in and Terrain ability ............. 37 6.3 Features of Terrain ability .................. 38 6.3.1 Terrain segmentation . 38 6.4 Software design ....................... 39 6.4.1 Initialization of the ability . 41 6.4.2 Terrain properties . 41 6.4.3 Structure of the ability . 41 6.4.4 Terrain generation algorithms . 42 6.4.5 Utility classes . 42 7 Conclusion ............................. 43 A Description of XML parameters of Terrain ability ...... 48 vii A.1 General ............................ 48 A.2 Main structure of XML ................... 48 A.3 Common XML parameters ................. 49 A.4 Heightmap XML parameters ............... 50 A.5 Algorithm XML parameters ................ 51 A.5.1 Midpoint displacement XML parameters . 52 A.5.2 Random faults XML parameters . 53 A.5.3 Perlin noise XML parameters . 54 B Description of Terrain ability menus ............. 56 B.1 Empty scene menu ..................... 56 B.1.1 Terrain dimensions submenu . 56 B.1.2 Midpoint displacement submenu . 57 B.1.3 Random faults submenu . 58 B.1.4 Perlin noise submenu . 58 B.1.5 Import from heightmap submenu . 59 B.2 Menu for scene containing terrain ............ 60 B.2.1 View submenu . 61 B.2.2 Export to submenu . 62 C Gallery ............................... 63 C.1 Terrain rendered in VRECKO ............... 63 C.2 Terrain rendered by Cinema 4D .............. 65 D Content of the CD ........................ 69 viii 1 Introduction One of the main goals in the field of computer graphics has always been the continual effort to visualize the given scene as realistic as possible. Since most of the scenes model the real-life world, they are very likely to contain some sort of landscape or terrain unless they visualize e.g. building interiors or world at molecular level. However, in case a suitable data source for the terrain is not avail- able or we are limited by computer‘s memory, it is the right oppor- tunity to generate our own terrain surface with the help of a terrain generation algorithm. One of our options is to simulate physical laws but this technique is too performance demanding and is not part of this thesis. There- fore, we are going to study group of algorithms which approximate surfaces which resemble natural terrain. Several of these algorithms are then implemented in a new Ter- rain ability of the VRECKO framework. The second chapter explains the basic concepts related to terrain and its part in computer graphics while the following chapter deals with its visualisation, especially with ways to internally store and handle terrain data. The fourth chapter presents a basic introduction to different fields such as fractal theory and random number generation which are cru- cially needed in terrain generation. The next chapter utilizes this the- ory to present several existing algorithms which are commonly used for terrain generation and states their basic description. The sixth chapter contains details about implementation of the Terrain ability in the VRECKO framework. The final seventh chapter concludes the whole work, summarizes its results and contemplates the future development of the Terrain ability. Appendix A contains a description of XML parameters of the Ter- rain ability. The following appendix B describes contents of the menu coupled with the ability in VRECKO‘s application environment. Fi- nally, appendices C and D contain an image gallery with renders of terrain generated by Terrain ability and content of the CD, respec- tively. 1 2 Terrain in computer graphics 2.1 Terrain vs. landscape It is first necessary to introduce two basic concepts for the purpose of this thesis – terrain and landscape. 2.1.1 Terrain Terrain (or land relief) is usually perceived as "The physical shape, con- figuration or general unevenness of a (...) surface, considered with reference to variation of height and slope or to irregularities of the land surface" [1]. These properties are usually depicted in a form of two-dimensional images or three-dimensional models, which describe a selected area of land surface as can be seen on image 2.1. Figure 2.1: 2D relief image of Sierra Nevada (left) and 3D relief model of High Tatras (right). Source: [27, 15] 2.1.2 Landscape On the other hand, landscape is a composition of an area of land together with other natural and living entities. Among these are water surfaces (e.g. rivers, lakes, seas and oceans) and vegetation (e.g. grass and trees) but also manmade structures. Since various definitions differ, weather and lighting conditions are sometimes also taken into the account as a part of the landscape. 2 2. TERRAIN IN COMPUTER GRAPHICS However, as is significantly pointed out by [2], landscape is not defined by its scale - "rather, it is defined by an interacting mosaic of patches relevant to the phenomenon under consideration (at any scale)". 2.2 Purpose in the scene Landscape serves two main important goals in the visualized scene. Firstly, it serves as a main building block on (or above) which we place all other objects in the scene. Placing all other objects on it also further helps us in faster recognition of the "up" direction and orientation in the scene. Second, landscapes are also used to greatly increase the overall realism of the whole scene. If our rendered virtual objects are placed on a flat surface, overall feel of the scene is quite artificial. The reason is that the surface omits the details which cannot be fully added by applying simple colour texture. Usage of landscape instead of flat surface adds missing details to the scene and greatly enhances overall realism. However, in case we only wish to slightly distort the surface and not use any large deviations such as mountains or valleys it might be also possible to use e.g. parallax occlusion mapping [32]. This tech- nique doesn’t require additional vertices and faces and is therefore far less performance demanding.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    77 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us