# Virtual Reality Design and Realization of Interactive Garden Landscape

Authors: Xuanfeng Zhang; Song Yan; QuanQi
Journal: Complexity
 (2021)

---

## Abstract

It is very important to study and explore the application of virtual reality technology in landscape garden design, especially in the current environment of triple network integration and Internet of Things construction, to promote and facilitate the rapid development of digital landscape garden design in China. In this paper, we study the implementation method of virtual landscape gardening system and establish a virtual environment based on the ancient city of Yangcheng. On the computer platform, we study and realize a virtual roaming system of medium complexity with more complete roaming functions. Using the Quest3D software platform, a desktop-type virtual garden simulation system was developed, focusing on the virtual reality modeling technology method and virtual system implementation. The experimental results show that the GPU-accelerated drawing method based on GLSL can significantly improve the drawing frame rate of 3D garden landscape vegetation scenes with a small amount of scene data and has a certain feasibility. Based on the OpenSceneGraph (OSG) graphics rendering engine, the visualization of various types of 3D landscape models is realized, and the spatial layout of various types of landscape with parametric control is realized through digital vector layers, which flexibly manage and organize various garden elements and reasonably organize the spatial topological relationship between various types of landscape in 3D space. By integrating cross-platform ArcGISEngine components, the basic data of garden scenes including terrain data and vector data are managed. Through scene view cropping and hierarchical detail modeling technologies, the drawing efficiency and rendering real time of the garden landscape are improved. It realizes interactive 3D scene browsing and provides a six-degree-of-freedom all-round display of the overall landscape.


---

## Body

## 1. Introduction

As an important part of urban construction, landscape has multiple ecological, cultural, social, and aesthetic functions and is the carrier of artistic, ecological services and greening effects in urban development planning [1]. Garden vegetation is an important component of the urban ecosystem, and scientific vegetation landscape construction is not only to expand the greening area, but also to conduct systematic ecological evaluation of the landscape, which is of great significance to the formation of a healthy and beneficial vegetation landscape layout for urban development [2]. The urban green space system formed by the landscape is a guarantee for improving the urban environment and enhancing the living comfort of the residents in the urban development [3]. With the development of society and the improvement of people’s living standards, the public also puts forward higher requirements for the living environment. Reasonable landscape configuration represents a city’s comprehensive construction development level as well as the concept of high-quality urban living environment construction, which improves the ecological structure of the city and promotes the environmental planning process of the city while enhancing the image of the city [4]. On the issue of grasping the landscape effect in the city, traditional landscape planning and display uses a large number of planning and design drawings, final effect drawings, and planning and design books for the expression of landscape design intention and landscape effect, but there are still various implementation problems in the field construction process, such as the problem of standardized expression of planning drawings, the problem of recalibration of ground points, the problem of planning and implementation, and the problem of coordination between planning and implementation [5–10].With the development of computer technology, computer visualization technology, and virtual reality technology, the more flexible use of computer equipment and various types of advanced display equipment for the construction and virtual display of three-dimensional garden landscape has gradually become the mainstream idea of landscape expression [11]. Under the idea of 3D landscape construction and virtual display, according to the parametric field data, the computer 3D modeling technology is used to build the overall 3D garden scene, and through various visualization technology means and display equipment, the virtual 3D garden scene display for different people has become a popular area of research. The one-to-many 3D garden landscape virtual display mode can strengthen information exchange and promote mutual communication between garden experts and the public, and the visualized garden landscape tour experience can also improve the overall garden landscape scheme through public participation in decision-making and other means [12]. Therefore, the application of virtual reality (VR) of three-dimensional landscape construction and virtual display has been gradually recognized and given importance [13]. Today, with the rapid development of virtual reality technology, the immersive browsing method has greatly enhanced the browsing experience of virtual scenes built on realistic landscapes and other landscapes and greatly expanded the ideas for the browsing experience of virtual scenes built on realistic landscapes and other landscapes. Immersive virtual reality is a new technology different from the original traditional three-dimensional scene browsing; its value for users is to dye all-round, unlimited 360° immersive scenes, so that users seem to be in the real scene and can freely browse, roam, and experience [14–19]. The virtual display of garden landscape can use immersive virtual reality technology to transcend the limitations of time and space, observe and appreciate the scientific and artistic nature of the overall landscape scheme, and make up for the lack of realistic information in the traditional three-dimensional landscape display, including the shading between the vegetation landscape, the overall spatial layout permeability, and the sensory impact of the topography undulations on the landscape [20]. By incorporating new display methods such as interactive experience or holographic video, the advantages of computer simulation can be fully utilized to provide a high information density virtual display of the garden landscape [21–27].Virtual reality three-dimensional garden vegetation landscape realism and the contradiction of the amount of data: garden landscape is a more special landscape in the three-dimensional scene, in order to ensure the realism of the garden vegetation model, often save its complex three-dimensional geometric structure in the scene, which greatly increases the amount of scene data. As the vegetation (including trees, grasses, and flowers) model has the characteristics of complex structure and variety, building a more realistic 3D vegetation model and loading it in large quantities in the 3D scene increase the pressure of rendering the overall landscape of the 3D garden, and in the virtual reality display device, this contradiction is more undoubtedly magnified due to the dual-channel feature of virtual reality rendering (binocular field of view). In order to improve the scene realism and rendering efficiency, how to seek a balanced rendering optimization scheme is also a key issue for 3D garden landscape construction and virtual display. In response to the above needs and problems, this paper makes comprehensive use of virtual reality technology, virtual plants, GIS, and parametric modeling technology to design and implement a 3D landscape construction system that supports multiplatform virtual display. And the corresponding rendering optimization is carried out for the tree vegetation model with large data volume, and each module is integrated to realize the construction, organization, and virtual display of the 3D landscape as a whole.


## 2. Construction of Three-Dimensional Landscape Space

### 2.1. 3D Graphics Rendering Engine

