GRAPHICS-IMAGE MIXED METHOD FOR LARGE-SCALE BUILDINGS RENDERING

Urban 3D model data is huge and unstructured, LOD and Out-of-core algorithm are usually used to reduce the amount of data that drawn in each frame to improve the rendering efficiency. When the scene is large enough, even the complex optimization algorithm is difficult to achieve better results. Based on the traditional study, a novel idea was developed. We propose a graphics and image mixed method for large-scale buildings rendering. Firstly, the view field is divided into several regions, the graphics-image mixed method used to render the scene on both screen and FBO, then blending the FBO with scree. The algorithm is tested on the huge CityGML model data in the urban areas of New York which contained 188195 public building models, and compared with the Cesium platform. The experiment result shows the system was running smoothly. The experimental results confirm that the algorithm can achieve more massive building scene roaming under the same hardware conditions, and can rendering the scene without vision loss.


INTRODUCTION
Constructing a smart city is an effective way to achieve the sustainable development and enhance the comprehensive competitiveness of cities.As an important part of smart city, Virtual City has application value in many fields, such as military, urban planning, traffic navigation, social entertainment and so on.3D City simulation technology application in the government departments of the municipal planning, can save design cost, improve working efficiency; In the military field, Training in the virtual city can improve the military combat effectiveness without the restriction of the political environment.
Urban model data is huge and complex structure, lack of an efficient visualization system is often one bottleneck of the digital cities application.With the progress of Technology, especially the rapid development of laser radar, unmanned aerial vehicle, oblique photograph, we can build a large scale textured 3D city models in acceptable time.The modeling efficiency and the quality of data are constantly improved, the technical difficulty of the visualization of large-scale urban 3D scene is also increasing.Although the capabilities of computer graphics hardware are greatly improved in recent decades, there are still many problems in the practical application of large-scale urban building model drawing technology.The 3D city simulation technology is one of the hot topics of common concern in GIS, 3D simulation fields.

RELATED WORKS
In the whole city scene, each visual scene contains thousands of buildings and millions of triangular patches, and because of the limited hardware performance of the computer, even with a complex algorithm, it's quite difficult to make full real-time rendering.
In the aspect of huge data storage service, the object oriented database which supporting spatial query is one of the mainstream schemes, the unstructured NoSQL database has become a hot spot of research.Shaojun L I provides technical details of a three-dimensional spatial database based on NoSQL (Shaojun L I,2014), Jung M G contrasts two common spatial databases of MongoDB and PostgreSQL (Jung M G et al., 2015).Spatial index is the key to efficient processing of massive data.The R tree is a widely used spatial index structure for massive urban 3D building models.LOD with Out-of-Core are the main methods of rendering the large scale 3D scene.Peng C implements the edge folding simplification algorithm, dynamic LOD technology by using GPU, and realizes the efficient rendering for complex models (Peng C, 2012).Jie H takes full advantage of GPU performance, implements R tree index by CUDA platform, and adopts a dynamic simplified LOD method in GPU to achieve efficient rendering for massive urban buildings (Jie H,2012).Zhou S propose a hybrid primitive LOD algorithm.The point and line primitive which is simpler used to build the coarse resolution model to improve the rendering efficiency (Zhou S, 2012).Compared with the traditional geometry LOD algorithm, the algorithm has multiple rendering acceleration.The R tree index is used and the adaptive LOD control method is adopted to realize the real-time loading for more than 20 thousand buildings (Gong J,2011).Based on the construction of network data service which accords with OGC standard, Prandi F implement it on the Nasa Java World Wind (NWW) and Cesium (Prandi F, 2015).Pispidikis I uses a service oriented visualization scheme for urban 3D model (Pispidikis I, 2016).
IBR(Image-based Rendering) is one of the mainstream technologies of large-scale urban 3D scene visualization.Compared with the geometric rendering technology, image rendering can drawing the large scale scene with unrelated to the complexity of the geometry.Street view map is a kind of widely used image rendering technology.However, some technical defects, like the lack of model's geometric information and difficult to roaming continuous, restricting the IBR applications.
Most existing rendering techniques, especially level of detail (LOD) processing, devoted to reduce the amount of data drawn in each frame.The algorithm are very complex.We present a graphics-image mixed approach, firstly, split the view frustum into three regions: the interesting region, the less interesting region and the uninteresting region, then we adopt the different rending method in each region.

METHODOLOGY
In vision principles, the brain is just focusing on few objects in the scene, which is the region of interest.It is same in 3D city simulation, a object's interesting level decrease as the distance becomes far away.So we can split the view frustum into three regions along the z axis: the interesting region, the less interesting region and the uninteresting region from near to far.Adopt different rending method in each region, make sure the real-time rendering and interactive in the interesting region.In the less interesting region and the uninteresting region, drawing the scene until the viewport is not moving.The IBR(image based rendering) and off-screen rendering technology is used, drawing the building models on a texture image which attaching the render buffer.At the end of a frame, blending the texture image with the interesting region, assemble the whole scene.All of the models only drawn once in the less interesting region and the uninteresting region, which can improvement in performance significantly.We also use the Frame-to-Frame coherence ( Peng C, 2012).The main process of the method includes building data model, view split, data IO and scene drawing.

