An Overview of Procedurally Generating Virtual Environments 程序生成虚拟环境概述
Yinghu LiuSoftware Engineering, Chengdu University of Information Technology, Chengdu, China 软件工程,成都信息工程大学,中国成都
Abstract 摘要
Procedural Generation is a method of using computers to generate content, allowing users to manually create content for virtual worlds is a very time consuming and laborious task, with the development of computer hardware, Procedural Generation is a good alternative, Procedural Generation content can be used as models or sketches to provide inspiration for the artist or to improve efficiency, this paper focuses on the representative algorithms used in Procedural Generation, which are commonly used to produce architecture, plants and terrain. 程序生成是一种利用计算机生成内容的方法,让用户手动为虚拟世界创建内容是一项非常耗时且费力的任务,随着计算机硬件的发展,程序生成是一种很好的替代方案。程序生成的内容可以作为模型或草图,为艺术家提供灵感或提高效率。本文重点介绍程序生成中使用的代表性算法,这些算法通常用于生成建筑、植物和地形。
In recent years, virtual worlds have been used in the film and video game industry, digital cultural heritage, simulation of urban phenomena and interior and exterior design planning. As virtual and augmented reality applications continue to evolve, there is an increasing demand for methods that enable fast, detailed and interactive 3D content. Hand-built virtual worlds are very rigorous and cannot be easily modified once they are finished, especially for some large-scale scenarios. 近年来,虚拟世界已被应用于电影和视频游戏行业、数字文化遗产、城市现象模拟以及室内和室外设计规划。随着虚拟和增强现实应用的不断发展,对能够快速、详细和互动的 3D 内容的方法需求不断增加。手工构建的虚拟世界非常严谨,一旦完成就很难轻易修改,尤其是对于一些大规模场景。
Procedural generation is an active research topic, the main goal is to be able to automatically create the desired object with minimal input, procedurally generated objects are also very easy to modify twice, it is used in a variety of fields, such as textures, plants, terrain, buildings, rivers and various artistic creations, this paper will introduce the generation methods for the most frequently procedurally generated content such as plants, buildings, terrain. 程序化生成是一个活跃的研究课题,其主要目标是能够通过最少的输入自动创建所需的对象,程序化生成的对象也非常容易进行二次修改,它被应用于多个领域,如纹理、植物、地形、建筑、河流和各种艺术创作。本文将介绍植物、建筑、地形等最常进行程序化生成的内容的生成方法。
2. PROCEDURAL GENERATION OF VEGETATION 2. 植被的程序化生成
The phenomenon of self-similarity is widespread in nature, and fractal structures are more stable and fault-tolerant than Euclidean geometry, with greater determinism, inspired by which was introduced into the field of computer graphics known as L-system [2], a context-independent band grammar that generates each rule that applies to only one symbol in the geometry, starting from the initial structure. Other symbols are not affected by the rules. A new object is formed by replacing some parts of the representation and iteratively applying some rules for string symbols to create branching structures. If a character is treated as an element of a language, then a set of rewrite rules might look like this: 自相似现象在自然界中广泛存在,分形结构比欧几里得几何更稳定、更容错,并具有更大的确定性,受此启发,引入了计算机图形学领域的 L 系统[2],这是一种上下文无关的带状文法,从初始结构开始生成仅适用于几何中一个符号的每条规则。其他符号不受规则影响。通过替换表示的一些部分并迭代应用一些字符串符号规则来创建分支结构形成新对象。如果将字符视为语言的元素,那么一组重写规则可能如下所示:
b rarr ab \rightarrow a
a rarr aba \rightarrow a b
This principle was originally used by Chomsky et al [1] in their description of a programming language.L-Systems requires that each rewrite rule be applied once in each round because plant growth is based on cell division and all cells occur in parallel. If “a” in the above example is used as the initial string, the process can be represented as shown in Figure 1. 这一原理最初由 Chomsky 等人[1]在他们对编程语言的描述中使用。L 系统要求每个重写规则在每轮中应用一次,因为植物生长是基于细胞分裂,所有细胞都是并行发生的。如果以上例子中的“a”被用作初始字符串,则该过程可以如图 1 所示。
Figure 1. String generation process 图 1. 字符串生成过程
In the L-system, this process describes how plants grow. In more common representations, we mark any substitutions that may occur with parentheses around the corresponding substrings. For example, an L -system can be defined as follows ( n is the number of times the rewrite rule is applied, ’ F ’ in the second line is the initial string, and delta\delta is the degree of bending): 在 L 系统中,这个过程描述了植物的生长。在更常见的表示中,我们用括号标记可能发生替换的对应子串。例如,一个 L 系统可以定义如下(n 是重写规则应用的次数,第二行中的“F”是初始字符串, delta\delta 是弯曲的程度):
n=1,delta=25^(@)n=1, \delta=25^{\circ}
FF
F rarr F[+F]F[-F]FF \rightarrow F[+F] F[-F] F
Figure 2. L-system generation results process 图 2. L 系统生成结果过程
The L-system makes it simple to generate plants with different shapes, and if 3D plants need to be generated, simply replace the initial left- and right-turn operations with movements in 3D space at each decision point [1], making the L-system by far the most widely used and successful method for procedurally generating plant content. L 系统使得生成不同形状的植物变得简单,如果需要生成 3D 植物,只需在每个决策点将初始的左转和右转操作替换为在 3D 空间中的移动[1],使得 L 系统成为迄今为止程序化生成植物内容最广泛使用和最成功的方法。
3. PROCEDURAL GENERATION OF BUILDINGS 3. 建筑物的程序化生成
There are a large number of research papers on the development of procedurally generated buildings [3-6], but only a small number of concrete implementations [7 8]. Procedural generation has been a 关于程序生成建筑物的研究论文数量众多 [3-6],但具体实现的数量却很少 [7 8]。程序生成自 2000 年以来一直是一个
popular research area since 2000.Procedurally generated buildings are generally divided into two parts. 热门的研究领域。程序生成的建筑物通常分为两部分。
the design of the house layout in the floor. 楼层内房屋布局的设计。
building shape and facade generation. 建筑形状和外立面的生成。
These two together generate a complete building. 这两者共同生成一个完整的建筑。
3.1. Procedural Layout Generation 3.1. 程序化布局生成
Johnson et al. improved the Treemap [9] algorithm and proposed the Squarified Treemap algorithm [10] for filling rooms in a given rectangular building region. Johnson 等人改进了 Treemap [9]算法,并提出了 Squarified Treemap 算法 [10],用于填充给定矩形建筑区域内的房间。