Generating Realistic City Boundaries Using Two-Dimensional Perlin Noise
Total Page:16
File Type:pdf, Size:1020Kb
Generating realistic city boundaries using two-dimensional Perlin noise Graduation thesis for the Doctoraal program, Computer Science Steven Wijgerse student number 9706496 February 12, 2007 Graduation Committee dr. J. Zwiers dr. M. Poel prof.dr.ir. A. Nijholt ir. F. Kuijper (TNO Defence, Security and Safety) University of Twente Cluster: Human Media Interaction (HMI) Department of Electrical Engineering, Mathematics and Computer Science (EEMCS) Generating realistic city boundaries using two-dimensional Perlin noise Graduation thesis for the Doctoraal program, Computer Science by Steven Wijgerse, student number 9706496 February 12, 2007 Graduation Committee dr. J. Zwiers dr. M. Poel prof.dr.ir. A. Nijholt ir. F. Kuijper (TNO Defence, Security and Safety) University of Twente Cluster: Human Media Interaction (HMI) Department of Electrical Engineering, Mathematics and Computer Science (EEMCS) Abstract Currently, during the creation of a simulator that uses Virtual Reality, 3D content creation is by far the most time consuming step, of which a large part is done by hand. This is no different for the creation of virtual urban environments. In order to speed up this process, city generation systems are used. At re-lion, an overall design was specified in order to implement such a system, of which the first step is to automatically create realistic city boundaries. Within the scope of a research project for the University of Twente, an algorithm is proposed for this first step. This algorithm makes use of two-dimensional Perlin noise to fill a grid with random values. After applying a transformation function, to ensure a minimum amount of clustering, and a threshold mech- anism to the grid, the hull of the resulting shape is converted to a vector representation. This result can be used as a city boundary in other parts of the specified city generation system. In order to test these results for realism, two quantifiable properties of realistic city boundaries are specified. The first property is the fractality of the boundary, as well as a fractal dimension between 1.18 and 1.28. The second property is the newly defined minimum enclosed area ratio, which is the relation between the enclosed area and the maximum enclosed area for an equal maximum diameter. The minimum enclosed area ratio of a realistic city boundary is estimated at 6.35%. An experiment is described, in which a large amount of results, obtained from different sets of input, of the proposed algorithm are tested for fractal dimension and enclosed area ratio. By analyzing the results of this experiment, optimal ranges of input values are found, for which 73.0% of all generated shapes fulfill the given definition of a realistic city boundary. Furthermore, it is concluded that it is currently not possible to find a correlation between the input values and the fractal dimensions of the output. Contents I Theory 1 1 Introduction 2 1.1 Situation . 2 1.2 Generating city content automatically . 3 1.3 Research project . 4 1.3.1 Project goal . 4 1.3.2 Research questions . 4 1.3.3 Methodology and structure . 5 2 Literature 6 2.1 Fractals . 6 2.1.1 Example: Sierpinsky gasket . 7 2.1.2 Fractal dimension . 7 2.1.3 Meaning of dimension . 9 2.1.4 Estimating fractal dimension . 10 2.1.5 Summary . 11 2.2 Realism in city boundaries . 12 2.2.1 Fractal properties . 12 2.2.2 Enclosed area . 12 2.2.3 Summary . 13 2.3 City generators . 14 2.3.1 Properties of city generators . 14 2.3.2 Planned system at re-lion . 15 2.3.3 eSCAPE project . 16 2.3.4 Stefan Greuter . 17 2.3.5 City Engine . 17 2.3.6 Binary Worlds - Descensor Engine . 19 2.3.7 Rama . 19 2.3.8 Summary . 19 2.4 Perlin Noise . 20 2.4.1 Function description . 21 2.4.2 Implementation types . 21 2.4.3 Fractal properties of two-dimensional Perlin noise . 22 2.4.4 Summary . 23 2.5 (Pseudo) Random number generators . 24 2.5.1 About . 24 2.5.2 Real random numbers . 24 2.5.3 For cryptographic use . 25 2.5.4 PRNGs . 25 2.5.5 Comparison and practice . 25 i 3 City boundary creation algorithm 27 3.1 Fill with two-dimensional Perlin noise . 27 3.2 Transformation function . 28 3.3 Threshold the bitmap . 29 3.4 Vector representation of the hull . 31 3.5 Parameter summary . 32 II Experiment 33 4 Experiment definition 34 4.1 Calculating fractal dimension . 35 4.2 Test parameters . 38 4.2.1 Image size . 38 4.2.2 Perlin noise layers . 38 4.2.3 Transformation function . 38 4.2.4 Threshold . 38 4.3 Test definitions . 40 4.3.1 What works test . 40 4.3.2 Full test . 40 4.4 Evaluation method and expectations . 41 4.4.1 Validity . 41 4.4.2 What works test . 42 4.4.3 Full test . 42 5 Software design 44 5.1 Overview . 44 5.2 Detail . 46 5.2.1 Data types . 46 5.2.2 Test generator . 46 5.2.3 Bitmap generator . 46 5.2.4 Fractal dimension calculator . 49 5.3 Optimizations . 51 5.3.1 Multi-core . 51 5.3.2 Structured walk algorithm . 51 6 Results 54 6.1 Results of the what works test . 54 6.2 Results of the full test . 55 6.2.1 Summaries of valid results . 55 6.2.2 Correlation results . 57 6.3 Reflection . 60 6.3.1 Summary . 60 III Conclusion 62 7 Conclusions 63 7.1 Overview of the main research questions . 63 7.2 Conclusion . 64 7.3 Recommendations for future research . 65 A Examples of generated city boundaries 66 A.1 Valid results . 67 A.2 Invalid results . 70 ii B Urban ecology 74 B.1 The Concentric Zone model . 74 B.2 Hoyts Sector Model [17] ..