Model display control method and device based on digital twin system, and medium
By using simplification rate in the digital twin system to simplify the model and render and display control based on the attribute data of the component set, the problem of slow speed of the digital twin system when loading complex and fine models is solved, and efficient model loading and display control is achieved.
Patent Information
- Application Number
- CN202510131617.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-06
- Publication Date
- 2025-03-07
- Estimated Expiration
- 2045-02-06
AI Technical Summary
Digital twin systems are slow to load complex and fine models, and traditional technologies and hardware are difficult to achieve real-time rendering and interaction, resulting in difficulty in model display control.
By obtaining comprehensive information of the model, the simplification rate of components is used to simplify polygons, reduce the amount of model data, and render and display control based on the attribute data of the component set. The simplification rate is determined by mapping component distance and material brightness and darkness, ensuring that the model maintains high visual quality after simplification.
It significantly reduces the amount of data of the model, improves loading speed, reduces rendering overhead, and ensures high visual quality of the model and the availability of user interaction.
Smart Images

Figure CN119579751A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a model display control method, device and medium based on a digital twin system. Background Art
[0002] In the physical world, large buildings are often composed of hundreds of thousands, millions, or even tens of millions of basic components; the corresponding digital twin models have the characteristics of large files, many types of components, and different component materials and fineness; based on complex and sophisticated models, digital twin systems can apply intelligent algorithms such as big data analysis and machine learning to achieve intelligent monitoring and prediction of system operation status. In traditional methods, digital twin systems create three-dimensional models by collecting data from actual physical systems, importing them into the system, and using rendering engines and interactive control tools to load, display, and control these complex and sophisticated models.
[0003] However, due to the huge amount of complex and sophisticated model data and the long loading process, the digital twin system loads the model slowly; at the same time, due to the performance bottlenecks of traditional technology and hardware when processing high-precision models, it is difficult to achieve real-time rendering and interaction, so effective display control of the model also faces severe challenges. Summary of the invention
[0004] The present invention provides a model display control method, device and medium based on a digital twin system to solve the problem of difficulty in increasing the loading speed of the model, thereby effectively controlling the display of the model.
[0005] Get comprehensive information about the model; The components of the model are polygonally simplified according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined according to the distance between the component and the model surface and the lightness and darkness of the component material after processing the comprehensive information in a manner of mapping the component distance; The component set is rendered according to the attribute data of the component set, and display control is performed on the rendered component set of the model.
[0006] The polygon simplification in the present invention can significantly reduce the amount of data in the model, thereby reducing the loading time and improving the loading speed of the model. Since the rendering algorithm is optimized according to the attribute data of the component to restore the visual effect of the original model as much as possible, the rendering process can ensure that the simplified model still maintains a high visual quality. The display control allows the user to interact with the model as needed, which can ensure that the user can accurately observe and operate the model, and improve the usability and practicality of the model. Among them, for the simplification rate, the data mapping process can convert the comprehensive information of the model into a unified standard scale, which is convenient for subsequent quantitative analysis and comparison; and the simplification rate is established based on factors such as the distance of the component from the model surface and the brightness of the model material, which means that in the simplification process, the components that are far from the model surface or have a lower brightness of the material will be simplified more. This method can significantly reduce the amount of data in the model, especially those details that have little impact on the overall visual effect, thereby reducing the amount of data required to be processed during loading, improving the loading speed, reducing freezes and delays, and realizing effective display control of the model.
[0007] Compared with the prior art, the present invention uses the simplification rate to accurately simplify the polygons of model components, significantly reducing the amount of model data, thereby speeding up the loading speed and improving the system performance; using the attribute data of the component set for rendering and display control ensures that the model can still present high-quality visual effects after simplification, thereby solving the problem of difficulty in increasing the loading speed of the model and thus effectively controlling the display of the model.
[0008] As a preferred solution, the simplification rate is determined according to the distance between the component and the model surface and the lightness of the component material after processing the comprehensive information in a manner of mapping the component distance, specifically: According to the comprehensive information, respectively calculating the distance between the mesh of each component and the mesh of the outer surface of the model as the first distance set of the model; Continuously mapping the first distance set to a preset value range, and establishing a distance-based simplification rate linear equation according to the mapped first distance set; Establishing a simplification rate function according to the lightness and darkness of the component material in the model; The simplification rate of the component in the comprehensive information is calculated according to the simplification rate linear equation and the simplification rate function.
[0009] This preferred solution can capture the geometric relationship inside the model in detail by calculating the precise distance between the component mesh and the model's outer surface mesh, providing a reliable data basis for subsequent simplification operations; the first distance set is continuously mapped to a preset numerical range, and the mapping rules can be adjusted as needed to adapt to different simplification needs and accuracy requirements; a distance-based simplification rate linear equation is established, which can intuitively reflect the linear relationship between distance and simplification rate, making the simplification operation more scientific and reasonable. The lightness and darkness of the component material in the model is included in the consideration range of the simplification rate function, further improving the accuracy and adaptability of the simplification rate.
[0010] As a preferred solution, the component set is rendered according to the attribute data of the component set, and the component set of the model after rendering is displayed and controlled, specifically: Classifying the component set according to component material, and obtaining a first component set by merging component meshes of the same material; Based on the first component set, the textures contained in the mesh grids in each type of material are merged to obtain a second component set; The second component set is rendered, and display control is performed on the rendered model component set.
[0011] This preferred solution can significantly reduce the number of material calls during rendering by merging meshes of the same material, thereby reducing the communication overhead between the CPU and GPU and improving rendering efficiency. Merging meshes and textures can reduce the number of objects in memory, especially when there are a large number of similar objects in the scene, this method can significantly save memory resources.
[0012] As a preferred solution, the component set is classified according to component material, and the first component set is obtained by merging component meshes of the same material, specifically: Traversing each component in the component set to obtain a field data set related to the material; If the field data in the field data set are equal, the corresponding components are classified into one category to obtain a component set classification result; The mesh vertices of the same material in the component set classification results are merged and marked to obtain the first component set.
[0013] This preferred solution groups components of the same material into one category and merges their mesh vertices, which helps to maintain the consistency of the model in terms of material and avoid material confusion or inconsistency.
[0014] As a preferred solution, based on the first component set, the textures contained in the mesh grids in each type of material are merged to obtain the second component set, specifically: Based on the first component set, the total size of the large texture image is calculated according to the total size of all small texture images and the target expansion size; On the large texture picture, determining a unique and non-overlapping designated position for all the small texture pictures according to the total size, and pasting all the small texture pictures to the designated position of the large texture picture to obtain a transition construction set including the large texture picture; The texture coordinates of the large texture image in the transition building set are updated to obtain the second building block set.
[0015] This preferred solution avoids texture overlap and conflict during rendering by determining unique and non-overlapping designated positions for all small texture images on the large texture image, thereby improving rendering accuracy and stability. During the rendering process, since all textures are integrated into the large texture image, the number of texture switching can be reduced, thereby reducing rendering overhead and improving rendering efficiency.
[0016] As a preferred solution, the texture coordinates of the large texture image in the transition building set are updated to obtain the second building block set, specifically: Obtain the UV coordinates of each vertex in all the small texture images to obtain an initial coordinate set; According to the offsets of all the small texture images in the large texture image and the initial coordinate set, an actual UV coordinate set is calculated based on the overall size of the large texture image; The corresponding values of texture coordinates of the large texture image in the transition building set are updated according to the actual UV coordinate set to obtain the second component set.
[0017] This preferred solution takes into account the offset of the small texture image in the large texture image when calculating the actual UV coordinate set, which ensures that the texture can still be correctly mapped to the model surface even after the small texture image is integrated into the large texture image. In addition, since the UV coordinates and offset of each vertex are taken into account, the problem of texture breakage or dislocation during the rendering process can be avoided, which helps to maintain the texture consistency and continuity of the model surface.
[0018] As a preferred solution, the second component set is rendered, and the rendered model component set is displayed and controlled, specifically: Setting corresponding material parameters according to the material information of the second component set; Generating texture data according to the texture map of the second component set, and activating the texture unit corresponding to the texture data; generating a rendering image of the second component set according to the material parameters, the texture data and the mesh data of the second component set, and displaying the model in the form of the rendering image in a rendering window; The second component set of the model is controlled according to the unique identifier of the component in the second component set.
[0019] This preferred solution sets corresponding material parameters according to the material information of the second component set, and can accurately control the material performance of the model, such as color, glossiness, transparency, etc., so as to enhance the visual effect of the model. Generating texture data according to the texture map of the second component set and activating the corresponding texture unit can ensure the accurate mapping and display of the texture on the model surface, which helps to improve the detail expression and realism of the model.
[0020] As a preferred solution, polygon simplification is performed on the components of the model according to the simplification rate of the components in the comprehensive information to obtain a simplified component set, specifically: Establishing a simplification rate target according to the simplification rate of the component in the comprehensive information; Establishing a Laplace matrix according to the grid in the model and performing eigenvalue decomposition to obtain an eigenvalue set; Acquire a number of eigenvalues less than a preset value in the eigenvalue set, remove eigenvectors corresponding to the number of eigenvalues, and obtain a spectrum simplification result; According to the shape characteristics of the mesh in the model, the influence of each vertex and edge on the overall shape of the mesh is evaluated to obtain an importance evaluation result; According to the importance evaluation result, vertices and edges that do not meet the preset conditions are removed to obtain a shape simplification result; The components of the model are iteratively simplified until the spectrum simplification result or the shape simplification result meets the simplification rate target, thereby obtaining the simplified component set.
[0021] In this preferred solution, an important feature of the digital twin city is dynamic visualization and intelligent deduction. Complex models may make dynamic visualization vague or difficult to understand, and may also make the results of intelligent deduction inaccurate or difficult to explain, which may make the model function difficult to achieve or the effect greatly reduced. Through eigenvalue decomposition and importance assessment, unnecessary details in the model that do not affect the overall shape or function can be identified and removed, thereby reducing the complexity of the model; by removing redundant information, the simplified model can more accurately reflect the core characteristics and laws of the urban system, thereby improving the accuracy and credibility of the intelligent deduction results; and the clarity and fluency of dynamic visualization can be improved, allowing users to more easily understand and use the digital twin city system.
[0022] As a preferred solution, the influence of each vertex and edge on the overall shape of the mesh is evaluated according to the shape characteristics of the mesh in the model to obtain an importance evaluation result, specifically: According to the concave-convex degree of the grid in the model, a curvature calculation result is calculated; Calculating the geometric feature calculation results according to the side lengths and angles of triangles connected to the mesh vertices in the model; According to the mesh edge length in the model and the flatness of the triangles on both sides of the edge, the edge importance influence result is calculated; The curvature calculation result, the geometric feature calculation result and the edge importance influence result are linearly combined and calculated according to a preset weight coefficient set to obtain the importance evaluation result.
[0023] In this preferred solution, the model that needs to be controlled by the digital twin city usually contains a large number of mesh elements and complex geometric shapes, which makes it particularly difficult to evaluate the importance of each element. By calculating the curvature of the mesh, the geometric characteristics of the triangles connected to the vertices, and the importance of the edges, the various shapes, sizes, and topological structure characteristics of the mesh elements in the model can be captured; this solution establishes a unified and comprehensive evaluation standard for different mesh elements, which can effectively solve the problem of evaluating the importance of mesh elements in the digital twin city model and provide a more accurate and reliable basis for the simplification of the model.
[0024] The present application also provides a model display control device based on a digital twin system, which is applicable to a digital twin city system and includes an information module, a simplification module and a control module; Wherein, the information module is used to obtain comprehensive information of the model; The simplification module is used to perform polygon simplification on the components of the model according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined according to the distance between the component and the model surface and the lightness and darkness of the component material after processing the comprehensive information in a manner of mapping the component distance; The control module is used to render the component set according to the attribute data of the component set, and to perform display control on the rendered component set of the model.
[0025] As a preferred solution, the simplification module includes a distance unit, a mapping unit, a function unit and a simplification rate unit; The distance unit is used to calculate the distance between the mesh of each component and the mesh of the outer surface of the model according to the comprehensive information, as the first distance set of the model; The mapping unit is used to continuously map the first distance set into a preset value range, and establish a distance-based simplification rate linear equation according to the mapped first distance set; The function unit is used to establish a simplification rate function according to the lightness and darkness of the component material in the model; The simplification rate unit is used to calculate the simplification rate of the component in the comprehensive information according to the simplification rate linear equation and the simplification rate function.
[0026] As a preferred solution, the control module includes a material unit, a texture unit and a rendering unit; The material unit is used to classify the component set according to the component material, and obtain the first component set by merging the component meshes of the same material; The texture unit is used to merge the textures contained in the mesh grids in each type of material based on the first component set to obtain a second component set; The rendering unit is used to render the second component set and perform display control on the rendered model component set.
[0027] As a preferred solution, the material unit includes a field subunit, a classification subunit and a tag subunit; Wherein, the field subunit is used to traverse each component in the component set to obtain a field data set of related materials; The classification subunit is used to classify the corresponding components into one category if the field data in the field data set are equal, so as to obtain a component set classification result; The marking subunit is used to merge and mark mesh vertices of the same material in the component set classification result to obtain the first component set.
[0028] As a preferred solution, the texture unit includes a size subunit, a pasting subunit and an updating subunit; The size subunit is used to calculate the total size of the large texture image based on the first component set and the total size of all small texture images and the target expansion size; The pasting subunit is used to determine a unique and non-overlapping designated position for all the small texture images on the large texture image according to the total size, and paste all the small texture images to the designated position of the large texture image to obtain a transition construction set including the large texture image; The updating subunit is used to update the texture coordinates of the large texture image in the transition building set to obtain the second building block set.
[0029] As a preferred solution, the updating subunit is specifically: Obtain the UV coordinates of each vertex in all the small texture images to obtain an initial coordinate set; According to the offsets of all the small texture images in the large texture image and the initial coordinate set, an actual UV coordinate set is calculated based on the overall size of the large texture image; The corresponding values of texture coordinates of the large texture image in the transition building set are updated according to the actual UV coordinate set to obtain the second component set.
[0030] As a preferred solution, the rendering unit includes a parameter subunit, an activation subunit, a display subunit and a control subunit; Wherein, the parameter subunit is used to set corresponding material parameters according to the material information of the second component set; The activation subunit is used to generate texture data according to the texture map of the second component set, and activate the texture unit corresponding to the texture data; The display subunit is used to generate a rendering image of the second component set according to the material parameters, the texture data and the mesh data of the second component set, and display the model in the form of the rendering image in a rendering window; The control subunit is used to control the second component set of the model according to the unique identifier of the component in the second component set.
[0031] As a preferred solution, the simplified module includes a target unit, a feature unit, a spectrum unit, a shape unit, a simplified unit and a component set unit; Wherein, the target unit is used to establish a simplification rate target according to the simplification rate of the component in the comprehensive information; The feature unit is used to establish a Laplace matrix according to the grid in the model and perform eigenvalue decomposition to obtain an eigenvalue set; The spectrum unit is used to obtain a number of eigenvalues in the eigenvalue set that are smaller than a preset value, remove eigenvectors corresponding to the number of eigenvalues, and obtain a spectrum simplification result; The shape unit is used to evaluate the influence of each vertex and edge on the overall shape of the mesh according to the shape characteristics of the mesh in the model to obtain an importance evaluation result; The simplification unit is used to remove vertices and edges that do not meet preset conditions according to the importance evaluation result to obtain a shape simplification result; The component set unit is used to iteratively simplify the components of the model until the spectrum simplification result or the shape simplification result meets the simplification rate target, thereby obtaining the simplified component set.
[0032] As a preferred solution, the shape unit includes a curvature subunit, a side length subunit, a flat subunit and a combination subunit; Wherein, the curvature subunit is used to calculate the curvature calculation result according to the concavity and convexity of the grid in the model; The side length subunit is used to calculate the geometric feature calculation result according to the side length and angle of the triangle connected to the mesh vertex in the model; The flattening subunit is used to calculate the edge importance impact result according to the mesh edge length and the flatness of the triangles on both sides of the edge in the model; The combination subunit is used to perform linear combination calculation on the curvature calculation result, the geometric feature calculation result and the edge importance influence result according to a preset weight coefficient set to obtain the importance evaluation result.
[0033] The present application also provides a storage medium, on which a computer program is stored. The computer program is called and executed by a computer to implement the model display control method based on the digital twin system as described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 It is a flow chart of a model display control method based on a digital twin system provided in an embodiment of the present application; Figure 2 is a distance-based simplified rate graph provided in an embodiment of the present application; Figure 3 is a simplification rate curve diagram based on material brightness provided in an embodiment of the present application; Figure 4 It is a technical implementation flow chart provided by the embodiment of the present application; Figure 5 It is a structural schematic diagram of a model display control device based on a digital twin system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0035] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0036] In the description of this application, it should be understood that the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "several" means two or more.
[0037] A model display control method based on a digital twin system provided in an embodiment of the present application is mainly used in situations where it is necessary to speed up the model loading speed of the digital twin city system and improve the rendering efficiency, so as to effectively control the display of the model.
[0038] Embodiment 1: See also Figure 1 The embodiment of the present application provides a model display control method based on a digital twin system, which is applicable to a digital twin city system, including S1~S3, and the specific implementation steps are as follows: S1. Obtain comprehensive information of the model.
[0039] Step S1 of the embodiment of the present application is specifically as follows: Load the model through the digital twin city system, open and parse the model file, and obtain the model component list; the "digital twin city system" is a technical system that converts all aspects of the physical world of the city into digital form. It can achieve comprehensive monitoring, prediction and optimization of the city's operating status through real-time data exchange and simulation analysis between cyberspace and the physical world; Traverse each component of the model according to the model component list, obtain the attribute information of each component, and store the attribute information in the database table (inf table) according to the preset rules; Get the geometric information (mesh) of each component and store it in the database mesh table according to preset rules; The comprehensive information of the model is composed of the separated attribute information and geometric information.
[0040] Among them, each row of the inf table represents the attribute information of the component, and the record contains two fields: featureId and inf, where featureId is the component id parsed from the model file, and inf is the attribute set of the component. The example is as follows: featureId: "90b2daded26f183e3ddeb5ca17c8e00a", inf: "{"name":"wall","attribute1":"100 cubic","attribute2":"built in August 2021"}; Each row in the mesh table represents the geometric information of a component, where featureId is the unique identifier of the component and value is the mesh data of the component; mesh data includes vertex coordinates of the triangular mesh (such as a vertex is "{x, y, z}"), vertex normals, texture data (texture image file path), texture coordinates {u, v}, material information (diffuse reflection, specular reflection parameters, ambient light, glossiness) and other parameters.
[0041] S2. Simplify the components of the model polygonally according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined by processing the comprehensive information in a manner of mapping the component distance, and according to the distance between the component and the model surface and the brightness of the component material.
[0042] Step S2 of the embodiment of the present application includes S2.1 to S2.2, wherein S2.1 is a process of calculating the simplification rate, and S2.2 is a process of simplifying the model according to the simplification rate, specifically: S2.1. Based on the comprehensive information, the distance between the mesh of each component and the mesh of the outer surface of the model is calculated as the first distance set of the model. An example is as follows: the Computational Geometry Algorithms Library (CGAL) can be used to calculate the mesh of the outer surface of the model, and then the distance between the component mesh and the mesh of the outer surface of the model is calculated to obtain the component distance d; correspondingly, there is a maximum component distance and minimum component distance ;in, A "mesh" is a data structure composed of elements such as vertices, edges, and faces (usually triangles or quadrilaterals).
[0043] The first distance set is continuously mapped to the [0-1] space, and a distance-based simplification rate linear equation is established based on the mapped first distance set. ; For the first distance set after mapping, the maximum value of d is 1, the minimum value is 0, and the intermediate value is Take values according to geometric difference; According to the lightness and darkness of the component materials in the model, a simplification rate function m(x) is established; According to the simplified linear equation The simplification rate of the component in the comprehensive information is calculated by the simplification rate function m(x) .
[0044] The intermediate values are: The simplified rate linear equation is: The simplified rate function is: The simplified rate is: Where x represents the distance between each component and the model surface. Indicates the maximum value of the distance between the component and the model surface; represents the simplification rate used when the component is closest to the surface (such as 0.8), Indicates the simplification rate used when the component is farthest from the surface (e.g. 0.3); It indicates the base simplification rate when the material is extremely bright or dark; b indicates the value of x when the maximum simplification rate is achieved; c is the preset parameter. is a mathematical constant, Indicates the lightness or darkness of the material; For preset values, you can set it based on experience, such as If 0.8 is used, then m(x) is 0.2. You can also set a more complex weight calculation method, such as It can be designed as a function with distance as the independent variable. The total simplification rate of d(x) at different distances is The influence weights of are also different, so as to achieve more precise simplification rate control.
[0045] To apply the embodiments of this application, please refer to Figure 2~3 ; Figure 2 is a distance-based simplified rate graph provided in an embodiment of the present application, indicating and The value of is shown in the figure; Figure 2 In the simplified linear equation In terms of It can be seen that the smaller the distance is, the closer the component is to the model surface, and the larger the simplification rate needs to be set. The simplification rate is the percentage value of the number of triangles retained.
[0046] Figure 3 : is a simplification rate curve diagram based on material brightness provided by an embodiment of the present application, wherein the four curves represent examples of four values of c, and in actual application, one can be selected according to the specific situation; the x-axis represents the material brightness value, and the value is between [0,1]; the y-axis represents the simplification rate corresponding to a certain brightness, and the value is between ( ],according to Figure 3 That is (0.3, 0.8]. From the curve, we can see that when it is extremely dark, x=0.0, the simplification rate is close to 0.3; when it is extremely bright, x=1.0, the simplification rate is close to 0.3, but when the brightness value is between 0 and 1, it is simplified to a parabolic change.
[0047] exist Figure 3 In the simplification rate function m(x), c affects the width of the protruding part of the curve, because the x value in the simplification function is between [0-1], and m(x) is between ( ] interval, and the opening of the curve is downward; the smaller c is, the narrower the protrusion of the curve is, which means that when x is in a small range (narrow interval) of light and dark intervals, the simplification rate changes more significantly than other intervals; it can be seen that the relationship between lightness and simplification rate is not a linear increasing or decreasing relationship, but a curve, indicating that in a certain interval of light and dark, the simplification rate is large, while other areas decrease symmetrically; among them, " ” indicates the maximum simplification rate set.
[0048] exist Figure 3 middle, =0.3, + =0.8, that is, range=0.5, when the curve peaks, x=0.5, that is, b=0.5. Among them, x represents the brightness of the material, which is obtained by adding the diffuseBrightness, specularBrightness, ambientBrightness, and shininess{value} of the material (diffuse, specular, and ambient use three-channel data, such as {r, g, b}, and glossiness is single-channel data, and each channel in all parameters has a value between 0 and 1): When the material is extremely bright (x=1) or extremely dark (x=0), the simplification rate of this part is 0.3 (the number of triangles needs to be reduced to 30% of the original number); when the material is between extremely bright and extremely dark, the simplification rate is 0.8 (reduced to 80% of the original number of triangles); therefore, the difference in simplification rates between components can be adjusted through the designed simplification rate function m(x).
[0049] from Figure 3 As can be seen from the curve, by setting the 4 parameters, we can achieve when the lightness reaches the maximum or minimum simplification rate; we can also achieve whether the simplification rate changes smoothly or quickly in different lightness ranges. In practical applications, we need to retain triangulated meshes as much as possible for components of certain materials, while retaining triangulated meshes as little as possible for other components. For example: if the model retains more triangles (large simplification rate) when the lightness is between 0.4 and 0.6, and the model is as small as possible when the lightness is other than 0.6, then c can take a smaller value.
[0050] This embodiment S2.1 can capture the geometric relationship inside the model in detail by calculating the precise distance between the component mesh and the model's outer surface mesh, providing a reliable data basis for subsequent simplification operations; the first distance set is continuously mapped to a preset numerical range, and the mapping rules can be adjusted as needed to adapt to different simplification needs and accuracy requirements; a simplification rate linear equation based on distance is established, which can intuitively reflect the linear relationship between distance and simplification rate, making the simplification operation more scientific and reasonable. The lightness and darkness of the component material in the model is included in the consideration range of the simplification rate function, which further improves the accuracy and adaptability of the simplification rate; Furthermore, the simplification rate function constructed in this embodiment can ensure that the simplification rate is and By inputting different light and dark values according to the function algorithm between the maximum values, the corresponding simplification rate can be obtained.
[0051] S2.2. Based on the simplification rate of components in the comprehensive information Establish simplification rate targets; The grid in the model is regarded as a graph structure, and the corresponding Laplacian matrix is established and eigenvalue decomposition is performed to obtain the eigenvalue set and the corresponding eigenvector set; wherein the Laplacian matrix can reflect the connection relationship and boundary conditions between the grid vertices, the eigenvalue represents the spectral information of the grid, and the eigenvector represents the different spectral components of the grid; A number of eigenvalues smaller than a preset value in the eigenvalue set are obtained, and the eigenvectors corresponding to the eigenvalues are removed to obtain a spectrum simplification result.
[0052] Obtain key shape features of the mesh in the model, such as edges, corners, curvatures, etc., to obtain a shape feature set; Based on the shape feature set, the curvature calculation result is calculated according to the concavity and convexity of the mesh in the model; Based on the shape feature set, the geometric feature calculation results are calculated according to the side lengths and angles of the triangles connected to the mesh vertices in the model; Based on the shape feature set, the edge importance impact result is calculated according to the mesh edge length and the flatness of the triangles on both sides of the edge in the model; According to the preset weight coefficient set, the curvature calculation results, the geometric feature calculation results and the edge importance influence results are linearly combined to obtain the importance evaluation result; According to the importance evaluation results, vertices and edges that do not meet the preset conditions are removed to obtain a simplified shape result.
[0053] Use software such as MeshLab to iteratively simplify the model components until the spectrum simplification results or shape simplification results meet the simplification rate target, and obtain the simplified component set; among them, "MeshLab" is an open source, portable and extensible 3D geometry processing system, mainly used for interactive processing and unstructured editing of 3D triangular meshes.
[0054] An example is as follows: if you input a mesh containing 1 million triangles and a simplification rate target, MeshLab will return a new mesh with the number of triangles being "1 million x simplification rate"; and the component mesh simplification affects the three fields of the data structure: "Points, Normals, and Texturecoords."
[0055] The specific calculation method of the curvature calculation result is: Combined with the shape feature set, use 3D modeling software to read the model, extract the mesh vertex coordinates in the model, record the 3D position of each vertex, and extract the mesh edge and face information, record the two endpoints of each edge and the vertices contained in each face, and obtain the basic information of the mesh; According to the basic information, the features of the grid are extracted at different scales to obtain multi-scale features; the multi-scale features are fused by feature splicing to obtain a feature set.
[0056] Based on the feature set, the global stiffness matrix is assembled according to the stiffness matrix of the mesh units in the model and the node connection relationship; according to the global shape constraint conditions, the corresponding displacement or force is applied to the boundary nodes of the model as boundary conditions; internal constraints are established according to the geometric relationship or topological structure in the model; According to the global stiffness matrix, boundary conditions and internal constraints, the finite element equation is established; the finite element equation is solved to obtain the displacement vector of the node.
[0057] According to the displacement vector and the material constitutive relation of the model, the curvature calculation result is calculated.
[0058] Among them, the specific calculation method of the weight coefficient set is: The curvature calculation results, geometric feature calculation results and edge importance influence results are standardized, and the covariance matrix between the indicators is calculated based on the standardized data; Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors; according to the size of the eigenvalues, select the first k principal components with eigenvalues greater than 1 as the principal component set; According to the eigenvectors of the principal component set and the original data, the principal component linear combination coefficient set and the variance contribution rate set are calculated; and according to the principal component linear combination coefficient set and the variance contribution rate set, the weight coefficient set is calculated.
[0059] An important feature of a digital twin city is dynamic visualization and intelligent deduction. Complex models may make dynamic visualization blurry or difficult to understand, and may also make the results of intelligent deduction inaccurate or difficult to explain, which may make the model function difficult to achieve or greatly reduce the effect. This embodiment S2.2 can identify and remove unnecessary details in the model that do not affect the overall shape or function through eigenvalue decomposition and importance assessment, thereby reducing the complexity of the model; by removing redundant information, the simplified model can more accurately reflect the core characteristics and laws of the urban system, thereby improving the accuracy and credibility of the intelligent deduction results; and the clarity and fluency of dynamic visualization can be improved, allowing users to more easily understand and use the digital twin city system; In addition, the models that need to be controlled by digital twin cities usually contain a large number of mesh elements and complex geometric shapes, which makes it particularly difficult to evaluate the importance of each element. By calculating the curvature of the mesh, the geometric characteristics of the triangles connected to the vertices, and the importance of the edges, the various shapes, sizes, and topological structure characteristics of the mesh elements in the model can be captured; this scheme establishes a unified and comprehensive evaluation standard for different mesh elements, which can effectively solve the problem of importance evaluation of mesh elements in digital twin city models and provide a more accurate and reliable basis for model simplification.
[0060] S3. Rendering the component set according to the attribute data of the component set, and performing display control on the component set of the rendered model.
[0061] In the embodiment of the present application, step S3 includes S3.1 to S3.4, wherein S3.1 is a process of performing merging processing to establish a first component set, S3.2 is a process of pasting pictures according to the first component set to establish a second component set, S3.3 is a process of displaying a model according to the second component set, and S3.4 is a process of controlling a model according to the second component set, specifically: S3.1, traverse each component in the component set to obtain the field data set of the relevant material (Materal field data); If the field data in the field data set are equal, the corresponding components are classified into one category to obtain the component set classification result; The mesh vertices of the same material in the component set classification results are merged and marked to obtain the first component set, specifically: n features in the same material are combined into one, including materialId (unique identifier of the material), common Materal (material), Texture (texture information), and merged Points, Normals and Texturecoords; and, a "feature1_id" is added to each vertex in Points, and the "id" is the component id (component identifier), which can be used to identify which component the point belongs to in the original model file, and the id is used for subsequent rendering and control operations.
[0062] In this embodiment S3.1, by merging meshes of the same material, the number of material calls during rendering can be significantly reduced, thereby reducing the communication overhead between the central processing unit (CPU) and the graphics processing unit (GPU), and improving rendering efficiency. Merging meshes and textures can reduce the number of objects in memory, especially when there are a large number of similar objects in the scene, this method can significantly save memory resources; In addition, grouping components of the same material into one category and merging their mesh vertices can help maintain the consistency of the model's material and avoid material confusion or inconsistency.
[0063] S3.2, based on the first component set, according to the total size of all small texture images and the target expansion size, calculate the total size of the large texture image; On the large texture image, determine a unique and non-overlapping designated position for all small texture images according to the total size, and paste all small texture images to the designated position of the large texture image to obtain a transition construction set including the large texture image; Get the UV coordinates of each vertex in all small texture images to get the initial coordinate set; the UV coordinates refer to the pixels or texels in the texture image corresponding to the mesh vertex; According to the offset and initial coordinate set of all small texture images in the large texture image, the actual UV coordinate set is calculated based on the overall size of the large texture image; The texture coordinate corresponding values of the large texture image in the transition construction set are updated according to the actual UV coordinate set to obtain a second component set.
[0064] An example is as follows: the pixel size of a texture image is 256×256, and the texture coordinates are (20, 30). The corresponding pixel is the position of the texture image with the lower right corner as the origin, 20 pixels to the right horizontally, and 30 pixels to the top vertically. If the texture image is merged into a 4096×4096 large png with the lower right corner as the origin at (40, 50). Then the new texture coordinates need to be calculated considering the position of the texture image in the large png and updated to (20+40, 30+50). If one large png is not enough, then multiple large pngs may be needed, and the texture coordinates can be calculated according to the corresponding large png; "png" refers to an image file format, the full name of which is Portable Network Graphics.
[0065] In this embodiment S3.2, by determining unique and non-overlapping designated positions for all small texture images on the large texture image, texture overlap and conflict are avoided during the rendering process, thereby improving rendering accuracy and stability. During the rendering process, since all textures are integrated into the large texture image, the number of texture switching can be reduced, thereby reducing rendering overhead and improving rendering efficiency; Furthermore, when calculating the actual UV coordinate set, the offset of the small texture image in the large texture image is taken into account, which ensures that the texture can still be correctly mapped to the model surface even after the small texture image is integrated into the large texture image. In addition, since the UV coordinates and offsets of each vertex are taken into account, the problem of texture breakage or dislocation during the rendering process can be avoided, which helps to maintain the texture consistency and continuity of the model surface.
[0066] S3.3, prepare the 3D rendering environment, including setting up the rendering window and view volume and other conventional 3D rendering preparations; Set corresponding material parameters according to the material information of the second component set (Materal); Generate texture data according to the texture map of the second component set, and activate the texture unit (Texture) corresponding to the texture data; pass the data such as vertices, normals and texture coordinates of multiple meshes to the graphics processing unit at one time, so as to batch draw the mesh data; A rendering image of the second component set is generated according to the material parameters, the texture data and the mesh data of the second component set, and the model is displayed in the form of a rendering image in a rendering window of a 3D rendering environment.
[0067] In this embodiment S3.3, the corresponding material parameters are set according to the material information of the second component set, so that the material performance of the model, such as color, glossiness, transparency, etc., can be accurately controlled, thereby enhancing the visual effect of the model. Generating texture data according to the texture map of the second component set and activating the corresponding texture unit can ensure the accurate mapping and display of the texture on the model surface, which helps to improve the detail expression and realism of the model.
[0068] S3.4, the user clicks a certain position in the model with the mouse, the system captures the mouse click event and records the click position; According to the mouse click position, the digital twin city system generates a ray starting from the observation point and passing through the click position; the ray is used to perform intersection tests with the meshes in the model, especially for merged meshes with different materials, to determine which merged mesh the ray intersects with; In the intersecting merged mesh, further calculate which triangle the ray intersects with; after determining the intersecting triangle, check the vertex information of the triangle, extract the featureid (unique identifier) from the vertex of the triangle, and use the obtained featureid to find the corresponding attribute data in the info attribute table for display; According to the needs of users or the preset logic of the digital twin city system, control operations such as display, hiding, and deletion are performed on the components with specific featureids in the second component set, thereby achieving the purpose of controlling the model.
[0069] It should be noted that the process of processing, displaying and controlling the model in this application is all completed based on the digital twin city system.
[0070] To apply the embodiments of this application, please refer to Figure 4 , Figure 4 It is a technical implementation flow chart provided in an embodiment of the present application, which shows the general process of processing, displaying and controlling the model according to the digital twin city system in the first embodiment of the present application.
[0071] Overall, this embodiment has the following beneficial effects: The polygon simplification in this application can significantly reduce the amount of data in the model, thereby reducing the loading time and increasing the loading speed of the model. Since the rendering algorithm will be optimized according to the attribute data of the component to restore the visual effect of the original model as much as possible, the rendering process can ensure that the simplified model still maintains a high visual quality. The display control allows the user to interact with the model as needed, which can ensure that the user can accurately observe and operate the model, and improve the usability and practicality of the model. Among them, for the simplification rate, the data mapping process can convert the comprehensive information of the model into a unified standard scale, which is convenient for subsequent quantitative analysis and comparison; and the simplification rate is established based on factors such as the distance of the component from the model surface and the brightness of the model material. This means that in the simplification process, components that are farther away from the model surface or have lower material brightness will be simplified more. This method can significantly reduce the amount of data in the model, especially those details that have less impact on the overall visual effect, thereby reducing the amount of data required to be processed during loading, increasing the loading speed, reducing freezes and delays, and achieving effective display control of the model; In summary, this application improves the speed of loading complex and detailed models and the rendering frame rate of complex and detailed models in the digital twin system, and can also maintain the integrity of the model attribute data, making it convenient for the system to query the attributes of components and control display and hiding.
[0072] Embodiment 2: See also Figure 5 , an embodiment of the present application provides a model display control device based on a digital twin system, which is applicable to a digital twin city system, and includes an information module 10, a simplification module 20 and a control module 30; Wherein, the information module 10 is used to obtain comprehensive information of the model; The simplification module 20 is used to perform polygon simplification on the components of the model according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined according to the distance between the component and the model surface and the lightness and darkness of the component material after processing the comprehensive information in a manner of mapping the component distance; The control module 30 is used to render the component set according to the attribute data of the component set and to perform display control on the component set of the rendered model.
[0073] In one embodiment, the information module 10 is specifically: Load the model through the digital twin city system, open and parse the model file, and obtain the model component list; the "digital twin city system" is a technical system that converts all aspects of the physical world of the city into digital form. It can achieve comprehensive monitoring, prediction and optimization of the city's operating status through real-time data exchange and simulation analysis between cyberspace and the physical world; Traverse each component of the model according to the model component list, obtain the attribute information of each component, and store the attribute information in the database table (inf table) according to the preset rules; Get the geometric information (mesh) of each component and store it in the database mesh table according to preset rules; The comprehensive information of the model is composed of the separated attribute information and geometric information.
[0074] Among them, each row of the inf table represents the attribute information of the component, and the record contains two fields: featureId and inf, where featureId is the component id parsed from the model file, and inf is the attribute set of the component. The example is as follows: featureId: "90b2daded26f183e3ddeb5ca17c8e00a", inf: "{"name":"wall","attribute1":"100 cubic","attribute2":"built in August 2021"}; Each row in the mesh table represents the geometric information of a component, where featureId is the unique identifier of the component and value is the mesh data of the component; mesh data includes vertex coordinates of the triangular mesh (such as a vertex is "{x, y, z}"), vertex normals, texture data (texture image file path), texture coordinates {u, v}, material information (diffuse reflection, specular reflection parameters, ambient light, glossiness) and other parameters.
[0075] In one embodiment, the simplification module 20 includes a distance unit, a mapping unit, a function unit, a simplification rate unit, a target unit, a feature unit, a spectrum unit, a curvature subunit, a side length subunit, a flat subunit, a combination subunit, a simplification unit, and a component set unit; wherein the distance unit, the mapping unit, the function unit, and the simplification rate unit are processes for calculating the simplification rate, and the target unit, the feature unit, the spectrum unit, the curvature subunit, the side length subunit, the flat subunit, the combination subunit, the simplification unit, and the component set unit are processes for simplifying the model according to the simplification rate; Among them, the distance unit is used to calculate the distance between the mesh of each component and the mesh of the outer surface of the model according to the comprehensive information, as the first distance set of the model. The following is an example: the Computational Geometry Algorithms Library (CGAL) can be used to calculate the mesh of the outer surface of the model, and then the distance between the component mesh and the mesh of the outer surface of the model is calculated to obtain the component distance d; correspondingly, there is a maximum component distance and minimum component distance ;in, A "mesh" is a data structure composed of elements such as vertices, edges, and faces (usually triangles or quadrilaterals).
[0076] A mapping unit, used to continuously map the first distance set to a [0-1] space, and establish a distance-based simplification rate linear equation according to the mapped first distance set ; For the first distance set after mapping, the maximum value of d is 1, the minimum value is 0, and the intermediate value is Take values according to geometric difference; Function unit, used to establish the simplification rate function m(x) according to the lightness and darkness of the component material in the model; Simplification rate unit, used to simplify the linear equation according to the simplified rate The simplification rate of the component in the comprehensive information is calculated by the simplification rate function m(x) .
[0077] The intermediate values are: The simplified rate linear equation is: The simplified rate function is: The simplified rate is: Where x represents the distance between each component and the model surface. Indicates the maximum value of the distance between the component and the model surface; represents the simplification rate used when the component is closest to the surface (such as 0.8), Indicates the simplification rate used when the component is farthest from the surface (e.g. 0.3); It indicates the base simplification rate when the material is extremely bright or dark; b indicates the value of x when the maximum simplification rate is achieved; c is the preset parameter. is a mathematical constant, Indicates the lightness or darkness of the material; For preset values, you can set it based on experience, such as If 0.8 is used, then m(x) is 0.2. You can also set a more complex weight calculation method, such as It can be designed as a function with distance as the independent variable. The total simplification rate of d(x) at different distances is The influence weights of are also different, so as to achieve more precise simplification rate control.
[0078] To apply the embodiments of this application, please refer to Figure 2~3 ; Figure 2 is a distance-based simplified rate graph provided in an embodiment of the present application, indicating and The value of is shown in the figure; Figure 2 In the simplified linear equation In terms of It can be seen that the smaller the distance is, the closer the component is to the model surface, and the larger the simplification rate needs to be set. The simplification rate is the percentage value of the number of triangles retained.
[0079] Figure 3 : is a simplification rate curve diagram based on material brightness provided by an embodiment of the present application, wherein the four curves represent examples of four values of c, and in actual application, one can be selected according to the specific situation; the x-axis represents the material brightness value, and the value is between [0,1]; the y-axis represents the simplification rate corresponding to a certain brightness, and the value is between ( ],according to Figure 3 That is (0.3, 0.8]. From the curve, we can see that when it is extremely dark, x=0.0, the simplification rate is close to 0.3; when it is extremely bright, x=1.0, the simplification rate is close to 0.3, but when the brightness value is between 0 and 1, it is simplified to a parabolic change.
[0080] exist Figure 3 In the simplification rate function m(x), c affects the width of the protruding part of the curve, because the x value in the simplification function is between [0-1], and m(x) is between ( ] interval, and the opening of the curve is downward; the smaller c is, the narrower the protrusion of the curve is, which means that when x is in a small range (narrow interval) of light and dark intervals, the simplification rate changes more significantly than other intervals; it can be seen that the relationship between lightness and simplification rate is not a linear increasing or decreasing relationship, but a curve, indicating that in a certain interval of light and dark, the simplification rate is large, while other areas decrease symmetrically; among them, " " indicates the maximum simplification rate set.
[0081] exist Figure 3 middle, =0.3, + =0.8, that is, range=0.5, when the curve peaks, x=0.5, that is, b=0.5. Among them, x represents the brightness of the material, which is obtained by adding the diffuseBrightness, specularBrightness, ambientBrightness, and shininess{value} of the material (diffuse, specular, and ambient use three-channel data, such as {r, g, b}, and glossiness is single-channel data, and each channel in all parameters has a value between 0 and 1): When the material is extremely bright (x=1) or extremely dark (x=0), the simplification rate of this part is 0.3 (the number of triangles needs to be reduced to 30% of the original number); when the material is between extremely bright and extremely dark, the simplification rate is 0.8 (reduced to 80% of the original number of triangles); therefore, the difference in simplification rates between components can be adjusted through the designed simplification rate function m(x).
[0082] from Figure 3 As can be seen from the curve, by setting the 4 parameters, we can achieve when the lightness reaches the maximum or minimum simplification rate; we can also achieve whether the simplification rate changes smoothly or quickly in different lightness ranges. In practical applications, we need to retain triangulated meshes as much as possible for components of certain materials, while retaining triangulated meshes as little as possible for other components. For example: if the model retains more triangles (large simplification rate) when the lightness is between 0.4 and 0.6, and the model is as small as possible when the lightness is other than 0.6, then c can take a smaller value.
[0083] The distance unit, mapping unit, function unit and simplification rate unit of this embodiment can capture the geometric relationship inside the model in detail by calculating the precise distance between the component mesh and the mesh of the outer surface of the model, providing a reliable data basis for subsequent simplification operations; the first distance set is continuously mapped to a preset numerical range, and the mapping rules can be adjusted as needed to adapt to different simplification needs and accuracy requirements; a simplification rate linear equation based on distance is established, which can intuitively reflect the linear relationship between distance and simplification rate, making the simplification operation more scientific and reasonable. The lightness and darkness of the component material in the model is included in the consideration range of the simplification rate function, which further improves the accuracy and adaptability of the simplification rate; Furthermore, the simplification rate function constructed in this embodiment can ensure that the simplification rate is and By inputting different light and dark values according to the function algorithm between the maximum values, the corresponding simplification rate can be obtained.
[0084] Target unit, used to simplify the components according to the comprehensive information Establish simplification rate targets; The feature unit is used to regard the grid in the model as a graph structure, establish the corresponding Laplace matrix and perform eigenvalue decomposition to obtain the eigenvalue set and the corresponding eigenvector set; wherein the Laplace matrix can reflect the connection relationship and boundary conditions between the grid vertices, the eigenvalue represents the spectral information of the grid, and the eigenvector represents the different spectral components of the grid; The spectrum unit is used to obtain a number of eigenvalues less than a preset value in the eigenvalue set, remove the eigenvectors corresponding to the several eigenvalues, and obtain a spectrum simplification result.
[0085] The curvature subunit is used to obtain the key shape features of the mesh in the model, such as edges, corners, curvatures, etc., to obtain a shape feature set; The curvature subunit is also used to calculate the curvature calculation result based on the shape feature set and the degree of concavity and convexity of the mesh in the model; The side length subunit is used to calculate the geometric feature calculation results based on the shape feature set and the side lengths and angles of the triangles connected to the mesh vertices in the model; The flat subunit is used to calculate the edge importance impact result based on the shape feature set, according to the mesh edge length and the flatness of the triangles on both sides of the edge in the model; A combination subunit is used to perform linear combination calculation on the curvature calculation result, the geometric feature calculation result and the edge importance influence result according to a preset weight coefficient set to obtain an importance evaluation result; The simplification unit is used to remove vertices and edges that do not meet preset conditions according to the importance evaluation results to obtain a shape simplification result.
[0086] The component set unit is used to iteratively simplify the components of the model using software such as MeshLab until the spectrum simplification result or the shape simplification result meets the simplification rate target, thereby obtaining a simplified component set; among them, "MeshLab" is an open source, portable and extensible 3D geometry processing system, mainly used for interactive processing and unstructured editing of 3D triangular meshes.
[0087] An example is as follows: if you input a mesh containing 1 million triangles and a simplification rate target, MeshLab will return a new mesh with the number of triangles being "1 million x simplification rate"; and the component mesh simplification affects the three fields of the data structure: "Points, Normals, and Texturecoords."
[0088] The specific calculation method of the curvature calculation result is: Combined with the shape feature set, use 3D modeling software to read the model, extract the mesh vertex coordinates in the model, record the 3D position of each vertex, and extract the mesh edge and face information, record the two endpoints of each edge and the vertices contained in each face, and obtain the basic information of the mesh; According to the basic information, the features of the grid are extracted at different scales to obtain multi-scale features; the multi-scale features are fused by feature splicing to obtain a feature set.
[0089] Based on the feature set, the global stiffness matrix is assembled according to the stiffness matrix of the mesh units in the model and the node connection relationship; according to the global shape constraint conditions, the corresponding displacement or force is applied to the boundary nodes of the model as boundary conditions; internal constraints are established according to the geometric relationship or topological structure in the model; According to the global stiffness matrix, boundary conditions and internal constraints, the finite element equation is established; the finite element equation is solved to obtain the displacement vector of the node.
[0090] According to the displacement vector and the material constitutive relation of the model, the curvature calculation result is calculated.
[0091] Among them, the specific calculation method of the weight coefficient set is: The curvature calculation results, geometric feature calculation results and edge importance influence results are standardized, and the covariance matrix between the indicators is calculated based on the standardized data; Perform eigenvalue decomposition on the covariance matrix to obtain eigenvalues and corresponding eigenvectors; according to the size of the eigenvalues, select the first k principal components with eigenvalues greater than 1 as the principal component set; According to the eigenvectors of the principal component set and the original data, the principal component linear combination coefficient set and the variance contribution rate set are calculated; and according to the principal component linear combination coefficient set and the variance contribution rate set, the weight coefficient set is calculated.
[0092] An important feature of a digital twin city is dynamic visualization and intelligent deduction. A complex model may make dynamic visualization blurry or difficult to understand, and may also make the results of intelligent deduction inaccurate or difficult to explain, which may make the model function difficult to achieve or greatly reduce the effect. In this embodiment, the target unit, feature unit, spectrum unit, curvature subunit, edge length subunit, flat subunit, combination subunit, simplified unit and component set unit can identify and remove unnecessary details in the model that do not affect the overall shape or function through eigenvalue decomposition and importance evaluation, thereby reducing the complexity of the model; by removing redundant information, the simplified model can more accurately reflect the core characteristics and laws of the urban system, thereby improving the accuracy and credibility of the intelligent deduction results; and the clarity and fluency of dynamic visualization can be improved, allowing users to more easily understand and use the digital twin city system; In addition, the models that need to be controlled by digital twin cities usually contain a large number of mesh elements and complex geometric shapes, which makes it particularly difficult to evaluate the importance of each element. By calculating the curvature of the mesh, the geometric characteristics of the triangles connected to the vertices, and the importance of the edges, the various shapes, sizes, and topological structure characteristics of the mesh elements in the model can be captured; this scheme establishes a unified and comprehensive evaluation standard for different mesh elements, which can effectively solve the problem of importance evaluation of mesh elements in digital twin city models and provide a more accurate and reliable basis for model simplification.
[0093] In one embodiment, the control module 30 includes a field subunit, a classification subunit and a mark subunit, a size subunit, a paste subunit and an update subunit, a parameter subunit, an activation subunit and a display subunit and a control subunit; wherein the field subunit, the classification subunit and the mark subunit are processes for performing a merging process to establish a first component set, the size subunit, the paste subunit and the update subunit are processes for pasting pictures according to the first component set to establish a second component set, the parameter subunit, the activation subunit and the display subunit are processes for displaying a model according to the second component set, and the control subunit is a process for controlling a model according to the second component set; Among them, the field subunit is used to traverse each component in the component set to obtain the field data set of the relevant material (Materal field data); The classification subunit is used to classify the corresponding components into one category if the field data in the field data set are equal, so as to obtain the component set classification result; The marking subunit is used to merge and mark the mesh vertices of the same material in the component set classification results to obtain the first component set, specifically: n features in the same material are combined into one, including materialId (unique identifier of the material), common Materal (material), Texture (texture information), and merged Points, Normals and Texturecoords; and, a "feature1_id" is added to each vertex in Points, and the "id" is the component id (component identifier), which can be used to identify which component the point belongs to in the original model file, and the id is used for subsequent rendering and control operations.
[0094] In this embodiment, the field subunit, classification subunit, and marking subunit can significantly reduce the number of material calls during rendering by merging meshes of the same material, thereby reducing the communication overhead between the central processing unit (CPU) and the graphics processing unit (GPU), and improving rendering efficiency. Merging meshes and textures can reduce the number of objects in memory, especially when there are a large number of similar objects in the scene, this method can significantly save memory resources; In addition, grouping components of the same material into one category and merging their mesh vertices can help maintain the consistency of the model's material and avoid material confusion or inconsistency.
[0095] A size subunit, configured to calculate the total size of the large texture image based on the first component set and the total size of all small texture images and the target expansion size; The pasting subunit is used to determine a unique and non-overlapping designated position for all small texture images on the large texture image according to the total size, and paste all small texture images to the designated position of the large texture image to obtain a transition construction set including the large texture image; The update subunit is used to obtain the UV coordinates of each vertex in all small texture images to obtain an initial coordinate set; wherein the UV coordinates refer to the pixels or texels in the texture image corresponding to the mesh vertex; The update subunit is further used to calculate the actual UV coordinate set based on the overall size of the large texture image according to the offsets and initial coordinate sets of all small texture images in the large texture image; The updating subunit is further used to update the corresponding values of the texture coordinates of the large texture image in the transition building set according to the actual UV coordinate set to obtain the second component set.
[0096] An example is as follows: the pixel size of a texture image is 256×256, and the texture coordinates are (20, 30). The corresponding pixel is the position of the texture image with the lower right corner as the origin, 20 pixels to the right horizontally, and 30 pixels to the top vertically. If the texture image is merged into a 4096×4096 large png with the lower right corner as the origin at (40, 50). Then the new texture coordinates need to be calculated considering the position of the texture image in the large png and updated to (20+40, 30+50). If one large png is not enough, then multiple large pngs may be needed, and the texture coordinates can be calculated according to the corresponding large png; "png" refers to an image file format, the full name of which is Portable Network Graphics.
[0097] In this embodiment, the size subunit, the pasting subunit and the updating subunit determine unique and non-overlapping designated positions for all small texture images on the large texture image, thereby avoiding overlap and conflict of textures during the rendering process and improving the accuracy and stability of rendering. During the rendering process, since all textures are integrated into the large texture image, the number of texture switching can be reduced, thereby reducing rendering overhead and improving rendering efficiency; Furthermore, when calculating the actual UV coordinate set, the offset of the small texture image in the large texture image is taken into account, which ensures that the texture can still be correctly mapped to the model surface even after the small texture image is integrated into the large texture image. In addition, since the UV coordinates and offsets of each vertex are taken into account, the problem of texture breakage or dislocation during the rendering process can be avoided, which helps to maintain the texture consistency and continuity of the model surface.
[0098] The parameter subunit is used to prepare the 3D rendering environment, including setting the rendering window and view volume, and other general 3D rendering preparations; The parameter subunit is further used to set corresponding material parameters (Materal) according to the material information of the second component set; The activation subunit is used to generate texture data according to the texture map of the second component set and activate the texture unit (Texture) corresponding to the texture data; the data such as vertices, normals and texture coordinates of multiple meshes are transmitted to the graphics processing unit at one time, so as to batch draw the mesh data; The display subunit is used to generate a rendering image of the second component set according to the material parameters, texture data and mesh data of the second component set, and display the model in the form of a rendering image in a rendering window of a 3D rendering environment.
[0099] In this embodiment, the parameter subunit, activation subunit and display subunit set corresponding material parameters according to the material information of the second component set, and can accurately control the material performance of the model, such as color, glossiness, transparency, etc., so as to enhance the visual effect of the model. Generating texture data according to the texture map of the second component set and activating the corresponding texture unit can ensure the accurate mapping and display of the texture on the model surface, which helps to improve the detail expression and realism of the model.
[0100] The control subunit is used for the user to click a certain position in the model with the mouse, and the system captures the mouse click event and records the click position; The control subunit is also used to generate a ray from the observation point through the clicked position according to the mouse click position by the digital twin city system; the ray is used to perform intersection test with the meshes in the model, especially for merged meshes with different materials, so as to determine which merged mesh the ray intersects with; The control subunit is also used to further calculate which triangle the ray intersects with in the intersecting merged mesh; after determining the intersecting triangle, check the vertex information of the triangle, extract the featureid (unique identifier) from the vertex of the triangle, and use the obtained featureid to find the corresponding attribute data in the info attribute table for display; The control subunit is also used to perform control operations such as displaying, hiding, and deleting components with specific featureids in the second component set according to user needs or the preset logic of the digital twin city system, thereby achieving the purpose of controlling the model.
[0101] It should be noted that the process of processing, displaying and controlling the model in this application is all completed based on the digital twin city system.
[0102] To apply the embodiments of this application, please refer to Figure 4 , Figure 4 It is a technical implementation flow chart provided in an embodiment of the present application, which shows the general process of processing, displaying and controlling the model according to the digital twin city system in the second embodiment of the present application.
[0103] Overall, this embodiment has the following beneficial effects: The polygon simplification in this application can significantly reduce the amount of data in the model, thereby reducing the loading time and increasing the loading speed of the model. Since the rendering algorithm will be optimized according to the attribute data of the component to restore the visual effect of the original model as much as possible, the rendering process can ensure that the simplified model still maintains a high visual quality. The display control allows the user to interact with the model as needed, which can ensure that the user can accurately observe and operate the model, and improve the usability and practicality of the model. Among them, for the simplification rate, the data mapping process can convert the comprehensive information of the model into a unified standard scale, which is convenient for subsequent quantitative analysis and comparison; and the simplification rate is established based on factors such as the distance of the component from the model surface and the brightness of the model material. This means that in the simplification process, components that are farther away from the model surface or have lower material brightness will be simplified more. This method can significantly reduce the amount of data in the model, especially those details that have less impact on the overall visual effect, thereby reducing the amount of data required to be processed during loading, increasing the loading speed, reducing freezes and delays, and achieving effective display control of the model; In summary, this application improves the speed of loading complex and detailed models and the rendering frame rate of complex and detailed models in the digital twin system, and can also maintain the integrity of the model attribute data, making it convenient for the system to query the attributes of components and control display and hiding.
[0104] Embodiment three: An embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium includes a stored computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute the model display control method based on the digital twin system; Wherein, the model display control method based on the digital twin system, if implemented in the form of a software functional unit and used as an independent product, can be stored in a computer-readable storage medium. Based on such an understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Wherein, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0105] The above are preferred embodiments of the present invention. It should be noted that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications are also considered to be within the scope of protection of the present invention.
Claims
1. A model display control method based on a digital twin system, characterized in that: Applicable to digital twin city systems, including: Get comprehensive information about the model; The components of the model are polygonally simplified according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined according to the distance between the component and the model surface and the lightness and darkness of the component material after processing the comprehensive information in a manner of mapping the component distance; The component set is rendered according to the attribute data of the component set, and display control is performed on the rendered component set of the model.
2. A model display control method based on a digital twin system according to claim 1, characterized in that: The simplification rate is determined by processing the comprehensive information in a manner of mapping the component distance, according to the distance between the component and the model surface and the brightness of the component material, specifically: According to the comprehensive information, respectively calculating the distance between the mesh of each component and the mesh of the outer surface of the model as the first distance set of the model; Continuously mapping the first distance set to a preset value range, and establishing a distance-based simplification rate linear equation according to the mapped first distance set; Establishing a simplification rate function according to the lightness and darkness of the component material in the model; The simplification rate of the component in the comprehensive information is calculated according to the simplification rate linear equation and the simplification rate function.
3. A model display control method based on a digital twin system according to claim 1, characterized in that: Rendering the component set according to the attribute data of the component set, and performing display control on the component set of the model after rendering, specifically: Classifying the component set according to component material, and obtaining a first component set by merging component meshes of the same material; Based on the first component set, the textures contained in the mesh grids in each type of material are merged to obtain a second component set; The second component set is rendered, and display control is performed on the rendered model component set.
4. A model display control method based on a digital twin system as claimed in claim 3, characterized in that: The component set is classified according to the component material, and the first component set is obtained by merging the component meshes of the same material, specifically: Traversing each component in the component set to obtain a field data set related to the material; If the field data in the field data set are equal, the corresponding components are classified into one category to obtain a component set classification result; The mesh vertices of the same material in the component set classification results are merged and marked to obtain the first component set.
5. A model display control method based on a digital twin system as claimed in claim 3, characterized in that: Based on the first component set, the textures contained in the mesh grids in each type of material are merged to obtain the second component set, which is specifically: Based on the first component set, the total size of the large texture image is calculated according to the total size of all small texture images and the target expansion size; On the large texture picture, determining a unique and non-overlapping designated position for all the small texture pictures according to the total size, and pasting all the small texture pictures to the designated position of the large texture picture to obtain a transition construction set including the large texture picture; The texture coordinates of the large texture image in the transition building set are updated to obtain the second building block set.
6. A model display control method based on a digital twin system as claimed in claim 5, characterized in that: The texture coordinates of the large texture image in the transition building set are updated to obtain the second building block set, specifically: Obtain the UV coordinates of each vertex in all the small texture images to obtain an initial coordinate set; According to the offsets of all the small texture images in the large texture image and the initial coordinate set, an actual UV coordinate set is calculated based on the overall size of the large texture image; The corresponding values of texture coordinates of the large texture image in the transition building set are updated according to the actual UV coordinate set to obtain the second component set.
7. A model display control method based on a digital twin system as claimed in claim 3, characterized in that: Rendering the second component set and performing display control on the rendered model component set is specifically as follows: Setting corresponding material parameters according to the material information of the second component set; Generating texture data according to the texture map of the second component set, and activating the texture unit corresponding to the texture data; generating a rendering image of the second component set according to the material parameters, the texture data and the mesh data of the second component set, and displaying the model in the form of the rendering image in a rendering window; The second component set of the model is controlled according to the unique identifier of the component in the second component set.
8. The model display control method based on the digital twin system according to claim 1, characterized in that: The components of the model are polygonally simplified according to the simplification rate of the components in the comprehensive information to obtain a simplified component set, specifically: Establishing a simplification rate target according to the simplification rate of the component in the comprehensive information; Establishing a Laplace matrix according to the grid in the model and performing eigenvalue decomposition to obtain an eigenvalue set; Acquire a number of eigenvalues less than a preset value in the eigenvalue set, remove eigenvectors corresponding to the number of eigenvalues, and obtain a spectrum simplification result; According to the shape characteristics of the mesh in the model, the influence of each vertex and edge on the overall shape of the mesh is evaluated to obtain an importance evaluation result; According to the importance evaluation result, vertices and edges that do not meet the preset conditions are removed to obtain a shape simplification result; The components of the model are iteratively simplified until the spectrum simplification result or the shape simplification result meets the simplification rate target, thereby obtaining the simplified component set.
9. A model display control method based on a digital twin system as claimed in claim 8, characterized in that: According to the shape characteristics of the mesh in the model, the influence of each vertex and edge on the overall shape of the mesh is evaluated to obtain the importance evaluation result, which is specifically: According to the concave-convex degree of the grid in the model, a curvature calculation result is calculated; Calculating the geometric feature calculation results according to the side lengths and angles of triangles connected to the mesh vertices in the model; According to the mesh edge length in the model and the flatness of the triangles on both sides of the edge, the edge importance influence result is calculated; The curvature calculation result, the geometric feature calculation result and the edge importance influence result are linearly combined and calculated according to a preset weight coefficient set to obtain the importance evaluation result.
10. A model display control device based on a digital twin system, characterized in that: Applicable to the digital twin city system, including information module, simplified module and control module; Wherein, the information module is used to obtain comprehensive information of the model; The simplification module is used to perform polygon simplification on the components of the model according to the simplification rate of the components in the comprehensive information to obtain a simplified component set; wherein the simplification rate is determined according to the distance between the component and the model surface and the lightness and darkness of the component material after processing the comprehensive information in a manner of mapping the component distance; The control module is used to render the component set according to the attribute data of the component set, and to perform display control on the rendered component set of the model.
11. A model display control device based on a digital twin system according to claim 10, characterized in that: The simplification module includes a distance unit, a mapping unit, a function unit and a simplification rate unit; The distance unit is used to calculate the distance between the mesh of each component and the mesh of the outer surface of the model according to the comprehensive information, as the first distance set of the model; The mapping unit is used to continuously map the first distance set into a preset value range, and establish a distance-based simplification rate linear equation according to the mapped first distance set; The function unit is used to establish a simplification rate function according to the lightness and darkness of the component material in the model; The simplification rate unit is used to calculate the simplification rate of the component in the comprehensive information according to the simplification rate linear equation and the simplification rate function.
12. A model display control device based on a digital twin system according to claim 10, characterized in that: The control module includes a material unit, a texture unit and a rendering unit; The material unit is used to classify the component set according to the component material, and obtain the first component set by merging the component meshes of the same material; The texture unit is used to merge the textures contained in the mesh grids in each type of material based on the first component set to obtain a second component set; The rendering unit is used to render the second component set and perform display control on the rendered model component set.
13. A model display control device based on a digital twin system according to claim 12, characterized in that: The material unit includes a field subunit, a classification subunit and a tag subunit; Wherein, the field subunit is used to traverse each component in the component set to obtain a field data set of related materials; The classification subunit is used to classify the corresponding components into one category if the field data in the field data set are equal, so as to obtain a component set classification result; The marking subunit is used to merge and mark mesh vertices of the same material in the component set classification result to obtain the first component set.
14. A model display control device based on a digital twin system according to claim 12, characterized in that: The texture unit includes a size subunit, a paste subunit and an update subunit; The size subunit is used to calculate the total size of the large texture image based on the first component set and the total size of all small texture images and the target expansion size; The pasting subunit is used to determine a unique and non-overlapping designated position for all the small texture images on the large texture image according to the total size, and paste all the small texture images to the designated position of the large texture image to obtain a transition construction set including the large texture image; The updating subunit is used to update the texture coordinates of the large texture image in the transition building set to obtain the second building block set.
15. A model display control device based on a digital twin system according to claim 14, characterized in that: The updating subunit is specifically: Obtain the UV coordinates of each vertex in all the small texture images to obtain an initial coordinate set; According to the offsets of all the small texture images in the large texture image and the initial coordinate set, an actual UV coordinate set is calculated based on the overall size of the large texture image; The corresponding values of texture coordinates of the large texture image in the transition building set are updated according to the actual UV coordinate set to obtain the second component set.
16. A model display control device based on a digital twin system according to claim 12, characterized in that: The rendering unit includes a parameter subunit, an activation subunit, a display subunit and a control subunit; Wherein, the parameter subunit is used to set corresponding material parameters according to the material information of the second component set; The activation subunit is used to generate texture data according to the texture map of the second component set, and activate the texture unit corresponding to the texture data; The display subunit is used to generate a rendering image of the second component set according to the material parameters, the texture data and the mesh data of the second component set, and display the model in the form of the rendering image in a rendering window; The control subunit is used to control the second component set of the model according to the unique identifier of the component in the second component set.
17. The model display control device based on the digital twin system according to claim 10, characterized in that: The simplified module includes a target unit, a feature unit, a spectrum unit, a shape unit, a simplified unit and a component set unit; Wherein, the target unit is used to establish a simplification rate target according to the simplification rate of the component in the comprehensive information; The feature unit is used to establish a Laplace matrix according to the grid in the model and perform eigenvalue decomposition to obtain an eigenvalue set; The spectrum unit is used to obtain a number of eigenvalues in the eigenvalue set that are smaller than a preset value, remove eigenvectors corresponding to the number of eigenvalues, and obtain a spectrum simplification result; The shape unit is used to evaluate the influence of each vertex and edge on the overall shape of the mesh according to the shape characteristics of the mesh in the model to obtain an importance evaluation result; The simplification unit is used to remove vertices and edges that do not meet preset conditions according to the importance evaluation result to obtain a shape simplification result; The component set unit is used to iteratively simplify the components of the model until the spectrum simplification result or the shape simplification result meets the simplification rate target, thereby obtaining the simplified component set.
18. A model display control device based on a digital twin system according to claim 17, characterized in that: The shape unit includes a curvature subunit, a side length subunit, a flat subunit and a combination subunit; Wherein, the curvature subunit is used to calculate the curvature calculation result according to the concavity and convexity of the grid in the model; The side length subunit is used to calculate the geometric feature calculation result according to the side length and angle of the triangle connected to the mesh vertex in the model; The flattening subunit is used to calculate the edge importance impact result according to the mesh edge length and the flatness of the triangles on both sides of the edge in the model; The combination subunit is used to perform linear combination calculation on the curvature calculation result, the geometric feature calculation result and the edge importance influence result according to a preset weight coefficient set to obtain the importance evaluation result.
19. A storage medium, characterized in that: The storage medium stores a computer program, which is called and executed by a computer to implement a model display control method based on a digital twin system as described in any one of claims 1 to 9 above.
Citation Information
Patent Citations
A hexahedral mesh structure simplification method for a mechanical casting model
CN109670206A
Lightweight construction method for three-dimensional model of digital twin system
CN117876560A
Three-dimensional model lightweight visualization method and device, terminal and storage medium
CN118052942A
BIM rapid lightweight method
CN118799529A
Cited By
Simplified expression method for geometric data in field of digital twinborn cities
CN119992026A
Geometric Data Simplified Representation Method in the Field of Digital Twin City
CN119992026B