At present, the construction and display of three-dimensional scenes are still the focus of research in the field of computer visualization, and in the field of games, immersive virtual reality interaction has developed into a more mature and common technology. As the basis for the construction of 3D scenes, there are a variety of options for 3D graphics rendering engines. The more widely used 3D graphics rendering and simulation engines have their own characteristics and are suitable for different application scenarios, as shown in Table1.Table 1
Comparison of common 3D graphics rendering engines.
Engine nameType of applicationCompatibilityOpen sourceUnity3DArchitectural scenesGoodNoCryEngineLarge view scenesGeneralNoUnrealEngineAnimated scenesGeneralNoOpenSceneGraphCombination scenesGoodNoFor the above graphic rendering engines, UnrealEngine has excellent physics and lighting effects, but due to its high degree of commercialization, the application content is limited by the user’s purchased access, so it is more suitable for game masterpieces, not suitable for low-cost application development; CryEngine has excellent lighting rendering. However, its application time is short, it lacks rich technical documentation support, and cross-platform is weak, and it is not suitable for 3D simulation applications with variable scenes. However, due to its interactive module development characteristics, it is more difficult to reflect the advantages of the landscape OpenSceneGraph open source 3D graphics rendering engine. The 3D graphics development API (application programming interface) based on the OpenGL industry graphics standard has the characteristics of cross-platform and flexible use. Due to its open-source features, it has been widely used in the fields of vegetation landscape visualization, virtual garden landscape, 3D geographic scenes, and so on. Integrating the advantages of all aspects, the research in this paper mainly selects OSG 3D graphics rendering development engine as the basis for graphics rendering and scene visualization.Essentially, the OSG scene graph is a 3D scene organization and management method that evolved from an earlier display list of objects and their interrelationships. The scene graph can also be considered as a data management approach with an internal k-tree data structure, in which the root node serves as the scene itself and the scene content serves as any number of child nodes, each of which stores its own scene data organization, including much information about the 3D scene objects themselves, their properties, light sources, camera viewpoints, and matrix transformations.The scene graph feature of the OSG graphics rendering engine has many advantages, including the following:(1)
The standard scene graph structure organization can directly optimize the scene graph traversal algorithm to have high efficiency scene graph access speed and can realize efficient operation of multiple CPUs through parallelism.(2)
Its kernel supports the functions of the new version of OpenGL, which enables flexible implementation of various graphics operations.(3)
There is built-in standard GLSL support, so you can control the GPU rendering threads through shader language, making the simulation efficient and realistic with a large space for improvement.(4)
It enable using C++ language as the basis of the engine and incorporating practical techniques and new features of C++ language such as generalization and design patterns. Based on the above scene graph features and advantages, OSG graphics rendering engine fits the characteristics of 3D landscape with many elements and more difficulty to organize and can manage the scene through the node structure and can unify the management of the same type of landscape, such as vegetation, water bodies, and building groups, through loading and unloading of the root node.


### 2.2. OSG Scene Rendering

The rendering process of OSG graphics rendering engine can be divided into three stages according to the data transfer process. The user phase updates the user data and manages and organizes the various objects that make up the 3D scene according to their states, including camera positions, scene object positions, and attribute states. The screening phase is responsible for determining what scene content needs to be rendered. The filtering stage is responsible for determining which scene contents need to be rendered and which invisible contents need to be excluded and ignored, and sorting the rendering pipeline for objects with similar rendering states according to the scene node state set to avoid unnecessary increase in rendering consumption due to frequent switching of rendering states. The last stage of the drawing phase is specifically responsible for drawing and rasterizing the various scenes, traversing all the rendered data of the scene to be drawn through the OpenGL function encapsulated in OSG graphics rendering engine, passing the scene data into the OpenGL drawing pipeline, and finally realizing the terminal display of the landscape.For the rendering process of the OSG graphics rendering engine, there is a difference between single-threaded and multithreaded system. For a single-threaded system, the three phases of the user phase, the filtering phase, and the drawing phase are executed sequentially in each frame of the graphics rendering, while for a multithreaded system rendering process, the execution of the three different phases of the graphics rendering process in two adjacent frames is overlapped, specifically the user update phase and the scene filtering phase, and the rendering drawing phase cannot be run in an overlapping manner, but a multithreaded system allows the user update phase of the next frame to be performed before the previous frame is finished drawing, thus improving the rendering efficiency of the program. Further, the OSG graphics rendering engine allows a multi-CPU system to perform screening and drawing of different graphics display devices through different CPUs, which ensures the full utilization of system resources and improves the rendering efficiency of 3D scenes at the bottom layer to realize the real-time rendering effect of virtual displays (Figure1).Figure 1
Multidevice scene drawing.For a 3D landscape virtual display system with multiple graphics rendering windows for multiterminal display, the OSG graphics rendering engine screens and draws each rendering viewpoint camera for each graphics rendering window separately, which is a key step for virtual reality display as each viewpoint camera may have a different projection matrix and observation matrix for the left and right fields of view, respectively. However, in the user stage, the processing of each graphics rendering window does not need to be executed multiple times individually, because the scene data of the OSG graphics rendering engine is shared among the graphics devices, which also simplifies the rendering process of the scene.The fine degree of landscape design of garden vegetation depends to a large extent on the accuracy of the construction of the three-dimensional model of garden plants. The 3D model reconstruction of plants is different from the 3D model reconstruction of buildings and terrains, as various plants generally have more complex and different organizational structures, and the construction of the model requires relatively complex technical means. To study plant growth, plant biomass, and other plant 3D model reconstruction, it needs the knowledge support of botany, ecology, and other professional disciplines to establish more complex computer algorithms to realize the real reproduction of plants. At the same time, three-dimensional modeling of plants is a research hotspot in many fields such as agronomy, botany, ecology, computer graphics, and natural landscape reproduction. Different application areas have different requirements for model accuracy, and in garden vegetation landscape planning, the vegetation model requires image, realistic, and moderate amount of data. Therefore, 3D plant modeling is the basis of 3D landscape construction and scientific analysis of the compatibility between plants and the environment, so it is necessary to improve the quality of vegetation landscape construction and improve the scientific and social benefits of vegetation landscape planning and model-driven and data-driven group plant modeling technology. There are many mature plant 3D modeling methods. Table2 lists several modeling methods that are currently applied at home and abroad and conducts a comparison of modeling efficiency, data cost, database source, and the final realism of the constructed model in many aspects and elaborates the advantages and disadvantages of the corresponding modeling methods and the specific applicable fields.Table 2
Data type and acquisition.
MethodEfficiencyData sourceAuthenticityRule-basedLowTree structure dataLowHand-drawn basedLowTree imagesLowPoint cloud basedHighScan resultsHighBased on parametersHighStructure parametersHighIn general, at present, the main way for fine 3D structure modeling of plants is to visualize 3D reconstruction on a computer through tree structure data obtained from measurements, e.g., Yan Guo et al. constructed a corresponding 3D model of maize canopy by measuring the morphological structure of maize canopy at different fertility stages and used it as a basis to analyze the influence of light distribution among maize canopies on maize growth and development. The plant modeling based on laser point cloud data has the main characteristics of high accuracy, high speed, and 3D stereo scanning for structure description, but laser point cloud data has the disadvantages of large data volume, high redundancy, and complicated processing, which usually need to be combined with other clustering algorithms for 3D modeling.Based on the above research, this paper precisely constructs a 3D parametric tree model with high realism through a parametric modeling method that relies on visual model building software by parametrizing tree structure data and combining the advantages of various modeling methods. Parametric plant model construction can preserve the complete plant ecological characteristics and can enrich the information content of the landscape, which has unique advantages for scientific landscape framing and display. In the field of 3D modeling, the commonly used modeling software includes SpeedTree, Xfrog, Forester, and ParaTree. Among them, ParaTreet, a parametric-based tree modeling software developed by the research team of Fuzhou University, is applied as a tool for parametric modeling in this paper. ParaTree can quickly build a highly realistic tree model based on the realistic morphological characteristics of plants using a parametric interactive modeling method, does not require users to have a rich botanical knowledge base, and is an easy-to-use, user-oriented plant modeling software. On the other hand, the parametric tree model built based on the field collection of tree structure parameters has rich plant morphological characteristics, which can provide some support for the construction of vegetation in 3D landscapes and realize the simulation of vegetation landscape with high realism.