BUILDINGS MODEL
CityGML is an open data model and XML-based standard for the representation of 3D urban objects, it is therefore used at the data level to store the information on the Database, however, in spite of it is designed to represent 3D city models, it is not efficient to present or visualize 3D city models directly.For this reason, we need to reprocess the data.R-tree is one of the most widely used spatial index structures, it is unjustified that building R-Tree index for these models directly, the tree is too deep and it makes too many draw calls which will cost efficiency.Cesium is the 3D platform for visualizing globes, from every satellite in space to every building, their biggest initiative is 3D Tiles Streaming, an open specification for streaming massive heterogeneous 3D geospatial datasets, including terrain, imagery, point clouds, and vector data.We use the 3D Tiles method to build 3D Building Tiles, split the city space in a sparse grid layout, these buildings in a same grid make a tile, each tile is one OpenGL draw call.Also build 3D R-Tree index for these tiles, no more details for R-Tree index is presented here.

FRUSTUM SPLIT
The scene split method is a key in this paper, PSSM(Parallel-split shadow maps) is an effective method to generation large scale scene shadow.We apply it's split method, split the view frustum into three regions: the interesting region, the less interesting region and the uninteresting region, and there will be two split points.It is very important to find the suitable points.The farther the distance from the split point to the near clip plane, the better the visual effect, but the performance is lower.
In order to balance the performance and visual effects, an adaptive method is adopted in this paper, setting appropriate split parameters based on the GPU's rendering and storage capabilities.

GRAPHICS-IMAGE MIXED RENDERING
After split the frustum, adopt different rending method in each region.Rendering the models in interesting region on screen in each frame.
For the less interesting region and the uninteresting region, drawing the scene when user stop move mouse and the eye point does not move.IBR(image based rendering) technology is used, drawing the building models on a FBO texture image.We don't clear the color buffer and depth buffer until it needs to redraw.After all draw calls are finished, blending the texture image with screen.Update operation completed on the updated thread, and the drawing operation is only run on the drawing thread.The specific drawing process for each frame is shown in Figure 2: First, compile operation, compile the model data that has been loaded in memory to VBO objects.Then drawing the models in interesting region, record the costing time, the maximum drawing time minus the recording time is the time for rendering off-screen.In the off-screen stage, first draw the model data in less interesting region.Draw the uninteresting region with streaming method, create a cache buffer  > in memory, and update data in  > based on view location.Assuming  > is the max size of  > , check the number of  > after update one model, the updating operation will suspend while the number of  > is bigger than  > .Rendering thread read model data in  > in turn, and builds VAO objects for drawing.Move the data in another buffer, and release by GC.

BLENDING WITH DEPTH INFORMATION
In each frame, after all draw calls are finished, the texture image should blend with screen, the traditional RTT technology blending the FBO color texture as a texture unit for a geometry in the scene.It can't deal with the z-fighting.For example, there is a mountain in the scene, and there are two build in the FBO, one is in front of the mountain, the other is behind the mountain.The RTT technology can't deal with that directly.For this reason, a new algorithm that blending the texture image with screen consideration of the depth information proposed in this paper.Before the off-screen rendering, enable the color and depth buffer.Setting the same size with screen buffer, also the model view matrix, projection matrix and lighting parameters, to get a same image.After the drawing, we get the color texture  @ABAC and depth texture DEFGH .Use the GPU programming, pass the  @ABAC and  DEFGH in GLSL as Uniform objects.For each pixel, compare  DEFGH and the screen depth buffer DEFGH , the smaller one is final color, the out color for pixel ,  is: @ABAC ,  ( DEFGH <  DEFGH )  @ABAC ,  ( DEFGH ≥  DEFGH ) (2)

BUILDING DATA STREAM
Based on the view frustum split, search and load data in each region.The retrieval operations for each region are executed on different threads, improve the retrieval efficiency.The retrieval process starts from the root node and traverses the scene tree with top-down, depth first traversal order.The specific retrieval steps are as follows: 1) Setting the root node as current node.

2)
Calculate the spatial relationship between the current node and the view frustum, if current node is outside frustum, go to step 6); if current node is inside frustum, go to step 4); otherwise go to step 3).

3)
Current node's children nodes[ & ,  ' …  V ], choose the  * =  ( & ,  ' …  V ) as current node,  * is the distance from  * to viewpoint.Go to step 2).4) If the current node has finish load process, stop retrieving and return.Otherwise use the method in step3) to select child node, if the child node is leaf node, go to step 5); if not, handle children nodes in turn and repeat this step.

5)
If the current leaf node needs to load model data, generate a request and place it in the update waiting queue.After the data has loaded in memory, place it in compile wait queue, and mark the node has updated.

