Real-time Dynamic Generation System for 3D Model of Arch Dam

For the characteristics of arch dam pouring process and the disadvantages of previous simulation tools, this paper proposes the idea of generating dam body in real time by 3D cutting method. With this method, only one 3D model of the dam body need to be established, then other 3D models can be generated based on the input data of the users, which can accurately and efficiently simulate the pouring process.


Introduction
The pouring process simulation of traditional arch dams is usually to pre-defined some models of several pouring stages, then display each pouring model in the simulation process to achieve the animation simulation effect. The shortcoming of this method is that the model invocation has been fixed and immovable after encoding. If the model or the pouring time of arch dam changes, and different scene needs to be displayed, it has to be reencoded in these cases. Moreover, the multiple models also increase the memory consumption.
In view of the characteristics of arch dam pouring process and the disadvantages of previous simulation tools, this paper proposes the idea of generating dam body in real time by 3D cutting method. Only one piece of model data is retained in the memory, the current pouring stage and the elevation data of each dam section are inputted by the user, these elevation data are used to generate 3D cutting surfaces, and then these 3D cutting surfaces are used to conduct meet operation with the 3D model of the corresponding dam section. In the simulation field, common 3D models are composed by triangular patches and textures. Therefore, conduct meet operation of the triangle mesh and the cutting surface of each dam segment to generate new triangle vertices, and discard the vertices above the cutting surface, then connect other points of the same triangle patch to form a new triangle patch. The new generated triangle patch and the cutting surface form a new 3D model of the dam. Through this method, only one 3D model of the dam body need to be established, then other 3D models can be generated based on the input data of the users, which can accurately and efficiently simulate the pouring process.

Modeling
An important part of 3D simulation is the modeling of simulated objects, which goal is to simulate natural objects in a highly realistic way. According to the characteristics of the modeling object, the natural objects modeling can be divided into two categories: regular objects and irregular objects. Regular objects are the research content of traditional graphics, which technical basis is 3D geometric modeling, and can accurately present the simulated objects with geometric functions. Irregular objects are characterized by irregularities in shape, which are curved or wrinkled, and are difficult to represent in traditional geometric modeling. In the system of this paper, regular object modeling method is used, and 3D MAX software is used to complete the design of objects with regular geometry, as shown in Figure 1. demonstrate the simulation program, specially deploying database is costly. So, we designed a small data file and organized all the data used in the simulation into an XML file. Users can easily take data along by using mobile devices, such as USB flash drives, which can be read the data without support of the database.

Pouring simulation
The whole simulation takes the simulation file and time as input, and the simulation of the pouring state of the arch dam within the specified time as the final output. The accuracy of the system simulation is determined by the input data. In this system, the system simulation accuracy is accurate to a specific day, and the 3D pouring simulation flow chart is shown in Figure 2. When the system simulation runs, the user loads the surrounding environment data by selecting the simulation scheme in the simulation file, and then inputs the start and end time of the simulation. After the data verification module determines that the data input is correct, the database or the XML file is used to analysis the current elevation data. Then, from these elevation data, the height of a specific dam section at a specific time can be obtained. This elevation is used as a cutting surface, and the whole arch dam model is cut to the model at the current time point by using a 3D cutting algorithm to perform animation simulation. The OpenSceneGraph rendering module is then called to render the entire 3D scene, and the rendering result is submitted to the QT display module. Finally, the result is displayed through the window provided by QT.
The geometric models of the arch dam and the surrounding environment are stored on the disk in the form of files, and the height, temperature and weather conditions of each stage are saved in a database or XML file. The advantage of this method is that if the terrain or dam need to be changed, it is just need to copy the new elevation file to the appropriate directory and then change the configuration file.

Model tailoring implementation
The system 3D model is generated in advance by the 3D MAX modelling tool. The system supports model files in both ".ive" and ".osg" formats. After reading the model through OSG, the triangle patches of the various dam segments that make up the dam are analysed. Each dam section is made up by many triangles. The cutting surface is used to cut the model, that is, the triangles constituting each dam segment are performed clipping operation, and the intersection of the triangle and the cutting surface is obtained. Based on the number and position of the intersection points, a strategy of adopting a new triangle, or retaining the original triangle, or discarding the original triangle is adopted.
In the specific implementation, all triangular patches of the dam model are calculated. If a triangle has vertices above and below the cutting surface, new triangle vertices need to be created. As shown in Figure 3, an intersection is obtained by the triangle and the cutting surface, and other intersecting modes are similar. As shown in Figure 4, the generation process of the new triangle vertices is illustrated. In the vertex structure of the OSG, the coordinates of the vertices are stored in counter clockwise direction. In the upper triangle structure, the fixed points are sequentially named P0, P1, P2 in order, as shown in the following figure. The vertex above the cutting surface is P0, the vertexes below the cutting surface is P1 and P2. The intersection points are obtained in counter clockwise way, the point i is obtained first, and then the point j is obtained, so the storage order of the new vertex is i-j.  The new triangle is generated as shown in Figure 5. Since the generated vertices are stored in a counter clockwise direction, then △ iP1P2 and △ iP2j can be obtained. Since the normal vectors of each face need to be used in the light rendering, the vertices of all faces are stored counter clockwise to facilitate the uniform of normal vectors and make the light effect correct. After adopting the 3D cutting algorithm, the rendering can still reach 60 frames per second, which make the user watch and interact smoothly, and is basically no pause. If look at the memory footprint, it can be found that, compared with the traditional dynamic simulation, the memory consumption of the system is greatly reduced. Due to the reduction of memory usage, many data operations can be directly performed in the memory, which greatly reduces the memory at runtime. Therefore, the method of dynamically generating a model by using 3D cutting has strong practicability and can achieve the expected simulation effect, as shown in Figure 6.

Conclusion
This paper first analyses the advantages and disadvantages of traditional pouring simulation, and explains the 3D modelling method of the system in detail, then introduces the operation flow of the pouring simulation. Finally, the pouring simulation method proposed in this paper is illustrated particularly, and the expected experimental effect diagram is given.