### 2.3. 3D Terrain Model Visualization Technology

Topography, as the foundation of geographic landscape, is the basis for constructing 3D garden landscape. The common means of acquiring topography include remote sensing satellite to acquire topographic elevation, ground-based LiDAR scanning, and image-based airborne 3D point cloud reconstruction. Usually the terrain elevation features acquired by remote sensing satellites are suitable for large-scale geographic analysis, and the resolution is generally between 10 meters and 30 meters. The laser point cloud data of terrain acquisition has the characteristics of high precision and detailed sampling, which can accurately obtain the elevation of a point on the ground and express the undulating features of the garden surface, but the terrestrial LiDAR scanning, which needs to obtain accurate 3D elevation point cloud data of a small area by configuring multiple topographic measurement sites, accurately expresses the topographic features of a small area. The disadvantage is that laser scanning is required between different stations, which is not applicable to the general landscape terrain area of several square kilometers. Laser scanning collects ground point data at a higher resolution, but this high-precision method also has certain drawbacks; for example, the point cloud collection of pure ground terrain will be affected by various types of redundant features, such as vehicles, trees, and buildings. Therefore, the point cloud data collected by the UAV needs to be eliminated by the method of point cloud rejection, and the point clouds belonging to nonground points such as buildings and vegetation are eliminated to retain pure ground point cloud data. In the above process, the rejection of irrelevant error point clouds will lead to the phenomenon of terrain voids. Usually, we consider the terrain as a continuously distributed plane; therefore, by analyzing the critical points of the void part, the terrain point cloud location of the void location is inferred and the terrain points are appropriately spatially interpolated. Spatial interpolation algorithm is a common tool in the process of laser point cloud data estimation, and there are many mature interpolation algorithms, including Sisson interpolation algorithm, area averaging method, kriging algorithm, and distance inverse method, as shown in Table3.Table 3
Ground point cloud data acquisition.
Interpolation algorithmParameter indicatorsNumber of picking pointsAccuracySisson interpolation algorithmAverage value20LowArea averaging methodExtreme values20LowKriging’s algorithmMedian20HighDistance countdown methodVariance20HighDirks concluded from data analysis that, for interpolation of spatially dense networks, the inverse distance method has certain advantages. As a kind of distance inverse method, the inverse distance weighting method uses linear weights of point sets in the neighborhood to calculate the unknown point positions, which is more suitable for interpolation of 3D terrain dense point cloud data collected by UAVs, and is convenient for constructing features of continuous undulating terrain surfaces. The basic interpolation process of the IDW algorithm is depicted in Figure2.Figure 2
Diagram of inverse distance weighting method.The inverse distance weighting method stipulates that the observation points closer to the unknown points contribute more to the corresponding search radius, and the distance between the observation points and the unknown points is inversely proportional to the contribution value; thus, it is also called the inverse distance weighting method. The inverse distance weighted spatial interpolation algorithm specifically by assuming unknown terrain point corpse. Influenced by the point within the adjacent radius rather than the terrain point farther away, the specific interpolation point location is determined by the inverse distance power function, and the specific calculation is as follows:(1)q0=∑i=1nei1/di∑i=1n1/di.In the above equation,ei is the elevation of the neighboring points and di is the distance between the neighboring points and the unknown point is the total number of points in the neighborhood of the unknown point; when the power value is equal to 1, the proximity point cloud change presents a linear change of the inverse of the point distance.Therefore, it is called linear interpolation, but when the cavity is large, linear interpolation will have a large redundancy error; therefore, in the 3D point cloud interpolation, generally by defining the power value as a value greater than or equal to 2, to avoid the unknown points far from the neighboring points change rate is too large, the plane change trend after complementing the cavity point cloud is more gentle.(2)q0=∑i=1nei1/did¯i.Through IDW spatial interpolation, it can be ensured that the elevation range of the predicted terrain points generated is between the maximum and minimum values of the original point cloud elevation, which ensures the uniform distribution of the terrain and facilitates the generation of a simple ground digital elevation model of the corresponding area and the 3D digital terrain configuration network. In GIS, the 3D digital terrain is called digital terrain model, which can contain the area, volume, elevation, undulation slope, etc. of the terrain. When the digital terrain description data is elevation, it is a digital elevation model. By constructing a network for the digital elevation model, a continuous terrain surface can be generated. In the three-dimensional landscape, the terrain is used as the basis for the construction of the whole scene, and generally there is no complex undulation change, so the use of regular triangular grid for terrain construction has certain advantages.Similar to the real visual scene, in the imaging space inside the viewfinder, the more distant landscape elements from the viewpoint are displayed smaller, and the closer landscape elements from the viewpoint are displayed larger, while the landscape elements outside the viewfinder are not visible. The tapered view is composed of six planes including the far cut plane and the near cut plane, and its boundary is four rays with a certain range emanating from the viewpoint. In the OSG graphics rendering engine, the node states are transformed by the perspective projection matrix transformation, which eliminates the invisible landscape element nodes and keeps the visible landscape element nodes inside the viewpoint. When there are many landscape element nodes in the 3D scene, the data computation based on the view body real-time dynamic cropping is large and time-consuming, which is not in line with the original intention of fast drawing; therefore, coarse cropping based on the view body is usually used to improve the data processing speed and avoid a large number of spatial location calculations. Specifically, the landscape nodes are judged based on the left-right position relationship of the specific boundary plane (straight line) of the view body, as shown in the corresponding figure, and the six plane equations constituting the view body are calculated in real time.(3)fix,y,z=qx+by+pz+c,Δx=x2−x1cosθ,Δy=y2−y1cosθ,Δz=z2−z1cosθ,cosθ=f1∑i=1nfi,p=qx+by+pz+c∑i=1nfi,where i = 1, 2, 3, 4, 5, 6, the coordinates of the full interval position of the landscape nodes to be judged are substituted into each plane equation, and if the values of the equations are all greater than 0, it means that the landscape nodes are inside the view body and can be drawn; if the fi value of any equation is less than or equal to 0, the landscape nodes are outside the view body and need to be eliminated.