6)
Collect all nodes that have been loaded under this node, and put them in the remove waiting queue, the application will release them later.The three regions are completely fit, that will repeat compute the nodes between two regions.For the leaf node, when calculate the spatial relationship with the far plane, only if the node is completely inside.

LOD
Multilevel detail is an effective method for large scale scene rendering.CityGML defines the detail hierarchy of the 3d city models, the building model is class into five different levels: LOD0 is an overview for the city; At LOD1, buildings are represented by block model with flat roofs; At LOD2, buildings have differentiated roof structures and thematically differentiated surfaces; LOD3 denotes architectural models with detailed wall and roof structures, balconies, bays and projections; LOD4 completes a LOD3 model by adding interior structures.LOD method applied in this paper, use the viewpoint distance as the LOD parameter, different level nodes correspond to different distance thresholds.Specific methods use the SSE(Screen Space Error): In the formula,  * is distance parameter of node in level ,  is the field, ℎ is the height of screen,  * is node's pixel parameter and  is the control coefficient.

IMPLEMENTATION
The algorithm is tested on a huge public CityGML model data in the urban areas of New York, which contains 188195 building models.The test system was deployed on a PC with Intel i5 processor, 8G memory, NVIDIA GT940 graphics card.The development environments were Windows 7 64 bit operating system, visual studio 12 compiler, Qt 5.4.2 and OpenSceneGraph-3.4.0.
The open source geo-database 3Dcitydb is used in the data processing work.3Dcitydb is implement by PostgreSQL and PostGIS, which can extract every single building to a PostGIS database from the very huge CityGML file, and then export the buildings with KML format.The C++ programming language and OSG is used to process the KML file and build the R-Tree index.
According to the method of this paper, the frustum is split into the interesting region, the less interesting region and the uninteresting region.Different regions are distinguished with different colors, as the interesting region is brighter and the less interesting region and the uninteresting region is dark, as shown in Figure 3.  Table 1: FPS statistics The result shows that the frame rate of this method is better than 20 frame/s in every scene drawing experiments, and frame rate is stable in each case, no matter how many building models in the test scene.
The Cesium 3D platform provides an open access service for the experimental data.We also compared the visualization result with Cesium platform, and the results shown in Figure and 6. Figure 5 is the result of our algorithm, as Figure 6 is the result of Cesium.result shows that the LOD algorithm used in Cesium extract only some buildings in the distance to improve the rendering efficiency, which will lose some models in the scene.But our technology can drawing the whole scene without any loss.

CONCLUSION
The algorithm proposed in this paper mixed the graphics rendering and the imaged rendering method.This algorithm maintained the continuity of scene roaming, and at the same time it has the advantage of image-based rendering technology that the rendering frame rate is independent of the scene scale.The experimental results demonstrate that, for the huge low resolution building scene, the algorithm can improve data bearing capacity of visualization system, especially the large-scale lower resolution building scene .It can roaming the huge building data smoothly under the conditions of that the hardware has lower performance relatively, and finally rendering the scene without vision loss.There are also some shortcomings in this method, the moving of viewpoint will make scene redraw.It will take some time to rending the off-screen image with a negative impact on user experience.We are going to do further research on the optimization: during the viewpoint moving, we can apply the affine transformation and resampling process on the off-screen image by the model matrix.

Figure 1 :
Figure 1: The overview of our approach In the search stage, sort the nodes[1, 2,…] which need load data by the distance to eye point, the node  & and  ' are the two split point, the interesting region is the nodes[1, 2,… & ], the less interesting region is the nodes[ & + 1 ,  & + 2 ,…  ' ] and the uninteresting region is nodes[  ' + 1,  ' + 2,…].Discuss the value of  & and  ' , the more the value of  & , the better the rendering quality, while it will cost much time to draw the interesting region.Models in the less interesting region and the uninteresting region stored in GPU, the value of  ' will refer to the GPU's memory capacity.The value of  & and  ' influenced by the model data and the hardware performance, assuming  * is the maximum memory for the data,  , is the memory size of node , the split point  * should be satisfied: the value of the  & is just the initial value, during the drawing process, count the time used for real time rendering of interest region in each frame, optimize the value of  & .Assuming  * is the distance from split point to the near clip plane,  * =   * − ,   * means the distance from node  * to eye point.

Figure 3 :
Figure 3: The scene split result Integrated with the algorithm proposed in this paper, a large-scale building 3D scene roaming application with texture

Figure 4 :
Figure 4: Building scene Frame rate is one of the important parameters of the 3D simulation system, and the frame rate of this algorithm is tested.Several groups of experiments are conducted to count the scene drawing frame rate, and the amount of building model data is different in each experiment.The tests compare our algorithms with the traditional algorithms which used LOD and Out-of-core algorithms reduce linear.

Figure 5 :
Figure 5: The result of our algorithm Figure 6: The result of Cesium