### 2.4. Virtual Reality Module Integration

At present, virtual reality technology has shown a good development trend under the wave of advancing computer technology. Yangcheng ’s major virtual reality suppliers include HTC and Oculus. Among them, Oculus is a pioneer in the field of virtual reality, and its virtual reality device OculusRift is more maturely developed than other virtual reality devices, with the characteristics of lightweight, multi-interface, and easy development, and its full support for OSG extensions, providing a powerful SDK (SoftwareDevelopmentKit, software development kit). A typical OculusRiftcvl device system includes a Head-Mount-Display (HMD), two laser positioning sensors, and control handles designed for left and right hands, respectively. To realize the virtual reality immersive display, a virtual reality module needs to be implemented and integrated into the 3D landscape construction and virtual display system to realize the program interface to the 3D landscape construction and virtual display system. The virtual reality module includes data transfer, device creation, scene redrawing, viewpoint construction, and immersive scene display. Oculus provides a feature-rich device development interface to suit different development needs and uses the OSG graphics rendering engine combined with the OculusSDK to specifically build the overall virtual reality display function module, based on the process of its function realization, and the virtual reality module is specifically divided into four submodules: virtual reality device creation, scene data transfer, scene texture rerendering, and viewpoint construction and matrix conversion.The virtual reality headset display device is connected to the 3D landscape system, and the overall 3D landscape scene data is transferred between modules and its virtual immersive rendering is realized. Based on the OSG engine, the 3D landscape system has a clear organizational hierarchy among the scenes, specifically through the BoundingVolumeHierarchy (BVH) to achieve the management of all kinds of 3D objects in the scene, and each 3D object that constitutes the landscape is completely contained in a closed geometry of Yangcheng. Each 3D object that constitutes the landscape is completely contained in a closed enclosing geometry, including enclosing boxes (cubes), enclosing spheres (spheres), enclosing cylinders (cylinders), and K-Dop. Such a structural organization of the scene determines that the scene drawn by OSG can be organized through a tree-like node structure to organize the spatial relationships between various types of garden 3D features. A complete 3D scene has a root node, multiple internal branch nodes, and landscape subnodes that specifically represent the composition of the scene. 3D garden scenes are organized through a tree structure, the higher-level nodes can completely enclose the lower-level nodes, and for the overall 3D garden landscape data loading and unloading, only the uppermost parent node can be operated, which improves the overall scene data access performance of the system.As shown in Figure3, the improvement of the frame improvement of the Woods scene is better. From the traditional OSG rendering method of 35-42 frames per second to approximately 60 images per second, the average rendering speed is around 30%, which is the highest coloring speed of 60 towels per second in the scene. The main reason is not limited by the highest rate of image repetition of the desktop end hardware display, and in the Virtual Reality Headset display, because the lens display device has a higher rate of image repetition, by specifying a smaller area of the first perspective view of the user, the application of the GPU-accelerated rendering method based on the GLSL method can significantly improve the rendering efficiency of 3D landscape scenes with a large number of trees and vegetation. Therefore, the application of the GLSL programming method with GPU acceleration to draw tree models with a large number of facets can effectively improve the rendering efficiency of 3D scenes with a small user view range and a small amount of view body cropping operations, which to a certain extent can help in the immersive virtual reality display.Figure 3
Comparison of frame rates between viewpoint 3 and viewpoint 4 rendering methods.


## 2.1. 3D Graphics Rendering Engine

At present, the construction and display of three-dimensional scenes are still the focus of research in the field of computer visualization, and in the field of games, immersive virtual reality interaction has developed into a more mature and common technology. As the basis for the construction of 3D scenes, there are a variety of options for 3D graphics rendering engines. The more widely used 3D graphics rendering and simulation engines have their own characteristics and are suitable for different application scenarios, as shown in Table1.Table 1
Comparison of common 3D graphics rendering engines.
Engine nameType of applicationCompatibilityOpen sourceUnity3DArchitectural scenesGoodNoCryEngineLarge view scenesGeneralNoUnrealEngineAnimated scenesGeneralNoOpenSceneGraphCombination scenesGoodNoFor the above graphic rendering engines, UnrealEngine has excellent physics and lighting effects, but due to its high degree of commercialization, the application content is limited by the user’s purchased access, so it is more suitable for game masterpieces, not suitable for low-cost application development; CryEngine has excellent lighting rendering. However, its application time is short, it lacks rich technical documentation support, and cross-platform is weak, and it is not suitable for 3D simulation applications with variable scenes. However, due to its interactive module development characteristics, it is more difficult to reflect the advantages of the landscape OpenSceneGraph open source 3D graphics rendering engine. The 3D graphics development API (application programming interface) based on the OpenGL industry graphics standard has the characteristics of cross-platform and flexible use. Due to its open-source features, it has been widely used in the fields of vegetation landscape visualization, virtual garden landscape, 3D geographic scenes, and so on. Integrating the advantages of all aspects, the research in this paper mainly selects OSG 3D graphics rendering development engine as the basis for graphics rendering and scene visualization.Essentially, the OSG scene graph is a 3D scene organization and management method that evolved from an earlier display list of objects and their interrelationships. The scene graph can also be considered as a data management approach with an internal k-tree data structure, in which the root node serves as the scene itself and the scene content serves as any number of child nodes, each of which stores its own scene data organization, including much information about the 3D scene objects themselves, their properties, light sources, camera viewpoints, and matrix transformations.The scene graph feature of the OSG graphics rendering engine has many advantages, including the following:(1)
The standard scene graph structure organization can directly optimize the scene graph traversal algorithm to have high efficiency scene graph access speed and can realize efficient operation of multiple CPUs through parallelism.(2)
Its kernel supports the functions of the new version of OpenGL, which enables flexible implementation of various graphics operations.(3)
There is built-in standard GLSL support, so you can control the GPU rendering threads through shader language, making the simulation efficient and realistic with a large space for improvement.(4)
It enable using C++ language as the basis of the engine and incorporating practical techniques and new features of C++ language such as generalization and design patterns. Based on the above scene graph features and advantages, OSG graphics rendering engine fits the characteristics of 3D landscape with many elements and more difficulty to organize and can manage the scene through the node structure and can unify the management of the same type of landscape, such as vegetation, water bodies, and building groups, through loading and unloading of the root node.


## 2.2. OSG Scene Rendering

The rendering process of OSG graphics rendering engine can be divided into three stages according to the data transfer process. The user phase updates the user data and manages and organizes the various objects that make up the 3D scene according to their states, including camera positions, scene object positions, and attribute states. The screening phase is responsible for determining what scene content needs to be rendered. The filtering stage is responsible for determining which scene contents need to be rendered and which invisible contents need to be excluded and ignored, and sorting the rendering pipeline for objects with similar rendering states according to the scene node state set to avoid unnecessary increase in rendering consumption due to frequent switching of rendering states. The last stage of the drawing phase is specifically responsible for drawing and rasterizing the various scenes, traversing all the rendered data of the scene to be drawn through the OpenGL function encapsulated in OSG graphics rendering engine, passing the scene data into the OpenGL drawing pipeline, and finally realizing the terminal display of the landscape.For the rendering process of the OSG graphics rendering engine, there is a difference between single-threaded and multithreaded system. For a single-threaded system, the three phases of the user phase, the filtering phase, and the drawing phase are executed sequentially in each frame of the graphics rendering, while for a multithreaded system rendering process, the execution of the three different phases of the graphics rendering process in two adjacent frames is overlapped, specifically the user update phase and the scene filtering phase, and the rendering drawing phase cannot be run in an overlapping manner, but a multithreaded system allows the user update phase of the next frame to be performed before the previous frame is finished drawing, thus improving the rendering efficiency of the program. Further, the OSG graphics rendering engine allows a multi-CPU system to perform screening and drawing of different graphics display devices through different CPUs, which ensures the full utilization of system resources and improves the rendering efficiency of 3D scenes at the bottom layer to realize the real-time rendering effect of virtual displays (Figure1).Figure 1
Multidevice scene drawing.For a 3D landscape virtual display system with multiple graphics rendering windows for multiterminal display, the OSG graphics rendering engine screens and draws each rendering viewpoint camera for each graphics rendering window separately, which is a key step for virtual reality display as each viewpoint camera may have a different projection matrix and observation matrix for the left and right fields of view, respectively. However, in the user stage, the processing of each graphics rendering window does not need to be executed multiple times individually, because the scene data of the OSG graphics rendering engine is shared among the graphics devices, which also simplifies the rendering process of the scene.The fine degree of landscape design of garden vegetation depends to a large extent on the accuracy of the construction of the three-dimensional model of garden plants. The 3D model reconstruction of plants is different from the 3D model reconstruction of buildings and terrains, as various plants generally have more complex and different organizational structures, and the construction of the model requires relatively complex technical means. To study plant growth, plant biomass, and other plant 3D model reconstruction, it needs the knowledge support of botany, ecology, and other professional disciplines to establish more complex computer algorithms to realize the real reproduction of plants. At the same time, three-dimensional modeling of plants is a research hotspot in many fields such as agronomy, botany, ecology, computer graphics, and natural landscape reproduction. Different application areas have different requirements for model accuracy, and in garden vegetation landscape planning, the vegetation model requires image, realistic, and moderate amount of data. Therefore, 3D plant modeling is the basis of 3D landscape construction and scientific analysis of the compatibility between plants and the environment, so it is necessary to improve the quality of vegetation landscape construction and improve the scientific and social benefits of vegetation landscape planning and model-driven and data-driven group plant modeling technology. There are many mature plant 3D modeling methods. Table2 lists several modeling methods that are currently applied at home and abroad and conducts a comparison of modeling efficiency, data cost, database source, and the final realism of the constructed model in many aspects and elaborates the advantages and disadvantages of the corresponding modeling methods and the specific applicable fields.Table 2
Data type and acquisition.
MethodEfficiencyData sourceAuthenticityRule-basedLowTree structure dataLowHand-drawn basedLowTree imagesLowPoint cloud basedHighScan resultsHighBased on parametersHighStructure parametersHighIn general, at present, the main way for fine 3D structure modeling of plants is to visualize 3D reconstruction on a computer through tree structure data obtained from measurements, e.g., Yan Guo et al. constructed a corresponding 3D model of maize canopy by measuring the morphological structure of maize canopy at different fertility stages and used it as a basis to analyze the influence of light distribution among maize canopies on maize growth and development. The plant modeling based on laser point cloud data has the main characteristics of high accuracy, high speed, and 3D stereo scanning for structure description, but laser point cloud data has the disadvantages of large data volume, high redundancy, and complicated processing, which usually need to be combined with other clustering algorithms for 3D modeling.Based on the above research, this paper precisely constructs a 3D parametric tree model with high realism through a parametric modeling method that relies on visual model building software by parametrizing tree structure data and combining the advantages of various modeling methods. Parametric plant model construction can preserve the complete plant ecological characteristics and can enrich the information content of the landscape, which has unique advantages for scientific landscape framing and display. In the field of 3D modeling, the commonly used modeling software includes SpeedTree, Xfrog, Forester, and ParaTree. Among them, ParaTreet, a parametric-based tree modeling software developed by the research team of Fuzhou University, is applied as a tool for parametric modeling in this paper. ParaTree can quickly build a highly realistic tree model based on the realistic morphological characteristics of plants using a parametric interactive modeling method, does not require users to have a rich botanical knowledge base, and is an easy-to-use, user-oriented plant modeling software. On the other hand, the parametric tree model built based on the field collection of tree structure parameters has rich plant morphological characteristics, which can provide some support for the construction of vegetation in 3D landscapes and realize the simulation of vegetation landscape with high realism.


## 2.3. 3D Terrain Model Visualization Technology

Topography, as the foundation of geographic landscape, is the basis for constructing 3D garden landscape. The common means of acquiring topography include remote sensing satellite to acquire topographic elevation, ground-based LiDAR scanning, and image-based airborne 3D point cloud reconstruction. Usually the terrain elevation features acquired by remote sensing satellites are suitable for large-scale geographic analysis, and the resolution is generally between 10 meters and 30 meters. The laser point cloud data of terrain acquisition has the characteristics of high precision and detailed sampling, which can accurately obtain the elevation of a point on the ground and express the undulating features of the garden surface, but the terrestrial LiDAR scanning, which needs to obtain accurate 3D elevation point cloud data of a small area by configuring multiple topographic measurement sites, accurately expresses the topographic features of a small area. The disadvantage is that laser scanning is required between different stations, which is not applicable to the general landscape terrain area of several square kilometers. Laser scanning collects ground point data at a higher resolution, but this high-precision method also has certain drawbacks; for example, the point cloud collection of pure ground terrain will be affected by various types of redundant features, such as vehicles, trees, and buildings. Therefore, the point cloud data collected by the UAV needs to be eliminated by the method of point cloud rejection, and the point clouds belonging to nonground points such as buildings and vegetation are eliminated to retain pure ground point cloud data. In the above process, the rejection of irrelevant error point clouds will lead to the phenomenon of terrain voids. Usually, we consider the terrain as a continuously distributed plane; therefore, by analyzing the critical points of the void part, the terrain point cloud location of the void location is inferred and the terrain points are appropriately spatially interpolated. Spatial interpolation algorithm is a common tool in the process of laser point cloud data estimation, and there are many mature interpolation algorithms, including Sisson interpolation algorithm, area averaging method, kriging algorithm, and distance inverse method, as shown in Table3.Table 3
Ground point cloud data acquisition.
Interpolation algorithmParameter indicatorsNumber of picking pointsAccuracySisson interpolation algorithmAverage value20LowArea averaging methodExtreme values20LowKriging’s algorithmMedian20HighDistance countdown methodVariance20HighDirks concluded from data analysis that, for interpolation of spatially dense networks, the inverse distance method has certain advantages. As a kind of distance inverse method, the inverse distance weighting method uses linear weights of point sets in the neighborhood to calculate the unknown point positions, which is more suitable for interpolation of 3D terrain dense point cloud data collected by UAVs, and is convenient for constructing features of continuous undulating terrain surfaces. The basic interpolation process of the IDW algorithm is depicted in Figure2.Figure 2
Diagram of inverse distance weighting method.The inverse distance weighting method stipulates that the observation points closer to the unknown points contribute more to the corresponding search radius, and the distance between the observation points and the unknown points is inversely proportional to the contribution value; thus, it is also called the inverse distance weighting method. The inverse distance weighted spatial interpolation algorithm specifically by assuming unknown terrain point corpse. Influenced by the point within the adjacent radius rather than the terrain point farther away, the specific interpolation point location is determined by the inverse distance power function, and the specific calculation is as follows:(1)q0=∑i=1nei1/di∑i=1n1/di.In the above equation,ei is the elevation of the neighboring points and di is the distance between the neighboring points and the unknown point is the total number of points in the neighborhood of the unknown point; when the power value is equal to 1, the proximity point cloud change presents a linear change of the inverse of the point distance.Therefore, it is called linear interpolation, but when the cavity is large, linear interpolation will have a large redundancy error; therefore, in the 3D point cloud interpolation, generally by defining the power value as a value greater than or equal to 2, to avoid the unknown points far from the neighboring points change rate is too large, the plane change trend after complementing the cavity point cloud is more gentle.(2)q0=∑i=1nei1/did¯i.Through IDW spatial interpolation, it can be ensured that the elevation range of the predicted terrain points generated is between the maximum and minimum values of the original point cloud elevation, which ensures the uniform distribution of the terrain and facilitates the generation of a simple ground digital elevation model of the corresponding area and the 3D digital terrain configuration network. In GIS, the 3D digital terrain is called digital terrain model, which can contain the area, volume, elevation, undulation slope, etc. of the terrain. When the digital terrain description data is elevation, it is a digital elevation model. By constructing a network for the digital elevation model, a continuous terrain surface can be generated. In the three-dimensional landscape, the terrain is used as the basis for the construction of the whole scene, and generally there is no complex undulation change, so the use of regular triangular grid for terrain construction has certain advantages.Similar to the real visual scene, in the imaging space inside the viewfinder, the more distant landscape elements from the viewpoint are displayed smaller, and the closer landscape elements from the viewpoint are displayed larger, while the landscape elements outside the viewfinder are not visible. The tapered view is composed of six planes including the far cut plane and the near cut plane, and its boundary is four rays with a certain range emanating from the viewpoint. In the OSG graphics rendering engine, the node states are transformed by the perspective projection matrix transformation, which eliminates the invisible landscape element nodes and keeps the visible landscape element nodes inside the viewpoint. When there are many landscape element nodes in the 3D scene, the data computation based on the view body real-time dynamic cropping is large and time-consuming, which is not in line with the original intention of fast drawing; therefore, coarse cropping based on the view body is usually used to improve the data processing speed and avoid a large number of spatial location calculations. Specifically, the landscape nodes are judged based on the left-right position relationship of the specific boundary plane (straight line) of the view body, as shown in the corresponding figure, and the six plane equations constituting the view body are calculated in real time.(3)fix,y,z=qx+by+pz+c,Δx=x2−x1cosθ,Δy=y2−y1cosθ,Δz=z2−z1cosθ,cosθ=f1∑i=1nfi,p=qx+by+pz+c∑i=1nfi,where i = 1, 2, 3, 4, 5, 6, the coordinates of the full interval position of the landscape nodes to be judged are substituted into each plane equation, and if the values of the equations are all greater than 0, it means that the landscape nodes are inside the view body and can be drawn; if the fi value of any equation is less than or equal to 0, the landscape nodes are outside the view body and need to be eliminated.


## 2.4. Virtual Reality Module Integration

At present, virtual reality technology has shown a good development trend under the wave of advancing computer technology. Yangcheng ’s major virtual reality suppliers include HTC and Oculus. Among them, Oculus is a pioneer in the field of virtual reality, and its virtual reality device OculusRift is more maturely developed than other virtual reality devices, with the characteristics of lightweight, multi-interface, and easy development, and its full support for OSG extensions, providing a powerful SDK (SoftwareDevelopmentKit, software development kit). A typical OculusRiftcvl device system includes a Head-Mount-Display (HMD), two laser positioning sensors, and control handles designed for left and right hands, respectively. To realize the virtual reality immersive display, a virtual reality module needs to be implemented and integrated into the 3D landscape construction and virtual display system to realize the program interface to the 3D landscape construction and virtual display system. The virtual reality module includes data transfer, device creation, scene redrawing, viewpoint construction, and immersive scene display. Oculus provides a feature-rich device development interface to suit different development needs and uses the OSG graphics rendering engine combined with the OculusSDK to specifically build the overall virtual reality display function module, based on the process of its function realization, and the virtual reality module is specifically divided into four submodules: virtual reality device creation, scene data transfer, scene texture rerendering, and viewpoint construction and matrix conversion.The virtual reality headset display device is connected to the 3D landscape system, and the overall 3D landscape scene data is transferred between modules and its virtual immersive rendering is realized. Based on the OSG engine, the 3D landscape system has a clear organizational hierarchy among the scenes, specifically through the BoundingVolumeHierarchy (BVH) to achieve the management of all kinds of 3D objects in the scene, and each 3D object that constitutes the landscape is completely contained in a closed geometry of Yangcheng. Each 3D object that constitutes the landscape is completely contained in a closed enclosing geometry, including enclosing boxes (cubes), enclosing spheres (spheres), enclosing cylinders (cylinders), and K-Dop. Such a structural organization of the scene determines that the scene drawn by OSG can be organized through a tree-like node structure to organize the spatial relationships between various types of garden 3D features. A complete 3D scene has a root node, multiple internal branch nodes, and landscape subnodes that specifically represent the composition of the scene. 3D garden scenes are organized through a tree structure, the higher-level nodes can completely enclose the lower-level nodes, and for the overall 3D garden landscape data loading and unloading, only the uppermost parent node can be operated, which improves the overall scene data access performance of the system.As shown in Figure3, the improvement of the frame improvement of the Woods scene is better. From the traditional OSG rendering method of 35-42 frames per second to approximately 60 images per second, the average rendering speed is around 30%, which is the highest coloring speed of 60 towels per second in the scene. The main reason is not limited by the highest rate of image repetition of the desktop end hardware display, and in the Virtual Reality Headset display, because the lens display device has a higher rate of image repetition, by specifying a smaller area of the first perspective view of the user, the application of the GPU-accelerated rendering method based on the GLSL method can significantly improve the rendering efficiency of 3D landscape scenes with a large number of trees and vegetation. Therefore, the application of the GLSL programming method with GPU acceleration to draw tree models with a large number of facets can effectively improve the rendering efficiency of 3D scenes with a small user view range and a small amount of view body cropping operations, which to a certain extent can help in the immersive virtual reality display.Figure 3
Comparison of frame rates between viewpoint 3 and viewpoint 4 rendering methods.


## 3. Results and Analysis

When the initialization process of the virtual reality module is finished and the overall data information of the 3D garden scene is accepted, the spatial pose data of the user in the scene needs to be obtained as the basis of the virtual reality immersive scene construction. The Oculus device controls the virtual reality construction process through the environment pointer object OvrSession provided by the OculusSDK, and through the process control object, it obtains the preset user field of view (FieldofView, FOV) for both eyes of Yangcheng. In the Oculus device system, FOV is described as a set of four tangent values, as shown in Figure4, and through the four directions of the tangent values, the virtual immersion scene can obtain the field of view range of the upper, lower, left, and right four directions of boundary information. The scene diagram can also be viewed as a data management approach with an internal k-tree data structure, where the base node serves as the scene itself and the scene content serves as any number of subnodes, each of which stores its own scene data organization, including much information about the 3D scene objects themselves, their properties, light sources, camera perspectives, and matrix transformations. When the scene is retransferred from the desktop display into the virtual reality headset display device, the FOV needs to be scoped again, and the fixed aspect ratio field of view of the desktop needs to be described in the virtual reality headset display device as an extended edge field of view of the same size, so as to improve the user’s immersion.Figure 4
Field of view in immersive virtual reality.The figure shows the standard coordinate system of the Oculus device, where the +X direction is right, the +Y direction is up, and the +Z direction points to the direction of the user’s line of sight (off-screen); the plane ABCD represents the user’s real-time visual range, and the line NP is the projection of the line-of-sight range plane on the horizontal plane XOZ, so there is the user’s left visual range angle = 0, which is represented in Oculus by the tan6 > tangent value. In this way, the tangent values are obtained in each of the four directions relative to each other in the Oculus coordinate system, and the user’s real-time field of view is accurately obtained, providing spatial orientation parameters for the system display. Compared to other methods, the application of the GPU-accelerated rendering method based on the GLSL method can significantly improve the rendering efficiency of 3D landscape scenes with a large number of trees and vegetation.In the virtual reality environment, the falseness of simple surface texture mapping in the virtual reality environment will be greatly enhanced due to the fact that, in the virtual reality environment, small area geometric texture mapping will form a large visual difference under the limited screen resolution, resulting in visual jumps and flicker, which is commonly found in the 3D scenes built by the OSG graphics rendering engine, usually through the method of parallax mapping. This phenomenon is commonly found in 3D scenes built by OSG graphics engines and is usually mitigated by parallax mapping but can greatly increase the burden on the program. For finer 3D models and textures, antialiasing techniques for various types of graphics are the main means to improve the realism of the scene in Yangcheng. The Oculus layering component provides a variety of visual effects including sRGB corrected rendering to provide better support for antialiasing of graphics, as shown in Figure5. Usually, if the program requires detailed virtual reality rendering, then the more minute texture patches should be avoided as much as possible to appear within the visual range. In summary, this paper uses MultiSamplingAntiAliasing (MSAA) for the more marginal texture mapping and model details in the virtual reality immersive scene display, and the rendering process. The MSAA frame caching process is performed by disabling the default OSG frame cache object during rendering.Figure 5
Variation of sawtooth roughness in 3D model.The smaller the view distance, the smaller the drawing data volume of the scene, which is mainly due to the different cropping range of the view cone in different fields of view; the smaller the view distance, the less the scene content into the view cone field of view in Yangcheng. The frame rate (FPS, Frame Rates) of the woods scene under the four viewpoints is obtained separately, and the rendering efficiency of different drawing methods can be reflected more intuitively through comparative analysis. To facilitate the comparison, the program frame rates were obtained every 3 seconds, for a total of 25 times (75 seconds), as shown in Figure6.Figure 6
The program frame rates.The specific frame rates were obtained through the statistics state set of the OSG graphics rendering engine, in which the number of frames rendered per second and the traversal update time of the 3D scene were counted, respectively. Based on the different view distances, we analyzed viewpoint 1 and viewpoint 2 as scenes with larger data volume, respectively, independently, and had the following results (Figure7). In the case of viewpoint 1 and viewpoint 2, the rendering frame rate of the overall scene floats around 4 frames per second, and the scene drawing effect is less satisfactory in Yangcheng. Correspondingly, the frame rate of the scene drawn by the GPU-accelerated rendering method has a small increase, but it still cannot meet the minimum requirement of 30 frames per second for real-time rendering of 3D scenes. Therefore, it can be concluded that when the overall data volume of the scene is large, the GPU-accelerated rendering method based on the GLSL method does not meet the demand for real-time rendering of 3D landscapes, which is limited by the performance of hardware devices and requires consideration of various factors.Figure 7
Frame rate comparison between viewpoint 1 and viewpoint 2 rendering methods.


## 4. Conclusion

For the demand of real-time 3D scenes, a study on GPU-accelerated drawing and rendering of vegetation leaf facet data based on GLSL is conducted, and the uniform rendering of leaves is implemented by OpenGL shader language, and the uniform orientation matrix operation is performed on the facet data to simulate the Billboard role of OSG graphics rendering engine to reduce the number of GPU calls while improving the garden vegetation. The rendering efficiency of the landscape is reduced, and a comparative analysis is conducted for different vegetation rendering methods in Yangcheng. The experimental results show that the GPU-accelerated drawing method based on GLSL can significantly improve the drawing frame rate of 3D garden landscape vegetation scenes with a small amount of scene data and has a certain feasibility. Combining with the current new technology of 3D scene construction and visualization, based on the existing forest resource management software VisForest of this research team, the software has extended the functions of interactive organization and management of vegetation, real-time fluctuating water body construction, multichannel landscape construction of landscape architecture, and landscape element organization based on geometric vector layers. The integrated system with the ability to flexibly build 3D virtual landscape is formed, and based on the actual measurement data, it can build highly realistic vegetation, water bodies, and buildings, providing certain support for the virtual simulation of 3D landscape, and providing more convenient technical means for users to appreciate, evaluate, and visit the landscape.



---

*Source: 6083655-2021-06-18.xml*